fullyQualifiedName fails on template

Timon Gehr timon.gehr at gmx.ch
Sat Jan 25 00:53:18 PST 2014


On 01/25/2014 02:06 AM, "Øivind" wrote:
> On Friday, 24 January 2014 at 09:40:32 UTC, Dicebot wrote:
>> On Friday, 24 January 2014 at 09:38:24 UTC, Timon Gehr wrote:
>>>> The following fails:
>>>
>>> Compiler bug.
>>
>> More like "Phobos bug that is very hard to fix because of compiler bug"
>
> Looking at the code, it does not seem like it pays any attention
> to template parameters at all? I would expect that for a template
> instantiation
>
> A!(B, C)
>
> it would resolve parents, etc. for A, B and C in turn..
>
> How would I do that if I were to give it a go? E.g. for a
> template instance A!(B, C), how do I use __traits or std.traits
> to get the plain type A, and B and C so I can use e.g.
> __traits(parent...) to figure out where they come from?
>
> That is really all I need. For me C can be defined inside a
> struct, so (A!(B, C)).stringof is not sufficient.. I would need a
> result like e.g A!(B, X.C)

alias Seq(T...)=T;

struct A(T...){}
struct B{}
struct C{}

alias T=A!(B,C);


static if(is(T==X!Y,alias X,Y...)){
     static assert(__traits(isSame, X, A));
     static assert(is(Y==Seq!(B,C)));
}



More information about the Digitalmars-d mailing list