]> git.sur5r.net Git - cc65/blobdiff - test/err/duplicate-static.c
Add regression tests for duplicate global/static variables detected by the compiler.
[cc65] / test / err / duplicate-static.c
diff --git a/test/err/duplicate-static.c b/test/err/duplicate-static.c
new file mode 100644 (file)
index 0000000..394cc1e
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+  !!DESCRIPTION!! duplicate static variables
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Piotr Fusik
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+#pragma warn(error, on)
+
+static int n = 0;
+static int n = 0;           /* should give an error */
+
+int main(void)
+{
+    return n;
+}