Problem with a complex-ish template

Nicolas Alvarez nicolas.alvarez at
Sun Dec 6 03:14:01 UTC 2009

I'm writing some tests using the "mockpp" framework for mock objects.
Its code emulates variadic templates using template specialization in 
several places.

At one point, it uses a helper class to count the number of arguments. For 
example, CountParameters<void, int, int>::value == 2 (not 3; the first 
argument is not used so you have a way of having 0 arguments). KDevelop 
doesn't handle  this template correctly. As a result, if I have this 
partially-specialized template:

template<unsigned params>
struct Switch
struct Switch<2>
  void foo(int x, int y) { cout << "two args\n"; }

If I create a Switch<2> object, kdevelop completes its method (foo) 
correctly. But if it's a Switch<CountParameters<void,int,int>::value>, the 
completion doesn't work.

A fully-compiling testcase is here:

The foo() call in line 55 shows underlined in yellow. Typing "obj." inside 
main doesn't complete anything.


I read mailing lists through Gmane. Please don't Cc me on replies; it makes 
me get one message on my newsreader and another on email.

More information about the KDevelop-devel mailing list