From c14bd9b2e7cf490db541587f22514659439aa8e9 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sun, 27 Aug 2023 15:14:33 +0100 Subject: [PATCH] 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 Tested-by: Commit checker robot --- src/tests/kits/locale/DateFormatTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tests/kits/locale/DateFormatTest.cpp b/src/tests/kits/locale/DateFormatTest.cpp index 9b25d5a7fa..a15be10e8b 100644 --- a/src/tests/kits/locale/DateFormatTest.cpp +++ b/src/tests/kits/locale/DateFormatTest.cpp @@ -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() {