Bug 7742 – 'More initializers than fields' error with correct number of fields

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-03-20T11:35:00Z
Last change time
2012-03-25T13:23:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-03-20T11:35:07Z
This compiles with no errors: struct Foo { int x, y; static immutable Foo f = { 1, 2 }; } void main() {} But this gives an error, despite I think it used to work (and I think it's correct code): struct Foo { int x, y; static immutable f = Foo(1, 2); } void main() {} DMD 2.059head gives: test.d(3): Error: more initializers than fields (0) of Foo
Comment #1 by clugdbug — 2012-03-22T08:27:22Z
Almost the same as bug 7094.
Comment #2 by github-bugzilla — 2012-03-25T12:30:52Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/92c8e7bdcc9ad100f8efca5cac1095ff255413d3 fix issue 7742 - 'More initializers than fields' error with correct number of fields
Comment #3 by bearophile_hugs — 2012-03-25T13:23:16Z
*** Issue 7094 has been marked as a duplicate of this issue. ***