[cfe-dev] 'template class used without template parameters'-error in gcc but not in Clang

Jan Bierbaum s3306700 at inf.tu-dresden.de
Tue Oct 26 05:44:23 PDT 2010


Hi!


I'm not too familiar with the standard and templates, so I thought I'd
better ask here before filing a bug.

When inside a method I refer to some method of a parent template class
without explicit use of the template parameter, gcc reports an error
while Clang does not. Which one is right?

example:

> $ cat a.cpp 
> template <typename T>
> class A {
> public:
>   void a() {};
> };
> 
> 
> class B : public A<int> {
> public:
>   void b() {A::a();}
> };


Clang:
> $ clang -cc1 -fsyntax-only a.cpp


gcc:
> $ g++ -fsyntax-only a.cpp 
> a.cpp: In member function ‘void B::b()’:
> a.cpp:10: error: ‘template<class T> class A’ used without template parameters



Regards, Jan.




More information about the cfe-dev mailing list