D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6299 - Auto constructor for heap structs too
Summary: Auto constructor for heap structs too
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-07-12 11:55 UTC by bearophile_hugs
Modified: 2014-03-19 18:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-07-12 11:55:14 UTC
Regarding "Removing limitations", I'd like this to compile with no need to write a constructor:


struct Foo { int x; }
void main() {
    auto f = new Foo(1);
}


In DMD 2.054 this gives:
test.d(3): Error: no constructor for Foo
Comment 1 Infiltrator 2014-03-19 18:57:08 UTC
This works as of v2.065.