Referring to a base class with template template parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux