www.digitalmars.com         C & C++   DMDScript  

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


          Issue ID: 21290
           Summary: [REG2.092] 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

Test code:
void foo(scope lazy void* p);

struct S {
    this(int a) {
        foo(&this); // line 5

When compiled with dlang >= 2.092, the following deprecation message is shown:
<source>(5): Deprecation: escaping reference to outer local variable `this`

The deprecation message is incorrect because of `scope` in the function
parameter signature.
The code compiles without deprecation message when `lazy` is removed.

(This is probably because DIP25 violations now show deprecation messages, i.e.
DIP25 implementation bugs now start to surface. Deprecation message bugs are as
bad as error bugs, because -de is used in settings where one does not want to
disable it.)

Oct 04 2020