我在使用以下代码时遇到了一个奇怪的错误:
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);
}
错误发生在 foo(obj);
行,错误是:
Invalid arguments '
Candidates are:
void foo(foobar<#0,unsigned int16 0 #0>)
'
但是代码本身编译得很好。我不知道如何修复它。
Eclipse giving me Invalid arguments ' Candidates are: void * memset(void *, int, ?) ' though I know the args are good没有修复它,所以这个问题不是重复的。
最佳答案
这是 CDT 中的错误。 bug report已提交跟踪它,并且 patch修复它已发布。
更新:该错误现已fixed .修复将出现在 Eclipse Oxygen 中。
关于c++ - Eclipse CDT - 使用模板默认值时为 "Invalid arguments",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42586662/