BrainStone
BrainStone

Reputation: 3195

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.

Upvotes: 3

Views: 1400

Answers (1)

HighCommander4
HighCommander4

Reputation: 52799

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.

Upvotes: 2

Related Questions