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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 30 01:44:22 PDT 2013


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



--- Comment #10 from rswhite4 at googlemail.com 2013-10-30 01:44:17 PDT ---
Couldn't the compiler to this dirty trick for me?
If he found such multiple init case, he could rewrite the code. So that this
code:
----
this(int x, size_t i) {
    arr[0] = x;
    arr[1] = x + 1;
    arr[i] = x + 2;  // which index will be initialized in runtime?
}
----

if rewritten to this:

this(int x, size_t i) {
     Unqual!typeof(arr) __arr = null;

    __arr[0] = x;
    __arr[1] = x + 1;
    __arr[i] = x + 2;

    this.arr = __arr; /// only _one_ assignment
}

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