[Issue 21348] New: Nested function can't return inout without inout parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 29 04:26:02 UTC 2020


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

          Issue ID: 21348
           Summary: Nested function can't return inout without inout
                    parameter
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com

Example program:

---
struct S { int i; }

inout(S) fun(inout(int) i)
{
    auto nested() { return inout(S)(i); }
    return nested();
}
---

Compiler output from DMD 2.094.0:

---
$ dmd -c bug.d 
bug.d(5): Error: inout on return means inout must be on a parameter as well for
pure nothrow @nogc @safe inout(S)()
---

--


More information about the Digitalmars-d-bugs mailing list