BrainStone BrainStone - 9 months ago 58
C++ Question

Eclipse CDT - "Invalid arguments" when using template defaults

I am getting a weird error with the following code:

template<class T, size_t Size = sizeof(T)>
class foobar {
};

template<class T>
void foo(foobar<T> param1) {
// Do something
}

void bar() {
foobar<int> obj;

foo(obj);
}


The error occurs at the line
foo(obj);
and is:

Invalid arguments '
Candidates are:
void foo(foobar<#0,unsigned int16 0 #0>)
'


The code itself compiles fine however. I have no idea how to fix it.

Eclipse giving me Invalid arguments ' Candidates are: void * memset(void *, int, ?) ' though I know the args are good did not fix it, so this question is not a duplicate.

Answer Source

This is a bug in CDT. A bug report has been filed to track it, and a patch that fixes it has been posted.