Bug 600 – error occurs when using template's tuple argument with typetuple having values

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2006-11-25T22:32:00Z
Last change time
2015-06-09T05:14:42Z
Keywords
rejects-valid
Assigned to
nobody
Creator
lovesyao

Comments

Comment #0 by lovesyao — 2006-11-25T22:32:46Z
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
Comment #1 by clugdbug — 2009-10-29T01:26:59Z
> 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