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
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6874
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Niels Sascha Reedijk
2023-08-27 16:11:15 +00:00
parent ba4482cb24
commit c14bd9b2e7
+6
View File
@@ -338,6 +338,9 @@ DateFormatTest::TestDayNames()
}
namespace BPrivate {
std::ostream& operator<<(std::ostream& stream, const BDate& date)
{
stream << date.Year();
@@ -362,6 +365,9 @@ std::ostream& operator<<(std::ostream& stream, const BTime& date)
}
} // namespace BPrivate
void
DateFormatTest::TestParseDate()
{