```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.
Comment #1 by andrej.mitrovich — 2013-09-09T18:03:19Z
This looks like a dupe I've seen before. Reduced:
-----
struct Foo
{
this(int) {}
static f = Foo(1);
}
void main() { }
-----