Eclipse CDT - “Invalid arguments” when using template defaults

六眼飞鱼酱① 提交于 2020-01-04 01:29:06

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/42586662/eclipse-cdt-invalid-arguments-when-using-template-defaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!