gcc/testsuite/g++.dg/cpp1z/init-statement9.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | |
| 3 | void |
| 4 | f () |
| 5 | { |
| 6 | { |
| 7 | int c; |
| 8 | if (int c = 2; c != 0) |
| 9 | int c = 4; // { dg-error "redeclaration" } |
| 10 | } |
| 11 | |
| 12 | if (int c = 2; c != 0) |
| 13 | int c = 4; // { dg-error "redeclaration" } |
| 14 | |
| 15 | if (int c = 2; int c = 6) // { dg-error "redeclaration" } |
| 16 | int c = 4; // { dg-error "redeclaration" } |
| 17 | } |