Bug 21799 – CTFE doesn't call base class destructor for extern(D) classes
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-05T14:16:11Z
Last change time
2021-04-09T10:49:01Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-04-05T14:16:11Z
CTFE only calls the first destructor and skips base class dtors.
Test case that fails during CTFE:
int testDeleteDScope()
{
char[] res;
{
scope cd = new ChildD();
cd.ptr = &res;
}
assert(res == "BA", cast(string) res);
return 0;
}
Comment #1 by dlang-bot — 2021-04-05T16:26:07Z
@MoonlightSentinel updated dlang/dmd pull request #12379 "Fix 21799 - CTFE doesn't call base class destructor for extern(D) classes" fixing this issue:
- Fix 21799 - CTFE doesn't call base class destructor for extern(D) classes
Iterate the inheritance chain for `extern(D)` classes to emulate the
manual chaining implemented in `rt_finalise`.
https://github.com/dlang/dmd/pull/12379
Comment #2 by dlang-bot — 2021-04-06T00:08:57Z
dlang/dmd pull request #12379 "Fix 21799 - CTFE doesn't call base class destructor for extern(D) classes" was merged into stable:
- 2be3ff0a69b5f274be2f0e57ed1b1de70f78920d by MoonlightSentinel:
Fix 21799 - CTFE doesn't call base class destructor for extern(D) classes
Iterate the inheritance chain for `extern(D)` classes to emulate the
manual chaining implemented in `rt_finalise`.
https://github.com/dlang/dmd/pull/12379
Comment #3 by dlang-bot — 2021-04-09T10:49:01Z
dlang/dmd pull request #12408 "Merge stable into master" was merged into master:
- dfa37aa33795ad33d9d69a2c3de02ddb4e586158 by MoonlightSentinel:
Fix 21799 - CTFE doesn't call base class destructor for extern(D) classes
Iterate the inheritance chain for `extern(D)` classes to emulate the
manual chaining implemented in `rt_finalise`.
https://github.com/dlang/dmd/pull/12408