]> gcc.gnu.org Git - gcc.git/blobdiff - libstdc++-v3/testsuite/23_containers/span/index_op_neg.cc
libstdc++: Remove overzealous static_asserts from std::span
[gcc.git] / libstdc++-v3 / testsuite / 23_containers / span / index_op_neg.cc
index 1e8b2d8724eb127a77017286cb045cc1923025ec..c88477438de18583b31b6dc60e87176f67deeb52 100644 (file)
 // { dg-options "-std=gnu++2a" }
 // { dg-do compile { target c++2a } }
 
+#undef _GLIBCXX_ASSERTIONS
+#define _GLIBCXX_ASSERTIONS
 #include <span>
 
-void
-test01()
+constexpr bool
+test01(bool b)
 {
   std::span<int, 0> s;
-  s[99]; // { dg-error "here" }
+  if (b || !s.empty())
+    s[99];
+  return true;
 }
-// { dg-error "static assertion failed" "" { target *-*-* } 0 }
+
+static_assert(test01(false));
+static_assert(test01(true)); // { dg-error "non-constant" }
+// { dg-error "assert" "" { target *-*-* } 0 }
+// { dg-prune-output "in 'constexpr' expansion" }
This page took 0.02474 seconds and 5 git commands to generate.