From 1baecf4a155842defd64d406de5b56f19a99859b Mon Sep 17 00:00:00 2001
From: Greg King <gregdk@users.sf.net>
Date: Thu, 13 Aug 2015 03:39:35 -0400
Subject: [PATCH] Added regression tests of diagnostics for conflicts between
 extern/public and static declarations.

---
 test/err/static-2.c | 20 ++++++++++++++++++++
 test/err/static-3.c | 20 ++++++++++++++++++++
 test/err/static-4.c | 20 ++++++++++++++++++++
 test/val/static-1.c | 20 ++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 test/err/static-2.c
 create mode 100644 test/err/static-3.c
 create mode 100644 test/err/static-4.c
 create mode 100644 test/val/static-1.c

diff --git a/test/err/static-2.c b/test/err/static-2.c
new file mode 100644
index 000000000..c89097825
--- /dev/null
+++ b/test/err/static-2.c
@@ -0,0 +1,20 @@
+/*
+  !!DESCRIPTION!! global non-static and static conflicts
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg King
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+#pragma warn(error, on)
+
+int n;
+static int n;           /* should give an error */
+
+int main(void)
+{
+    return n;
+}
diff --git a/test/err/static-3.c b/test/err/static-3.c
new file mode 100644
index 000000000..5b6839a6a
--- /dev/null
+++ b/test/err/static-3.c
@@ -0,0 +1,20 @@
+/*
+  !!DESCRIPTION!! global non-static and static conflicts
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg King
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+#pragma warn(error, on)
+
+extern int n;
+static int n;           /* should give an error */
+
+int main(void)
+{
+    return n;
+}
diff --git a/test/err/static-4.c b/test/err/static-4.c
new file mode 100644
index 000000000..a2cdeb78a
--- /dev/null
+++ b/test/err/static-4.c
@@ -0,0 +1,20 @@
+/*
+  !!DESCRIPTION!! global non-static and static conflicts
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg King
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+#pragma warn(error, on)
+
+static int n;
+int n;                  /* should give an error */
+
+int main(void)
+{
+    return n;
+}
diff --git a/test/val/static-1.c b/test/val/static-1.c
new file mode 100644
index 000000000..ae2ba6289
--- /dev/null
+++ b/test/val/static-1.c
@@ -0,0 +1,20 @@
+/*
+  !!DESCRIPTION!! global non-static and static conflicts
+  !!ORIGIN!!      cc65 regression tests
+  !!LICENCE!!     Public Domain
+  !!AUTHOR!!      Greg King
+*/
+
+/*
+  see: https://github.com/cc65/cc65/issues/191
+*/
+
+#pragma warn(error, on)
+
+static int n = 0;
+extern int n;           /* should not give an error */
+
+int main(void)
+{
+    return n;
+}