aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-02-07 15:09:14 -0500
committerJason Merrill <jason@redhat.com>2020-02-07 15:09:14 -0500
commit8496e135b111424e3c84f3f44c74f2cbe48eed90 (patch)
tree525830fda6b6a65deda7e1f7b5ebea4b388fdc55 /gcc
parent1e042b396e2a84e3ee17bc52def1bf241cb7d248 (diff)
downloadgcc-8496e135b111424e3c84f3f44c74f2cbe48eed90.zip
gcc-8496e135b111424e3c84f3f44c74f2cbe48eed90.tar.gz
gcc-8496e135b111424e3c84f3f44c74f2cbe48eed90.tar.bz2
c++: Make PR92654 testcase valid.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C
index fb26ac7..192c82d 100644
--- a/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda2.C
@@ -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>(); }