[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] [S] Change in haiku[master]: Unittests: fix DateFormatTest
From:       Gerrit <review () review ! haiku-os ! org>
Date:       2023-08-27 14:20:12
Message-ID: 71c82bb674656c4c7634b44aea6206eb4dc2467f-HTML () review ! haiku-os ! org
[Download RAW message or body]

From Niels Sascha Reedijk <niels.reedijk@gmail.com>:

Niels Sascha Reedijk has uploaded this change for review. ( \
https://review.haiku-os.org/c/haiku/+/6874?usp=email )


Change subject: Unittests: fix DateFormatTest
......................................................................

Unittests: fix DateFormatTest

When building with GCC 13, this test no longer builds correctly and errors out
because the overloaded `operator<<` for `BPrivate::BDate` and `BPrivate::BTime`
can not be found.

The underlying cause is that the libstdc++ depended on some template SFINAE
behavior, and that did not work because the `operator<<` should only be looked
up in the `BPrivate` namespace.

It is unclear whether the code for libstdc++ changed, or whether this never was
supposed to work. GCC bug #51577 seems to imply that GCC before version 12
errornously allowed the lookup of names in the global namespace. It could be
that we always relied on this behavior:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577

Change-Id: Ia2f2306a2e97d5f19dc8c4df90a8491f22ef0bcd
---
M src/tests/kits/locale/DateFormatTest.cpp
1 file changed, 29 insertions(+), 0 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/74/6874/1

diff --git a/src/tests/kits/locale/DateFormatTest.cpp \
b/src/tests/kits/locale/DateFormatTest.cpp index 9b25d5a..a15be10 100644
--- a/src/tests/kits/locale/DateFormatTest.cpp
+++ b/src/tests/kits/locale/DateFormatTest.cpp
@@ -338,6 +338,9 @@
 }


+namespace BPrivate {
+
+
 std::ostream& operator<<(std::ostream& stream, const BDate& date)
 {
 	stream << date.Year();
@@ -362,6 +365,9 @@
 }


+} // namespace BPrivate
+
+
 void
 DateFormatTest::TestParseDate()
 {

--
To view, visit https://review.haiku-os.org/c/haiku/+/6874?usp=email
To unsubscribe, or for help writing mail filters, visit \
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ia2f2306a2e97d5f19dc8c4df90a8491f22ef0bcd
Gerrit-Change-Number: 6874
Gerrit-PatchSet: 1
Gerrit-Owner: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Gerrit-MessageType: newchange


[Attachment #3 (text/html)]

<p>Niels Sascha Reedijk has uploaded this change for \
<strong>review</strong>.</p><p><a \
href="https://review.haiku-os.org/c/haiku/+/6874?usp=email">View Change</a></p><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;">Unittests: fix \
DateFormatTest<br><br>When building with GCC 13, this test no longer builds correctly \
and errors out<br>because the overloaded `operator&lt;&lt;` for `BPrivate::BDate` and \
`BPrivate::BTime`<br>can not be found.<br><br>The underlying cause is that the \
libstdc++ depended on some template SFINAE<br>behavior, and that did not work because \
the `operator&lt;&lt;` should only be looked<br>up in the `BPrivate` \
namespace.<br><br>It is unclear whether the code for libstdc++ changed, or whether \
this never was<br>supposed to work. GCC bug #51577 seems to imply that GCC before \
version 12<br>errornously allowed the lookup of names in the global namespace. It \
could be<br>that we always relied on this \
behavior:<br>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51577<br><br>Change-Id: \
Ia2f2306a2e97d5f19dc8c4df90a8491f22ef0bcd<br>---<br>M \
src/tests/kits/locale/DateFormatTest.cpp<br>1 file changed, 29 insertions(+), 0 \
deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: \
pre-wrap;">git pull ssh://git.haiku-os.org:22/haiku refs/changes/74/6874/1</pre><pre \
style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git \
a/src/tests/kits/locale/DateFormatTest.cpp \
b/src/tests/kits/locale/DateFormatTest.cpp</span><br><span>index 9b25d5a..a15be10 \
100644</span><br><span>--- \
a/src/tests/kits/locale/DateFormatTest.cpp</span><br><span>+++ \
b/src/tests/kits/locale/DateFormatTest.cpp</span><br><span>@@ -338,6 +338,9 \
@@</span><br><span> }</span><br><span> </span><br><span> </span><br><span \
style="color: hsl(120, 100%, 40%);">+namespace BPrivate {</span><br><span \
style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span> std::ostream&amp; operator&lt;&lt;(std::ostream&amp; \
stream, const BDate&amp; date)</span><br><span> {</span><br><span> 	stream &lt;&lt; \
date.Year();</span><br><span>@@ -362,6 +365,9 @@</span><br><span> }</span><br><span> \
</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+} // \
namespace BPrivate</span><br><span style="color: hsl(120, 100%, \
40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> \
void</span><br><span> DateFormatTest::TestParseDate()</span><br><span> \
{</span><br><span></span><br></pre><p>To view, visit <a \
href="https://review.haiku-os.org/c/haiku/+/6874?usp=email">change 6874</a>. To \
unsubscribe, or for help writing mail filters, visit <a \
href="https://review.haiku-os.org/settings">settings</a>.</p><div itemscope \
itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" \
itemtype="http://schema.org/ViewAction"><link itemprop="url" \
href="https://review.haiku-os.org/c/haiku/+/6874?usp=email"/><meta itemprop="name" \
content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: haiku </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: \
Ia2f2306a2e97d5f19dc8c4df90a8491f22ef0bcd </div> <div style="display:none"> \
Gerrit-Change-Number: 6874 </div> <div style="display:none"> Gerrit-PatchSet: 1 \
</div> <div style="display:none"> Gerrit-Owner: Niels Sascha Reedijk \
&lt;niels.reedijk@gmail.com&gt; </div> <div style="display:none"> Gerrit-MessageType: \
newchange </div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic