From 5597b83d041301554726d329548644b145a80cd8 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Mon, 13 Jul 2020 15:13:38 +0200 Subject: [PATCH] added testcase for issue #975 --- test/misc/bug975.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/misc/bug975.c diff --git a/test/misc/bug975.c b/test/misc/bug975.c new file mode 100644 index 000000000..458524a5a --- /dev/null +++ b/test/misc/bug975.c @@ -0,0 +1,18 @@ +/* bug #975 - Forward array reference fails to compile */ + +#include + +// this works +static const unsigned char array2[3]; +int test2(void) { + return array2[0]; +} +static const unsigned char array2[] = { 0, 1, 2 }; + +// this should work, but does not compile +static const unsigned char array[]; +int main() { + if (test2() != 0) return EXIT_FAILURE; + return array[0]; +} +static const unsigned char array[] = { 0, 1, 2 };