www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23667] New: [REG2.101] Incorrect escape deprecation on scope

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

          Issue ID: 23667
           Summary: [REG2.101] Incorrect escape deprecation on scope lazy
                    pointer parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

Testcase:
```
struct S {
    this(ref int i) {
        DBG(&i);
    }
}

void DBG(lazy scope int* args) {}
```

Compilation with dlang2.101 gives the error:
<source>(3): Deprecation: escaping reference to outer local variable `i`

Removing `lazy` makes the code compile.

Note that this is very similar but distinct from
https://issues.dlang.org/show_bug.cgi?id=21290 , because that regression
already appeared from 2.073.

--
Feb 02 2023