From bda8b04aafbf2e846234a2bdb0543d9fa7dfa5c2 Mon Sep 17 00:00:00 2001 From: k-hara Date: Tue, 26 Aug 2014 15:35:48 +0900 Subject: [PATCH] fix Issue 12531 - forward reference with nested struct --- src/struct.c | 2 ++ test/compilable/fwdref12531.d | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/compilable/fwdref12531.d diff --git a/src/struct.c b/src/struct.c index 0768ddb82702..49c1b463999f 100644 --- a/src/struct.c +++ b/src/struct.c @@ -172,6 +172,8 @@ void AggregateDeclaration::semantic2(Scope *sc) if (!members) return; + if (scope && sizeok == SIZEOKfwd) // Bugzilla 12531 + semantic(NULL); if (scope) { error("has forward references"); diff --git a/test/compilable/fwdref12531.d b/test/compilable/fwdref12531.d new file mode 100644 index 000000000000..3172e8ad2852 --- /dev/null +++ b/test/compilable/fwdref12531.d @@ -0,0 +1,14 @@ +// PERMUTE_ARGS: + +struct Node(T) +{ + T _val; +} + +void foo() +{ + static struct Foo + { + Node!Foo* node; + } +}