Parser error with template class

Raimar Sandner lists at 404not-found.de
Sun Jul 22 18:18:08 BST 2012


Hi,

I am using kdevelop-4.3.1. Please consider the following example:

template<class A>
struct SomeTemplateClass
{
  static void f() {}
};

template<class A>
struct SomeOtherTemplateClass
{
  typedef SomeClass<A> SomeTemplateAlias;
  // version 1:
  using SomeTemplateAlias::f;
  // version 2:
  // using SomeTemplateClass<A>::f;
};


Hovering over the using statement version 1 will give two tooltip windows, one 
saying:
"Problem in Semantic Analyis: Declaration not found: SomeTemplateAlias::f". 
The other:
"SomeTemplateAlias::f f
Container: SomeOtherTemplateClass Access: public Kind: Variable" which is not 
correct (wrong Container and f is not a variable).

Version 2 will not show the "Declaration not found" but also show the wrong 
information.

In contrast, a typedef _outside_ the class scope with specific template 
parameter works correctly and shows f as a function in container 
SomeTemplateClass<int>:

typedef SomeTemplateClass<int> C;
using C::f;

Also, an example without templates works correctly:

struct SomeClass
{
  static void f() {}
};

struct SomeOtherClass
{
  typedef SomeClass SomeAlias;
  using SomeAlias::f;
};

Here SomeAlias::f will be correctly displayed as function in the container 
SomeClass.

Is this a bug or a known limitation of how the parsing of template classes 
works?

Best regards
Raimar




More information about the KDevelop mailing list