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; + } +}