]> git.sur5r.net Git - cc65/blobdiff - test/err/cc65150311-2.c
tests for illegal pointer operations that must always fail
[cc65] / test / err / cc65150311-2.c
diff --git a/test/err/cc65150311-2.c b/test/err/cc65150311-2.c
new file mode 100644 (file)
index 0000000..34c862a
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  !!DESCRIPTION!! function pointer bugs
+  !!ORIGIN!!      testsuite
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg
+*/
+
+/*
+  see: http://www.cc65.org/mailarchive/2015-03/11726.html
+  and: http://www.cc65.org/mailarchive/2015-03/11734.html
+*/
+
+static int func(void) {return 0;}
+static int (*p)(void);
+static int n;
+
+int main(void) {
+
+    p = func;
+    n = (p == &func);
+    n = (p == func);
+
+    n = (p > &func); /* invalid C */
+
+    return 0;
+}