[Issue 22511] New: Nullable is not copyable when templated type has elaborate copy ctor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 14 14:17:48 UTC 2021


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

          Issue ID: 22511
           Summary: Nullable is not copyable when templated type has
                    elaborate copy ctor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: omerfirmak at gmail.com

import std;

struct S
{
        int b;

    this (int b)
    {
        this.b = b;
    }

    @disable this(this);
    this (scope ref inout S) inout
    {
        this.b = b;
    }
} 

void main()
{
        Nullable!S _s;
        _s = S(3);
}

-----------------

fails with 

/home/omer/dlang/ldc-1.28.0/bin/../import/std/typecons.d(3031): Error:
Generating an `inout` copy constructor for `struct
std.typecons.Nullable!(S).Nullable` failed, therefore instances of it are
uncopyable
newtest.d(22): Error: template instance
`std.typecons.Nullable!(S).Nullable.opAssign!()` error instantiating

--


More information about the Digitalmars-d-bugs mailing list