summaryrefslogtreecommitdiffstats
path: root/test/PCH/cxx1z-init-statement.h
blob: 16bd569c848c4f2e30a192cfa3861843cf7949ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Header for PCH test cxx1z-init-statement.cpp

constexpr int test_if(int x) { 
  if (int a = ++x; a == 0) {
    return -1;
  } else if (++a; a == 2) {
    return 0;
  }
  return 2;
}

constexpr int test_switch(int x) {
  switch (int a = ++x; a) {
    case 0:
      return -1;
    case 1:
      return 0;
    case 2:
      return 1;
  }
  return 2;
}