From 05d1b8072b580b1a68e09a76f21c9b8599af7028 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Thu, 9 Mar 2017 21:18:48 +0100 Subject: [PATCH] Add regression tests for duplicate globals with different linkage. --- test/err/duplicate-global-static.c | 18 ++++++++++++++++++ test/err/duplicate-static-global.c | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 test/err/duplicate-global-static.c create mode 100644 test/err/duplicate-static-global.c diff --git a/test/err/duplicate-global-static.c b/test/err/duplicate-global-static.c new file mode 100644 index 000000000..6aa27f5b7 --- /dev/null +++ b/test/err/duplicate-global-static.c @@ -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 index 000000000..6e5e70a37 --- /dev/null +++ b/test/err/duplicate-static-global.c @@ -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; +} -- 2.39.5