[PR105324] libstdc++: testsuite: pr105324 requires FP from_char
authorAlexandre Oliva <oliva@adacore.com>
Tue, 3 May 2022 17:57:15 +0000 (14:57 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 3 May 2022 17:57:15 +0000 (14:57 -0300)
The floating-point overloads of from_char are only declared if
_GLIBCXX_HAVE_USELOCALE is #defined as nonzero.  That's exposed from
charconv as __cpp_lib_to_chars >= 201611L, so guard the test body with
that.

for  libstdc++-v3/ChangeLog

PR c++/105324
* testsuite/20_util/from_chars/pr105324.cc: Guard test body
with conditional for floating-point overloads of from_char.

libstdc++-v3/testsuite/20_util/from_chars/pr105324.cc

index cecb17e..ef24b4c 100644 (file)
@@ -5,10 +5,12 @@
 
 int main()
 {
+#if __cpp_lib_to_chars >= 201611L // FP from_char not available otherwise.
   // PR libstdc++/105324
   // std::from_chars() assertion at floating_from_chars.cc:78
   std::string s(512, '1');
   s[1] = '.';
   long double d;
   std::from_chars(s.data(), s.data() + s.size(), d);
+#endif
 }