From ce0cf853867e7f1c51075499c264e7d48e845190 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Thu, 9 Mar 2017 20:40:20 +0100 Subject: [PATCH] Add regression test for #204. --- test/val/static-fwd-decl.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/val/static-fwd-decl.c diff --git a/test/val/static-fwd-decl.c b/test/val/static-fwd-decl.c new file mode 100644 index 000000000..420640d97 --- /dev/null +++ b/test/val/static-fwd-decl.c @@ -0,0 +1,35 @@ +/* + !!DESCRIPTION!! static forward declarations + !!ORIGIN!! cc65 regression tests + !!LICENCE!! Public Domain + !!AUTHOR!! Bob Andrews +*/ + +/* + see: https://github.com/cc65/cc65/issues/204 +*/ + +#pragma warn(error, on) + +typedef struct _DIRMENU +{ + const char *name; + struct _DIRMENU *dest; +} DIRMENU; + +static DIRMENU rmenu; + +static DIRMENU lmenu = { + "left", + &rmenu +}; + +static DIRMENU rmenu = { + "right", + &lmenu +}; + +int main(void) +{ + return lmenu.dest == &rmenu && rmenu.dest == &lmenu ? 0 : 1; +}