[Issue 531] New: Nested template not usable directly in alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 16 11:09:38 PST 2006


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

           Summary: Nested template not usable directly in alias
           Product: D
           Version: 0.174
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


You can't use a nested template directly, though you can use it by declaring an
intermediate alias to an instantiation of the outer template.

But it should be possible to access it directly.

Example:
----------------------------------
import std.stdio : writefln;

template Tuple(T...) { alias T Tuple; }
template Join(TList1...) {
    template To(TList2...) {
        alias Tuple!(TList1,TList2) To;
    }
}
void main()
{
    // Error: "used as a type"
    alias Join!(1,2,3).To!(4,5,6) combo;

    // Splitting it in two is OK, though
    //    alias Join!(1,2,3) jtmp;
    //    alias jtmp.To!(4,5,6) combo;

    writefln(combo);
}


-- 




More information about the Digitalmars-d-bugs mailing list