c++: Make PR92654 testcase valid.
authorJason Merrill <jason@redhat.com>
Fri, 7 Feb 2020 20:09:14 +0000 (15:09 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 7 Feb 2020 20:09:14 +0000 (15:09 -0500)
gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C

index fb26ac7..192c82d 100644 (file)
@@ -1,12 +1,17 @@
 // PR c++/92654
 // { dg-do compile { target c++17 } }
 
-template <unsigned long> struct C;
+struct A {
+  constexpr operator int () { return 42; }
+};
+template <int I> struct C {
+  static const bool ap = I;
+};
 template <auto I>
 void am() {
   [](auto an)
      {
-       if constexpr (C<an>::ap) ; // { dg-error "constant" }
-     }(42);
+       if constexpr (C<an>::ap) ;
+     }(A{});
 }
 void fn() { am<42>(); }