Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wduplicated-cond3.C

raw
1 // PR c++/107593
2 // { dg-do compile }
3 // { dg-options "-Wduplicated-cond" }
4
5 template <typename T>
6 void
7 foo ()
8 {
9 if (T() && T() && int())
10 ;
11 else if (T() && T() && int())
12 ;
13 }
14
15 template <typename T>
16 void bar(T a)
17 {
18 if (a)
19 ;
20 else if (a)
21 ;
22 }
23
24 template <typename>
25 void baz(int a)
26 {
27 if (a)
28 ;
29 else if (a) // { dg-warning "duplicated" }
30 ;
31 }
32 void
33 f ()
34 {
35 foo<int>();
36 bar(1);
37 baz<int>(1);
38 }