[Issue 23497] New: Erroneous escape reference to parameter error.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 20 02:08:58 UTC 2022


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

          Issue ID: 23497
           Summary: Erroneous escape reference to parameter error.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: deadalnix at gmail.com

Sample code:

class CompileError {}

CompileError errorize(Type t) {
        return t.error;
}

struct Type {
        CompileError _error;

        void kind() {}

        @property
        auto error() in {
                kind();
        } do {
                return _error;
        }
}


Compiling this sample code fails with the following error: "Error: returning
`t.error()` escapes a reference to parameter `t`".

This used to compile in 2.100, but fails in 2.101 and as far as I can tell,
this is erroneous.

--


More information about the Digitalmars-d-bugs mailing list