www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 531] New: Nested template not usable directly in alias

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: wbaxter 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);
}


-- 
Nov 16 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=531


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid




------- Comment #1 from smjg iname.com  2007-09-09 20:24 -------
Please post compiler messsages in full.


-- 
Sep 09 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=531


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #2 from bugzilla digitalmars.com  2008-06-28 01:54 -------
This works in dmd 1.031 and 2.015


-- 
Jun 27 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=531





------- Comment #3 from bugzilla digitalmars.com  2008-06-28 01:57 -------
This works in dmd 1.031 and 2.015


-- 
Jun 27 2008