www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23448] New: std.container.array does not work with move-only

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

          Issue ID: 23448
           Summary: std.container.array does not work with move-only types
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: gekamig511 hempyl.com

This does not compile :

import std;
import std.container.array;

struct NoCopy
{
     disable this(this);
}

void main()
{
    Array!NoCopy arr;
}

With the error :

/dlang/dmd/linux/bin64/../../src/phobos/std/container/array.d(816): Error:
struct `onlineapp.NoCopy` is not copyable because it has a disabled postblit
/dlang/dmd/linux/bin64/../../src/phobos/std/container/array.d(825): Error:
struct `onlineapp.NoCopy` is not copyable because it has a disabled postblit
/dlang/dmd/linux/bin64/../../src/phobos/std/container/array.d(262): Error:
struct `onlineapp.NoCopy` is not copyable because it has a disabled postblit
/dlang/dmd/linux/bin64/../../src/phobos/std/container/array.d(269): Error:
struct `onlineapp.NoCopy` is not copyable because it has a disabled postblit
/dlang/dmd/linux/bin64/../../src/phobos/std/container/array.d(628): Error:
template instance `std.container.array.RangeT!(Array!(NoCopy))` error
instantiating
onlineapp.d(11):        instantiated from here: `Array!(NoCopy)

--
Oct 31 2022