blob: 9e661b6a55d4895fe67bb8d86995bde2e6d5510e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// Test that we don't make lambdas with goto/static implicitly constexpr
// when an explicitly constexpr function would be ill-formed.
// { dg-do compile { target c++17 } }
int main()
{
constexpr int a = [] {
return 42;
goto label;
label:
return 142;
}(); // { dg-error "" "" { target c++20_down } }
constexpr int b = [] {
return 42;
static int i;
}(); // { dg-error "" "" { target c++20_down } }
}
|