c++: Make PR92654 testcase valid.

This commit is contained in:
Jason Merrill 2020-02-07 15:09:14 -05:00
parent 1e042b396e
commit 8496e135b1

View 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>(); }