[cfe-dev] FW: Clang 3.0 variadic template pack expansion error

Nathan Ridge zeratul976 at hotmail.com
Mon Jan 9 17:10:36 PST 2012




----------------------------------------
> From: zeratul976 at hotmail.com
> To: nickrmc83 at gmail.com
> Subject: RE: [cfe-dev] Clang 3.0 variadic template pack expansion error
> Date: Tue, 10 Jan 2012 01:10:16 +0000
>
>
> Hi Nick,
>
> > I have been looking at some basic variadic template uses and so decided
> > to give clang a go.
> >
> > I downloaded the latest binaries from
> > http://llvm.org/releases/download.html for Ubuntu 11.10 and have tried
> > compiling the below code without success. The error returned is Error:
> > too many template parameters in template redeclaration. I believe the
> > syntax is correct. Can somebody confirm whether the error is a compiler
> > bug or simply incorrect implementation.
>
> It is incorrect implementation :)
>
> There are two mistakes in your code:
>
> 1)
>
> template // Too many template parameters
> class Tuple : public Tuple
>
> should be
>
> template // Too many template parameters
>
> class Tuple : public Tuple
>
> since you want to declare a (partial) specialization of the primary template,
> not the primary template itself.
>
> 2)
>
> Tuple( FirstType ValueIn, RestTypes ...Others )
> :Tuple( Others... ), Value( ValueIn )
>
> should be
>
>
> Tuple( FirstType ValueIn, RestTypes ...Others )
>
> :Tuple( Others ), Value( ValueIn )
>
>
> note the "..." after "Others". A variadic parameter pack needs to be "expanded"
> by writing "..." after it every time you mention it.
>
> Regards,
> Nate
>
 		 	   		  



More information about the cfe-dev mailing list