[Issue 13372] New: traits parent shows template function as its own parent
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 24 11:11:39 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13372
Issue ID: 13372
Summary: traits parent shows template function as its own
parent
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: ellery-newcomer at utulsa.edu
Passing an instantiated eponymous function template to __traits(parent,) yields
a symbol that points to the function passed in. In G in the following code, I'm
seeing this behavior:
f __traits(parent, f)
------ ----------------------
a tok
b!int.c __T1bTiZ
t!int t
code:
import std.typetuple;
int a(int i) {
return i;
}
template b(T) {
int c(T t) {
return 1;
}
}
int t(T)(T g) {
return 1;
}
template G(alias f) {
static assert(is(typeof(f) == function));
pragma(msg, __traits(identifier, f));
alias Parent = TypeTuple!(__traits(parent, f))[0];
pragma(msg, __traits(identifier, Parent));
static assert(!is(typeof(Parent) == typeof(f)), "I'm my own parent?");
}
void main(){
alias y = G!(a);
alias z = G!(t!int); // fails in here
}
--
More information about the Digitalmars-d-bugs
mailing list