Arrays and non-copyable elements

Steven Schveighoffer schveiguy at gmail.com
Mon Jun 8 00:31:10 UTC 2020


On 6/7/20 7:25 PM, Jack Applegame wrote:
> I think it should compile.
> 
> ```
> struct NonCopyable {
>      int a;
>      this(this) @disable;
> }
> 
> void main() {
>      NonCopyable[] arr = [NonCopyable(1), NonCopyable(2)]; // ok
>      arr ~= NonCopyable(3); // fails
> }
> ```

This is a bug, please file. What is likely happening is that the 
template is not moving the data to the underlying C call.

-Steve


More information about the Digitalmars-d-learn mailing list