1 | // Header for PCH test cxx1z-init-statement.cpp |
---|---|
2 | |
3 | constexpr int test_if(int x) { |
4 | if (int a = ++x; a == 0) { |
5 | return -1; |
6 | } else if (++a; a == 2) { |
7 | return 0; |
8 | } |
9 | return 2; |
10 | } |
11 | |
12 | constexpr int test_switch(int x) { |
13 | switch (int a = ++x; a) { |
14 | case 0: |
15 | return -1; |
16 | case 1: |
17 | return 0; |
18 | case 2: |
19 | return 1; |
20 | } |
21 | return 2; |
22 | } |
23 |