This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Referring to a base class with template template parameters
- From: Deth <alexrepair at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 7 Nov 2009 15:45:45 -0800 (PST)
- Subject: Referring to a base class with template template parameters
I'm having issues referring to a base class under specific circumstances, and
am hoping that someone can provide a work-around.
I have a base class A with a template template parameter T:
template <template <typename> class T>
class A {
public:
A(int) {}
};
I then have a templated child class that derives from A using CRTP:
template <typename>
class B : public A {
public:
B(int i)
: A(i) {}
};
gcc reports the following error on the line with B's constructor initializer
list:
"error: expected a class template, got 'B< <template-parameter-1-1> >
I can accomplish this in Visual Studio, but I can't find the syntax to make
it work in gcc v4.2.1
It seems to be a specific issue with referring to A inside the definition of
B. Note that the following DOES compile
template <typename>
class Foo {
};
template <typename>
class B : public A<Foo> {
public:
B(int i)
: A<Foo>(i) {}
Is there some obscure syntax I can use to get around this?
Thanks for your help!
-Alex
--
View this message in context: http://old.nabble.com/Referring-to-a-base-class-with-template-template-parameters-tp26249699p26249699.html
Sent from the gcc - Help mailing list archive at Nabble.com.