summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/null1.C
diff options
context:
space:
mode:
authorYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
committerYamaArashi <shadow962@live.com>2016-01-06 01:47:28 -0800
commitbe8b04496302184c6e8f04d6179f9c3afc50aeb6 (patch)
tree726e2468c0c07add773c0dbd86ab6386844259ae /gcc/testsuite/g++.old-deja/g++.other/null1.C
initial commit
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/null1.C')
-rwxr-xr-xgcc/testsuite/g++.old-deja/g++.other/null1.C40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/null1.C b/gcc/testsuite/g++.old-deja/g++.other/null1.C
new file mode 100755
index 0000000..1c72d1c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/null1.C
@@ -0,0 +1,40 @@
+// Build don't run:
+
+#include <cstddef>
+
+void g(int) {}
+extern void g(void*);
+
+template <int I>
+void h() {}
+
+void k(int) {}
+
+template <class T>
+void l(T);
+
+template <>
+void l(int) {}
+
+int main()
+{
+ int i = NULL; // WARNING - converting NULL to non-pointer type
+ float z = NULL; // WARNING - converting NULL to non-pointer type
+ int a[2];
+
+ i != NULL; // WARNING - NULL used in arithmetic
+ NULL != z; // WARNING - NULL used in arithmetic
+ k != NULL; // No warning: decay conversion
+ NULL != a; // Likewise.
+ -NULL; // WARNING - converting NULL to non-pointer type
+ +NULL; // WARNING - converting NULL to non-pointer type
+ ~NULL; // WARNING - converting NULL to non-pointer type
+ a[NULL] = 3; // WARNING - converting NULL to non-pointer-type
+ i = NULL; // WARNING - converting NULL to non-pointer type
+ z = NULL; // WARNING - converting NULL to non-pointer type
+ k(NULL); // WARNING - converting NULL to int
+ g(NULL); // WARNING - converting NULL to int
+ h<NULL>(); // WARNING - NULL bound to integer template parameter
+ l(NULL); // WARNING - converting NULL to int
+ NULL && NULL; // No warning: converting NULL to bool is OK
+}