[Issue 20333] New: cannot get frame pointer to <template function> when passing base class element
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Oct 29 04:10:15 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20333
Issue ID: 20333
Summary: cannot get frame pointer to <template function> when
passing base class element
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: puneet at coverify.org
Compiles with LDC 1.18 release, but segfaults.
Fails to compile with DMD github HEAD.
import std.stdio: writeln;
class Frop { }
class Foo {
Frop frop1;
}
class Bar: Foo {
Frop frop0;
void boo(alias V, string VS)() {
writeln("boo: ", __traits(getMember, this, VS).stringof);
writeln("boo: ", V.stringof);
assert(V is null); // not OK for frop1
assert(__traits(getMember, this, VS) is null); // not OK for frop1
}
void zoo(alias V)() {
writeln("zoo: ", V.stringof);
assert(V is null); // not OK for frop1
}
void goo(string VS)() {
writeln("goo: ", __traits(getMember, this, VS).stringof);
assert(__traits(getMember, this, VS) is null);
}
void setup() {
assert(frop0 is null);
moo!(frop0, "frop0")(this);
moo!(frop1, "frop1")(this);
boo!(frop0, "frop0")();
goo!("frop0");
goo!("frop1");
zoo!(frop0)();
zoo!(frop1)(); // segfault with LDC -- does not compile with DMD
boo!(frop0, "frop0")();
boo!(frop1, "frop1")(); // segfault with LDC -- does not compile with
DMD
}
}
void moo(alias V, string VS, L)(L l) {
import std.stdio;
writeln("moo: ", __traits(getMember, l, VS).stringof);
writeln("moo: ", V.stringof);
assert(V is null); // OK
assert(__traits(getMember, l, VS) is null); // OK
}
void main() {
Bar bar = new Bar();
bar.setup();
}
--
More information about the Digitalmars-d-bugs
mailing list