Bug 20333 – cannot get frame pointer to <template function> when passing base class element

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-29T04:10:15Z
Last change time
2024-12-13T19:06:02Z
Assigned to
No Owner
Creator
Puneet Goel
Moved to GitHub: dmd#19635 →

Comments

Comment #0 by puneet — 2019-10-29T04:10:15Z
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(); }
Comment #1 by moonlightsentinel — 2019-10-29T11:03:57Z
Reduced with dustmite: class Frop {} class Foo { Frop frop1; } class Bar: Foo { void zoo(alias V)() { } void setup() { zoo!frop1; } }
Comment #2 by robert.schadek — 2024-12-13T19:06:02Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19635 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB