aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/pointer-integer-comparison.C
blob: c6b75a7fc125a82fae30c89ef4715559461f681e (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
// { dg-do compile }
// { dg-options "-fsyntax-only -fpermissive" } 

int foo (int i, void *p)
{
  if (i == p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 0;
  else if (i != p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 1;
}

int bar (int i, void *p)
{
  if (i < p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 0;
  else if (i >= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 1;
}

int baz (int i, void *p)
{
  if (i <= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 0;
  else if (i > p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
    return 1;
}