Bug 17429 – [scope] each scope class references adds another delete call
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-05-25T04:57:00Z
Last change time
2017-08-07T13:16:22Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2017-05-25T04:57:29Z
cat > bug.d << CODE
class Klazz
{
__gshared size_t count;
~this()
{
++count;
}
}
void main()
{
auto s = new Klazz;
{
scope s2 = s; // calls delete even though it does not own s
}
assert(Klazz.count == 0);
}
CODE
dmd -run bug
Comment #1 by github-bugzilla — 2017-06-14T21:57:49Z