http://d.puremagic.com/issues/show_bug.cgi?id=11346
--- Comment #1 from Kenji Hara <[email protected]> 2013-10-24 17:24:38 PDT --- (In reply to comment #0) > Code: > ---- > import std.stdio; > > struct Test { > public: > const int[] test; > > this(int i) { > for (size_t j = 0; j < 4; ++j) { > this.test ~= i + j; > } > } > } > > void main() { > Test t = Test(42); > } > ---- > > Error: field test initializing not allowed in loops or after labels > > WTF? It's intended behavior change introduced by fixing bug 9665. Possible code fix is: this(int i) { int[] tmp; for (size_t j = 0; j < 4; ++j) { tmp ~= i + j; } this.test = tmp; // initialize non-mutable field only once } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
