September 22, 2014 [Issue 7255] Struct array assign? | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=7255 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> --- (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 *** -- |
Copyright © 1999-2021 by the D Language Foundation