2

I'm having some trouble figuring out if this is a problem with my compiler:

class A
{
public:
    A(int i) {}
};

template <typename T>
class B : public A
{
public:
    B(int i) : A(i) {}
    T test() {return T(10);}
};

class C : public B<C>
{
public:
    C(int i) : B(i) {}
};

int main()
{
    C c(5);
}

error: argument list for class template "B" is missing

This code seems to compile correctly in Visual Studio 2012, but it isn't working on icpc 9.1 (which I have to use for this project).

Jarod42
  • 203,559
  • 14
  • 181
  • 302
rlbond
  • 65,341
  • 56
  • 178
  • 228

1 Answers1

0

The code is correct.

A possible workaround for icpc is to fully specify the base class:

C(int i) : B<C>(i) {}
Jarod42
  • 203,559
  • 14
  • 181
  • 302