[Issue 6523] New: Vector slice assign of a struct with opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 17 11:15:48 PDT 2011


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

           Summary: Vector slice assign of a struct with opAssign
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-08-17 11:15:47 PDT ---
import std.bigint: BigInt;
void main() {
    BigInt[1] array;
    array[0] = 1;        // OK
    array[] = BigInt(1); // OK
    array[] = 1;         // line 6, error
}



DMD 2.055beta gives:

test.d(6): Error: cannot implicitly convert expression (1) of type int to
BigInt[]


I think this is the reduced version:


struct Foo {
    int x;
    void opAssign(int x) {}
}
void main() {
    Foo[1] array;
    array[0] = 1;     // OK
    array[] = Foo(1); // OK
    array[] = 1;      // error
}


opAssign doesn't get called.

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