llvm-project/clang/test/PCH/cxx1z-init-statement.h
Richard Smith a547eb27fa P0305R0: Semantic analysis and code generation for C++17 init-statement for 'if' and 'switch':
if (stmt; condition) { ... }

Patch by Anton Bikineev! Some minor formatting and comment tweets by me.

llvm-svn: 275350
2016-07-14 00:11:03 +00:00

23 lines
352 B
C++

// 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;
}