www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 600] New: error occurs when using template's tuple argument with typetuple having values

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=600

           Summary: error occurs when using template's tuple argument with
                    typetuple having values
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lovesyao hotmail.com


template Test(TL...) {
  static if(TL.length == 1)
    alias TL[0] Test;
  else
    alias Test!(TL[1..$]) Test;
}

static assert(is(Test!(int,long,char[],ubyte) == ubyte));//ok
static assert(Test!(1,2,3,4) == 4);//error: test.d(5): tuple TL is used as a
type
static assert(is(Test!(int,3,2,ubyte) == ubyte));//failed
static assert(Test!(1,long,char[],4) == 4);//error: test.d(2): Error: long is
not an expression
                                             //        test.d(2): Error: char[]
is not an expression


-- 
Nov 25 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=600


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



 static assert(is(Test!(int,3,2,ubyte) == ubyte));//failed
-- This one was fixed in DMD1.010 or earlier. By DMD1.020, the other two cases display a correct error message: test.d(21): alias test.Test!(4).Test cannot alias an expression 4 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 29 2009