1

Is the "class" keyword necessary for an explicit instantiation declaration?

template <class> class CL{};

template class CL<char>;  //OK
template CL<int>; //without "class"; OK for VC and clang, wrong for gcc
WhozCraig
  • 65,258
  • 11
  • 75
  • 141
Denis
  • 2,786
  • 1
  • 14
  • 29
  • 1
    It's not really "OK" in Clang, either. `template` on the last line is a dependent-name disambiguator, so the last line is the same as just `CL` -- it names the type, but doesn't constitute an explicit instantiation of the template. – Kerrek SB Apr 25 '16 at 08:35
  • @Kerrek SB Thanks, you are right. I didn't know that I can write only a type in a declaration and it will work :) – Denis Apr 25 '16 at 08:59

0 Answers0