[Issue 11000] New: Static field type inference failure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 9 16:56:32 PDT 2013
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 at puremagic.com
ReportedBy: daniel350 at bigpond.com
--- Comment #0 from daniel350 at bigpond.com 2013-09-09 16:56:30 PDT ---
```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: -------
More information about the Digitalmars-d-bugs
mailing list