[cfe-dev] Clang 3.0 variadic template pack expansion error
Nick Smith
nickrmc83 at gmail.com
Mon Jan 9 13:36:25 PST 2012
Hi,
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.
#include <iostream>
template<typename ...ArgTypes>
class Tuple;
template<>
class Tuple<>
{
};
template<typename FirstType, typename ...RestTypes> // Too many template
parameters
class Tuple : public Tuple<RestTypes...>
{
private:
FirstType Value;
public:
Tuple( FirstType ValueIn, RestTypes ...Others )
:Tuple<RestTypes...>( Others ), Value( ValueIn )
{
}
FirstType GetValue() const
{
return Value;
}
};
int main( int argc, char **argv )
{
Tuple<std::string> TestTuple( std::string( "Hello Tuple World!" ) );
std::cout << TestTuple.GetValue() << std::endl;
return 0;
}
clang -I /opt/clang/libcxx/include -I /media/Source/Generic -L
/opt/clang/libcxx/lib hello_world.cpp -o hello_world -Wall -v -m64
-std=c++0x -stdlib=libc++ -ferror-limit=1
clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Thanks
Nick
More information about the cfe-dev
mailing list