Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wparentheses-21.C

raw
1 // { dg-do compile }
2 // { dg-options "-Wparentheses" }
3
4 // Template version of Wparentheses-12.C. Note that we currently warn
5 // when we initially parse the template, not when we are instantiating
6 // it. That seems reasonable since the template parameters can not
7 // affect the syntax parsing.
8
9 int foo (int);
10
11 int a, b, c;
12
13 template<class T>
14 void
15 bar (T)
16 {
17 if (a)
18 foo (0);
19 if (b)
20 foo (1);
21 else
22 foo (2);
23 if (c) // { dg-warning "ambiguous" "correct warning" }
24 if (a)
25 foo (3);
26 else
27 foo (4);
28 if (a)
29 if (c)
30 foo (5);
31 if (a)
32 if (b) // { dg-warning "ambiguous" "correct warning" }
33 if (c)
34 foo (6);
35 else
36 foo (7);
37 if (a) // { dg-warning "ambiguous" "correct warning" }
38 if (b)
39 if (c)
40 foo (8);
41 else
42 foo (9);
43 else
44 foo (10);
45 if (a)
46 if (b)
47 if (c)
48 foo (11);
49 else
50 foo (12);
51 else
52 foo (13);
53 else
54 foo (14);
55 if (a) {
56 if (b)
57 if (c)
58 foo (15);
59 else
60 foo (16);
61 else
62 foo (17);
63 }
64 }
65
66 template void bar<int> (int);