www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22667] New: Nullable of struct containing unrelated Nullable

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

          Issue ID: 22667
           Summary: Nullable of struct containing unrelated Nullable
                    errors with "inout can only be declared inside inout
                    function"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

import std.typecons;

struct Struct
{
    Nullable!int ni;
}

void main()
{
    Struct a = Struct.init;
    Nullable!Struct b = Nullable!Struct(a);
}

test.d(6): Error: variable `test.main.__copytmp756` `inout` variables can only
be declared inside `inout` functions

--
Jan 12 2022