2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / null1.C
blob0cf50a291d167d1579163df3106732b1e922ccaf
1 // { dg-do link  }
3 #include <cstddef>
5 void g(int) {}
6 void g(long) {}
7 extern void g(void*);
9 template <int I>
10 void h() {}
12 void k(int) {}
14 template <class T>
15 void l(T);
17 template <>
18 void l(int) {}
20 template <>
21 void l(long) {}
23 int main()
25   int i = NULL; // { dg-warning "" } converting NULL to non-pointer type
26   float z = NULL; // { dg-warning "" } converting NULL to non-pointer type
27   int a[2];
29   i != NULL; // { dg-warning "" } NULL used in arithmetic
30   NULL != z; // { dg-warning "" } NULL used in arithmetic
31   k != NULL; // No warning: decay conversion
32   NULL != a; // Likewise.
33   -NULL;     // { dg-warning "" } converting NULL to non-pointer type
34   +NULL;     // { dg-warning "" } converting NULL to non-pointer type
35   ~NULL;     // { dg-warning "" } converting NULL to non-pointer type
36   a[NULL] = 3; // { dg-warning "" } converting NULL to non-pointer-type
37   i = NULL;  // { dg-warning "" } converting NULL to non-pointer type
38   z = NULL;  // { dg-warning "" } converting NULL to non-pointer type
39   k(NULL);   // { dg-warning "" } converting NULL to int
40   g(NULL);   // { dg-warning "" } converting NULL to int
41   h<NULL>(); // { dg-warning "" } NULL bound to integer template parameter
42   l(NULL);   // { dg-warning "" } converting NULL to int
43   NULL && NULL; // No warning: converting NULL to bool is OK