[Issue 10013] `inout` constructor sometimes fails to create immutable object

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 4 10:05:52 UTC 2022


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #2 from Mathias LANG <pro.mathias.lang at gmail.com> ---
It is infuriating that the following doesn't work:
```
struct Container
{
    ubyte[] value;

        this (inout(ubyte)[] arg) inout @safe pure nothrow @nogc
    {
        this.value = arg;   
    }
}

immutable ubyte[] Def = [42];
immutable Container Default = Container(Def);
```

--


More information about the Digitalmars-d-bugs mailing list