1 // { dg-do link }
2 // { dg-options "-Wconversion -Wno-conversion-null -Wno-pointer-arith" }
3
4 #include <cstddef>
5
g(int)6 void g(int) {}
g(long)7 void g(long) {}
g(long long)8 void g(long long) {}
9 extern void g(void*);
10
11 template <int I>
h()12 void h() {}
13
k(int)14 void k(int) {}
15
16 template <class T>
17 void l(T);
18
19 template <>
l(int)20 void l(int) {}
21
22 template <>
l(long)23 void l(long) {}
24
25 template <>
l(long long)26 void l(long long) {}
27
main()28 int main()
29 {
30 int i = NULL; // converting NULL to non-pointer type
31 float z = NULL; // converting NULL to non-pointer type
32 int a[2];
33
34 i != NULL; // NULL used in arithmetic
35 NULL != z; // NULL used in arithmetic
36 k != NULL; // No warning: decay conversion
37 NULL != a; // Likewise.
38 -NULL; // converting NULL to non-pointer type
39 +NULL; // converting NULL to non-pointer type
40 ~NULL; // converting NULL to non-pointer type
41 a[NULL] = 3; // converting NULL to non-pointer-type
42 i = NULL; // converting NULL to non-pointer type
43 z = NULL; // converting NULL to non-pointer type
44 k(NULL); // converting NULL to int
45 g(NULL); // converting NULL to int
46 h<NULL>(); // No warning: NULL bound to integer template parameter
47 l(NULL); // converting NULL to int
48 NULL && NULL; // No warning: converting NULL to bool is OK
49 }
50