www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20714] New: Struct with postblitting member does not call

https://issues.dlang.org/show_bug.cgi?id=20714

          Issue ID: 20714
           Summary: Struct with postblitting member does not call it's
                    copy constructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Ajieskola gmail.com

Tested with DMD 2.091.0:
```
struct Blitter
{       int payload;
    this(this){}
}

struct Adder
{       Blitter blitter;
        this(int payload){this.blitter.payload = payload;}
        this(ref Adder rhs){this.blitter.payload = rhs.blitter.payload + 1;}
}

void main()
{       import std.stdio;
        Adder piece1 = 1;
        auto piece2 = piece1;

        version (Excepted) assert (piece2.blitter.payload == 2);
        else assert (piece2.blitter.payload == 1);
}
```

--
Mar 31