https://d.puremagic.com/issues/show_bug.cgi?id=12120
--- Comment #3 from Puneet Goel <[email protected]> 2014-02-09 18:04:52 PST --- > > If you define constructors in a struct, the syntax `Type()` should be reserved > for default construction. > > If you want to support both Foo() and Foo(1), you should change the > constructor > to static Foo opCall(int). I am sorry if I missed something, but how do I initialize a struct object element from a call to Foo()? I believe default constructors are not allowed for structs. Say: class Bar {} struct Foo { Bar bar; // bar is not static static Foo opCall() { // I want to return a Foo object with bar initialized // How can I achieve that?? } this() { // Does not compile bar = new Bar(); } } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
