Search code examples
c++eclipseeclipse-cdt

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.


Solution

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

    UPDATE: The bug has now been fixed. The fix will appear in Eclipse Oxygen.