[Issue 13372] traits parent does not work on eponymous templates
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Nov 5 09:16:38 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=13372
b2.temp at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
Summary|traits parent shows |traits parent does not work
|template function as its |on eponymous templates
|own parent |
Severity|normal |major
--- Comment #2 from b2.temp at gmx.com ---
=========
import std.meta;
template Parent(T)
{
alias Parent = AliasSeq!(__traits(parent, T))[0];
}
unittest
{
class A(T){}
static assert(A!int.stringof != Parent!(A!int).stringof);
}
=========
yields: Error: static assert ("A!int" != "A!int") is false
the longer form
=========
import std.meta;
template Parent(T)
{
alias Parent = AliasSeq!(__traits(parent, T))[0];
}
unittest
{
template B(T){class B{}}
alias T = B!int;
static assert(is(T));
static assert(T.stringof != Parent!T.stringof);
}
=========
yields: Error: static assert ("B!int" != "B!int") is false
too.
--
More information about the Digitalmars-d-bugs
mailing list