summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
blob: b04529827d5a4bf7b39fa9555ccf36e484946541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// { dg-do compile }
// { dg-options "-Wparentheses" }

// C++ version of gcc.dg/Wparentheses-9.c

int foo (int);

int a, b, c;

int
bar (void)
{
  if (a)
    foo (0);
  if (b)
    foo (1);
  else
    foo (2);
  if (c) // { dg-warning "ambiguous" "correct warning" }
    if (a)
      foo (3);
    else
      foo (4);
  if (a)
    if (c)
      foo (5);
  if (a)
    if (b) // { dg-warning "ambiguous" "correct warning" }
      if (c)
	foo (6);
      else
	foo (7);
  if (a) // { dg-warning "ambiguous" "correct warning" }
    if (b)
      if (c)
	foo (8);
      else
	foo (9);
    else
      foo (10);
  if (a)
    if (b)
      if (c)
	foo (11);
      else
	foo (12);
    else
      foo (13);
  else
    foo (14);
  if (a) {
    if (b)
      if (c)
	foo (15);
      else
	foo (16);
    else
      foo (17);
  }
}