Bug 215 – static initialization problem - invalid code, bogus error message

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-06-21T06:43:00Z
Last change time
2014-02-15T13:19:54Z
Keywords
rejects-valid, wrong-code
Assigned to
bugzilla
Creator
h3r3tic

Comments

Comment #0 by h3r3tic — 2006-06-21T06:43:11Z
The folowing code: // tmp11.d: template Foo() { template nothing(int i = 0) { } int foo = 1; } struct Bar { mixin Foo f; } // ---- Causes DMD to output the following error: tmp11.d(9): struct tmp11.Bar overlapping initialization for struct Bar.foo Yet this is still nothing compared to: // ---- template Foo() { template nothing(int i = 0) { } struct Blah { int foo = 1; } Blah blah; } struct Bar { mixin Foo f; } void main() { Bar y; printf("%d\n", y.f.blah.foo); assert (y.f.blah.foo == 1); } // ---- Which compiles, and when ran, prints '0' and reports a failed assertion error :(
Comment #1 by matti.niemenmaa+dbugzilla — 2006-11-15T05:01:19Z
Works in DMD 0.174.