2 /* { dg-do compile } */
3 /* { dg-options "-Wduplicated-branches" } */
5 extern int *p
, foo (void), a
[10];
13 *p
+= i
? 1 : 1; /* { dg-warning "this condition has identical branches" } */
14 *p
+= i
? N
: M
; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
15 *p
+= i
? M
: N
; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
16 *p
+= i
? i
: i
; /* { dg-warning "this condition has identical branches" } */
17 *p
+= i
? i
++ : i
++; /* { dg-warning "this condition has identical branches" } */
18 *p
+= i
? foo () : foo (); /* { dg-warning "this condition has identical branches" } */
19 *p
+= i
? ({ i
++; }) : ({ i
++; }); /* { dg-warning "this condition has identical branches" } */
20 *p
+= i
? a
[i
] : a
[i
]; /* { dg-warning "this condition has identical branches" } */
21 *p
+= i
? a
[5] : a
[5]; /* { dg-warning "this condition has identical branches" } */
22 *p
+= i
? a
[N
] : a
[M
]; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
23 *p
+= i
? a
[5] : a
[M
]; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
24 *p
+= i
? a
[M
] : a
[5]; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
25 *p
+= i
? a
[I
] : a
[I
]; /* { dg-warning "this condition has identical branches" } */
26 *p
+= i
? a
[i
] : a
[I
]; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
27 *p
+= i
? a
[I
] : a
[i
]; /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
32 *p
+= i
?: i
; /* { dg-warning "this condition has identical branches" "" { target c++ } } */
35 *p
+= i
?: ({ i
++; });
45 *p
+= (i
> 5 ? (i
> 10 ? i
: i
) : i
); /* { dg-warning "this condition has identical branches" } */