digitalmars.D.bugs - [Issue 11000] New: Static field type inference failure
- d-bugmail puremagic.com (31/31) Sep 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11000
- d-bugmail puremagic.com (18/18) Sep 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11000
http://d.puremagic.com/issues/show_bug.cgi?id=11000 Summary: Static field type inference failure Product: D Version: D2 Platform: All OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: daniel350 bigpond.com ```struct Foo { int a; this(int a) { this.a = a; } // reason for fail static immutable bar = Foo(1); // fails // static immutable Foo bar = Foo(1); // works } void main() { auto a = Foo.bar; } ``` The code above should compile, instead: `test.d(6): Error: cannot create a struct until its size is determined`. Remove the explicit constructor at line 4, and line 6 compiles. Add the explicit type onto the type declaration (as on line 7), and it will work without removing the explicit constructor. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 09 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11000 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 18:03:19 PDT --- This looks like a dupe I've seen before. Reduced: ----- struct Foo { this(int) {} static f = Foo(1); } void main() { } ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 09 2013