blob: faac00ca9974f3ec3cec51c040c15cb091278aaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
// Testcase from P0170R1
// { dg-do compile { target c++17 } }
auto ID = [](auto a) { return a; };
static_assert( ID (3) == 3); // OK
struct NonLiteral {
NonLiteral(int n) : n(n) { }
int n;
};
static_assert( ID (NonLiteral{3}).n == 3); // { dg-error "non-literal" "" { target { ! implicit_constexpr } } }
// { dg-prune-output "static assertion" }
|