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
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/377c2dd08f00db679261689b93aad67a40bd7727 fix Issue 17429 - [scope] each scope class references adds another delete call - only call delete for classes allocated on the stack (or with custom allocator), not just for any scope class reference
Comment #2 by github-bugzilla — 2017-08-07T13:16:22Z
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/377c2dd08f00db679261689b93aad67a40bd7727 fix Issue 17429 - [scope] each scope class references adds another delete call