[Issue 11343] [2.064 beta] Error: multiple field initialization

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 24 17:22:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11343



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-10-24 17:22:40 PDT ---
(In reply to comment #1)
> Consider also this:
> 
> ----
> import std.stdio;
> 
> struct Test {
> public:
>     const int[] test;
> 
>     this(int i) {
>         this.test ~= i;
>         this.test ~= i + 1;
>     }
> }
> 
> void main() {
>     Test t = Test(42);
> }
> ----
> 
> Same error

The code modifies a non-mutable array field 'const(int[]) test' twice.
Create temporary int[] and initialize Test.test by that.

-- 
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