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

          Issue ID: 20942
           Summary: [DMD HEAD] Unable to append a postblit disabled struct
                    to a dynamic array
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: pun...@coverify.org

$ /tmp/dmd2/linux/bin64/dmd -version=BUG foo.d
foo.d(16): Error: struct foo.Foo is not copyable because it is annotated with
@disable
$ cat foo.d
struct Foo {
  version(BUG) {
    @disable this(this);
  }
  this(ref inout(Foo) other) {
    import std.stdio;
    writeln("Copy Construtor");
  }
}
void main() {
  Foo d;
  Foo e = d;                    // copy -- no issue
  Foo[] foos;
  // foos.length = foos.length + 1;
  // foos[$-1] = d;             // opAssign into array element -- no issue
  foos ~= d;                    // <<<<<< does not compile
}

--

Reply via email to