D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7742 - 'More initializers than fields' error with correct number of fields
Summary: 'More initializers than fields' error with correct number of fields
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: rejects-valid
: 7094 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-03-20 11:35 UTC by bearophile_hugs
Modified: 2012-03-25 13:23 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2012-03-20 11:35:07 UTC
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 Don 2012-03-22 08:27:22 UTC
Almost the same as bug 7094.
Comment 2 github-bugzilla 2012-03-25 12:30:52 UTC
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 bearophile_hugs 2012-03-25 13:23:16 UTC
*** Issue 7094 has been marked as a duplicate of this issue. ***