Bug 21290 – [REG2.073] Incorrect escape deprecation on scope lazy pointer parameter

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-10-04T16:05:25Z
Last change time
2024-12-13T19:11:55Z
Keywords
industry, rejects-valid
Assigned to
No Owner
Creator
johanengelen
Moved to GitHub: dmd#19798 →

Comments

Comment #0 by johanengelen — 2020-10-04T16:05:25Z
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.)
Comment #1 by moonlightsentinel — 2020-10-04T17:35:53Z
The actual regression happened in 2.073.2. Introduced by this PR: https://github.com/dlang/dmd/pull/6388
Comment #2 by johanengelen — 2020-10-20T12:24:16Z
Workaround: ``` void foo(scope lazy void* p); struct S { this(int a) { auto b = &this; // temporary variable as workaround. foo(b); } } ```
Comment #3 by robert.schadek — 2024-12-13T19:11:55Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19798 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB