]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Adjust std::from_chars negative tests
authorJonathan Wakely <jwakely@redhat.com>
Tue, 23 Jun 2020 11:20:26 +0000 (12:20 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 23 Jun 2020 11:20:26 +0000 (12:20 +0100)
Also test with an enumeration type. Move the dg-error directives outside
the #if block, because DejaGnu would process them whether or not wchar_t
support is present.

libstdc++-v3/ChangeLog:

* testsuite/20_util/from_chars/1_c++20_neg.cc: Check enumeration
type.
* testsuite/20_util/from_chars/1_neg.cc: Likewise. Move dg-error
directives outside preprocessor condition.

libstdc++-v3/testsuite/20_util/from_chars/1_c++20_neg.cc
libstdc++-v3/testsuite/20_util/from_chars/1_neg.cc

index 8a73b2de72dfac2ecd9375392327ef05b33733c0..8454b304d1384349d547b3cef216151d118f8276 100644 (file)
@@ -35,6 +35,9 @@ test01(const char* first, const char* last)
   char32_t c32;
   std::from_chars(first, last, c32); // { dg-error "no matching" }
   std::from_chars(first, last, c32, 10); // { dg-error "no matching" }
+  enum E { } e;
+  std::from_chars(first, last, e); // { dg-error "no matching" }
+  std::from_chars(first, last, e, 10); // { dg-error "no matching" }
 }
 
 // { dg-prune-output "enable_if" }
index 3f46b7e7b9599d776ef8ed9104b9c3580e2cd881..12b5e597b9f5861514e5920091256da53d87072c 100644 (file)
@@ -25,9 +25,11 @@ test01(const char* first, const char* last)
 {
 #if _GLIBCXX_USE_WCHAR_T
   wchar_t wc;
+#else
+  enum W { } wc;
+#endif
   std::from_chars(first, last, wc); // { dg-error "no matching" }
   std::from_chars(first, last, wc, 10); // { dg-error "no matching" }
-#endif
 
   char16_t c16;
   std::from_chars(first, last, c16); // { dg-error "no matching" }
@@ -35,6 +37,10 @@ test01(const char* first, const char* last)
   char32_t c32;
   std::from_chars(first, last, c32); // { dg-error "no matching" }
   std::from_chars(first, last, c32, 10); // { dg-error "no matching" }
+
+  enum E { } e;
+  std::from_chars(first, last, e); // { dg-error "no matching" }
+  std::from_chars(first, last, e, 10); // { dg-error "no matching" }
 }
 
 // { dg-prune-output "enable_if" }