D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 600 - error occurs when using template's tuple argument with typetuple having values
Summary: error occurs when using template's tuple argument with typetuple having values
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-11-25 22:32 UTC by Nazo Humei
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nazo Humei 2006-11-25 22:32:46 UTC
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 Don 2009-10-29 01:26:59 UTC
> 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