gcc/testsuite/g++.dg/warn/Wduplicated-cond1.C
raw| 1 | // PR c++/94265 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | // { dg-additional-options "-Wduplicated-cond" } |
| 4 | |
| 5 | void |
| 6 | foo () |
| 7 | { |
| 8 | if (int a = 0; a) |
| 9 | { } |
| 10 | else if (a = 5; a) // { dg-message "previously used here" } |
| 11 | { } |
| 12 | else if (; a) // { dg-warning "duplicated .if. condition" } |
| 13 | { } |
| 14 | else if (int b = ++a; a) |
| 15 | { } |
| 16 | } |