Bug 18839 – Crash on getMember of function masking imported template function
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-05-07T12:18:21Z
Last change time
2023-05-05T08:10:56Z
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2018-05-07T12:18:21Z
bar.d:
void fun(T)();
foo.d:
module foo;
import bar : fun;
void fun() { }
// either of those lines crashes
pragma(msg, __traits(getMember, foo, "fun").stringof);
static assert(__traits(compiles, __traits(getMember, foo, "fun")));
Comment #1 by default_357-line — 2018-05-07T12:21:01Z
Further reduction:
void fun2(T)();
alias fun = fun2;
void fun() { }
pragma(msg, __traits(getMember, foo, "fun").stringof);
static assert(__traits(compiles, __traits(getMember, foo, "fun")));
Note that the order of functions - first alias, then mask - is important.
Comment #2 by default_357-line — 2018-05-07T12:24:18Z
Correction- in that case, only the pragma(msg) crashes.
Comment #3 by default_357-line — 2018-05-07T12:27:16Z
Double correction- I had a local patch I'd forgotten about. Both still crash. Reduction is valid. (Sorry.)
Comment #4 by razvan.nitu1305 — 2023-05-05T08:10:56Z
I cannot reproduce this with latest master. I get a successful compilation that prints "fun()".