[Issue 21762] object.destroy may silently fail depending on whether a member function is a template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 24 22:44:19 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21762
moonlightsentinel at disroot.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |moonlightsentinel at disroot.o
| |rg
Hardware|x86_64 |All
OS|Linux |All
Severity|normal |regression
--- Comment #1 from moonlightsentinel at disroot.org ---
Reduced example:
----------------------------------------------
import core.stdc.stdio : puts;
struct A(T)
{
T* address;
~this() {
destroy(*address);
}
}
void main() {
static struct B {
A!B next()();
~this() {
puts("B destroyed");
}
}
static struct C {
A!C next();
~this() {
puts("C destroyed");
}
}
B b;
destroy(b);
C c;
destroy(c);
}
----------------------------------------------
Introduced by https://github.com/dlang/druntime/pull/1312.
But it's probably a DMD issue because the PR introduced __traits(hasMember, S,
"__xdtor") which is true for B but false for C
--
More information about the Digitalmars-d-bugs
mailing list