[Issue 8638] built-in array opSliceAssign fails with user defined opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 12 01:46:50 PDT 2012


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



--- Comment #1 from monarchdodra at gmail.com 2012-09-12 01:47:03 PDT ---
The issue can be worked around as such:

--------
struct S
{
    int i;
    void opAssign(S);
    void opAssign(int j);
}

void main()
{
    ulong[] i;
    i[] = cast(ushort)5; //Here1

    S[] s;
    s[] = S(5); //Here2
}
--------

However, this shifts the requirement:
*from isAssignable!(S,V)
*to isAssignable!(S,S) && "canBeConstructedFrom!(S, V)"

Where S is the user defined struct, and V is another type.

Note that the built-in opSliceAssign DOES support assignement of V to S
(HERE1), so there is indeed a limitation/bug/ER.

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