-
-
Notifications
You must be signed in to change notification settings - Fork 422
Fix issue 20049 - object.destroy doesn't propagate attributes #2674
Conversation
|
Thanks for your pull request and interest in making D better, @ShigekiKarita! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + druntime#2674" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears rt_finalize is indeed nothrow:
Line 1423 in 8a5e6f2
| extern (C) void rt_finalize(void* p, bool det = true) nothrow |
|
If this fixes the linked issue please change the commit title to "Fix issue 20049 - [rest of title]". Also please target stable. |
|
Also, please add a test case to help prevent a regression. |
|
Thanks. Just a moment. I'll fix that. |
|
You've pulled all of masters commits along with it. You need to rebase your commit on top of stable in addition to retargeting the branch in GitHub. |
|
@JinShil I added the regression test. Can you check if it is correctly placed (test/exceptions/src/nothrow_dtor.d)? |
|
@ShigekiKarita Can you just add a // Test to ensure proper behavior of `nothrow` destructors
unittest
{
class C
{
static int dtorCount = 0;
this() nothrow {}
~this() nothrow { dtorCount++; }
}
auto c = new C;
destroy(c);
assert(C.dtorCount == 1);
}Edit: unittest
{
class C
{
static int dtorCount = 0;
this() nothrow {}
~this() nothrow { dtorCount++; }
}
void test() nothrow
{
auto c = new C;
destroy(c);
assert(C.dtorCount == 1);
}
test();
} |
|
Thanks. I think |
src/object.d
Outdated
| @@ -882,6 +882,21 @@ nothrow @safe @nogc unittest | |||
| } | |||
| } | |||
|
|
|||
| // Test to ensure proper behavior of `nothrow` destructors | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reference the buzilla issue number, otherwise looks good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
A declaration of
rt_finalizein object.d have not match to its implementationdruntime/src/rt/lifetime.d
Line 1423 in 3ba98e6
Because of this mismatch, we could not destroy class objects in nothrow.
PS. This issue is found in mir-algorithm libmir/mir-algorithm#208