https://issues.dlang.org/show_bug.cgi?id=7255
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Kenji Hara <[email protected]> --- (In reply to bearophile_hugs from comment #0) > But if you put the elements into an array they aren't accepted (the same > problem happens with BigInts, etc): > > struct MyTypedefInt { > int x; > this(int xx) { this.x = xx; } > } > void main() { > MyTypedefInt[2] a3 = [1, 2]; // Error: cannot implicitly convert > expression > } This is a dup of issue 8864. > This too is refused: > > struct MyTypedefInt { > int x; > this(int xx) { this.x = xx; } > // void opAssign(int xx) { this.x = xx; } > } > void main() { > MyTypedefInt[2] a3 = [{ 1 }, { 2 }]; > } This is invalid, because StructInitialier won't match with any constructor call. *** This issue has been marked as a duplicate of issue 8864 *** --
