aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.old-deja/g++.bugs/900211_04.C
blob: 5043606107de3400c853029d6d95579db81875e5 (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
// { dg-do assemble  }
// g++ 1.36.1 bug 900211_04

// g++ fails to flag as errors attempts to compare pointer values against
// (nonzero) integer values;

// Since implicit conversions of pointer to integers (or vise versa) are
// illegal, these comparisons are also illegal.

// Cfront 2.0 passes this test.

// keywords: comparison operators, pointer types, integral types

int result;
int i;
char *p;

void function ()
{
  result = i == p;	/* { dg-error "" } caught by g++ */
  result = i != p;	/* { dg-error "" } caught by g++ */
  result = i >  p;	/* { dg-error "" } missed */
  result = i <  p;	/* { dg-error "" } missed */
  result = i >= p;	/* { dg-error "" } missed */
  result = i <= p;	/* { dg-error "" } missed */
}

int main () { return 0; }