D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20942 - [DMD HEAD] Unable to append a postblit disabled struct to a dynamic array
Summary: [DMD HEAD] Unable to append a postblit disabled struct to a dynamic array
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 blocker
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-17 14:31 UTC by Puneet Goel
Modified: 2022-03-25 11:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Puneet Goel 2020-06-17 14:31:19 UTC
$ /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
}
Comment 1 Puneet Goel 2020-06-17 18:02:45 UTC
Getting the same issue if I replace Foo[] with std.container.Array!Foo.
Comment 2 RazvanN 2022-03-25 11:13:28 UTC
This has been fixed by https://github.com/dlang/dmd/pull/11945