Bug 24062 – DIP1000 Provide reason why destructor was not scope when calling member function

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-07-30T22:42:03Z
Last change time
2024-12-13T19:30:18Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Richard (Rikki) Andrew Cattermole
Moved to GitHub: dmd#18181 →

Comments

Comment #0 by alphaglosined — 2023-07-30T22:42:03Z
When the destructor is marked scope, but member fields of a struct are a struct and have a destructor that is not marked scope, provide the reasons why it isn't callable. ```d @safe: void accept(scope Wrapper wrapper) { } struct Wrapper { private Data data; @safe: this(return scope ref Wrapper other) scope { this.tupleof = other.tupleof; } ~this() scope { } } struct Data { void* x; @safe: this(return scope ref Data other) scope { this.tupleof = other.tupleof; } ~this() { } } ``` Output: ``` onlineapp.d(3): Error: scope variable `wrapper` assigned to non-scope parameter `this` calling `~this` onlineapp.d(18): which is assigned to non-scope parameter `this` ```
Comment #1 by robert.schadek — 2024-12-13T19:30:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18181 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB