[Issue 7529] IFTI does not support template argument dependent template alias instances as parameter types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 17 04:34:13 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7529



--- Comment #6 from timon.gehr at gmx.ch 2012-02-17 04:34:10 PST ---
(In reply to comment #5)
> The reason why this works with structs but not with templates is that a struct
> preserves the full type information while an alias template transforms a type.
> 
> void bar(Ty)(Ty) { pragma(msg, Ty); }
> 
> struct SList(T) {}
> template TList(T) { alias T TList; }
> 
> void main()
> {
>     bar(SList!int.init); // type SList!int => SList!int is preserved
>     bar(TList!int.init); // type int       => TList!int is lost
> }
> 
> Now if you take a function void foo(T)(TList!T) {} and gives you 'TList(T) =
> int'.
> What your asking for is an inverted template 'TList^-1(int) = T'.

Well, yes. But only for a simple set of cases where this is workable. Basically
the alias would need to be expanded before IFTI matching.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list