Bug 9417 – "no size yet for forward reference" error with nested structure
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-28T09:54:00Z
Last change time
2013-04-06T16:09:29Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
maximzms
Comments
Comment #0 by maximzms — 2013-01-28T09:54:56Z
Code:
--------------------
mixin template Foo()
{
void foo() {}
}
void main()
{
struct B
{
mixin Foo;
}
}
--------------------
Compiler output:
--------------------
test.d(9): Error: struct test.main.B no size yet for forward reference
test.d(10): Error: mixin test.main.B.Foo!() error instantiating
--------------------
Observations:
- This error appears only with DMD from Git head, no error with v2.060.
- No error if the structure is placed outside main()
- No error if template has no function inside
- The same error appears if structure is placed inside a unittest block
- No error if the structure is placed inside other structure or class