summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c
blob: ba8dce84f5dfb5346543b230c7261eb5af8eca2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-Wlogical-not-parentheses -fdiagnostics-show-caret" } */

 /* Test fixit hints.  */

int
foo (int aaa, int bbb)
{
  int r = 0;
  r += (!aaa) == bbb;
  r += !aaa == bbb; /* { dg-warning "logical not is only applied" } */
/* { dg-begin-multiline-output "" }
   r += !aaa == bbb;
             ^~
   r += !aaa == bbb;
        ^~~~
        (   )
   { dg-end-multiline-output "" } */
  return r;
}