PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-switch4.C
blob383bde934be8113eeae8ad3c8bea640d98fe9d43
1 // PR c++/72868
2 // { dg-do compile }
3 // { dg-options "-std=gnu++14" }
5 constexpr int
6 foo (int i)
8   switch (i)
9     {
10     case 11 ... 12:
11       return 4;
12     case 0 ... 9:
13       return 3;
14     default:
15       return 7;
16     }
19 #define SA(X) static_assert((X),#X)
20 SA (foo (-1) == 7);
21 SA (foo (0) == 3);
22 SA (foo (3) == 3);
23 SA (foo (9) == 3);
24 SA (foo (10) == 7);
25 SA (foo (11) == 4);
26 SA (foo (12) == 4);
27 SA (foo (13) == 7);