c++ - Eclipse CDT - 使用模板默认值时为 "Invalid arguments"

标签 c++ eclipse eclipse-cdt

我在使用以下代码时遇到了一个奇怪的错误:

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/

相关文章:

c++ - 在 C/C++ 中使用 iconv 将字符串转换为 ISO-8859-1

c++ - Eclipse Oxygen C++ Hello World 跨 GCC 错误

java - 如何通过本地计算机远程连接 Apache 服务器 (http ://149. 4.223.238:8080)

c++ - 无法在 ubuntu 上运行 googletest(链接器错误)

Eclipse .cproject 文件不再使用制表符缩进,但现在使用空格

c++ - 如何使用 vector 执行数组计算?

c++ - 在不知道 map 的情况下获取 map 的键

c++ - 编译器对我的类型转换方法做了什么

eclipse - 安卓 : permissions missing name and tags

c++ - 如何设置eclipse c++生成多个可执行文件