]> git.sur5r.net Git - cc65/commitdiff
Add regression tests for duplicate globals with different linkage. 381/head
authorPiotr Fusik <fox@scene.pl>
Thu, 9 Mar 2017 20:18:48 +0000 (21:18 +0100)
committerPiotr Fusik <fox@scene.pl>
Thu, 9 Mar 2017 20:18:48 +0000 (21:18 +0100)
test/err/duplicate-global-static.c [new file with mode: 0644]
test/err/duplicate-static-global.c [new file with mode: 0644]

diff --git a/test/err/duplicate-global-static.c b/test/err/duplicate-global-static.c
new file mode 100644 (file)
index 0000000..6aa27f5
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+  !!DESCRIPTION!! global duplicated with static variable
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Piotr Fusik
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+int n = 0;
+static int n = 0;           /* should give an error */
+
+int main(void)
+{
+    return n;
+}
diff --git a/test/err/duplicate-static-global.c b/test/err/duplicate-static-global.c
new file mode 100644 (file)
index 0000000..6e5e70a
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+  !!DESCRIPTION!! static duplicated with global variable
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Piotr Fusik
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+static int n = 0;
+int n = 0;           /* should give an error */
+
+int main(void)
+{
+    return n;
+}