[Issue 17935] New: [scope] auto-generated destructor not scope aware
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 25 01:00:20 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17935
Issue ID: 17935
Summary: [scope] auto-generated destructor not scope aware
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: normal
Priority: P4
Component: dmd
Assignee: bugzilla at digitalmars.com
Reporter: code at dawg.eu
cat > bug.d << CODE
struct ByChunk(IO)
{
@safe:
~this() scope
{}
ubyte[] buf;
IO io;
}
struct IO
{
~this() @safe scope
{}
}
///
@safe @nogc unittest
{
ubyte[256] buf;
auto chunks = ByChunk!IO(buf[], IO());
chunks.__xdtor(); // auto-generated inclusive (fields and struct) dtor
}
CODE
dmd -c -dip1000 bug.d
----
bug.d(21): Error: scope variable `chunks` assigned to non-scope parameter
`this` calling bug.ByChunk!(IO).ByChunk.~this
bug.d(22): Error: scope variable `chunks` assigned to non-scope parameter
`this` calling bug.ByChunk!(IO).ByChunk.~this
----
Guess we should at best always attempt to infer scope for any generate method.
--
More information about the Digitalmars-d-bugs
mailing list