[Issue 24062] New: Provide reason why destructor was not scope when calling member function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 30 22:42:03 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24062
Issue ID: 24062
Summary: Provide reason why destructor was not scope when
calling member function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: alphaglosined at gmail.com
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`
```
--
More information about the Digitalmars-d-bugs
mailing list