Eclipse CDT-“无效参数”使用模板默认值时 [英] Eclipse CDT - "Invalid arguments" when using template defaults

查看:70
本文介绍了Eclipse CDT-“无效参数”使用模板默认值时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下代码出现奇怪的错误:

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);
}

错误发生在 foo(obj)行; 是:

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.

推荐答案

这是CDT中的错误。已提交错误报告进行跟踪,并且补丁。

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

更新:该错误现已为已修复。该修复程序将出现在Eclipse Oxygen中。

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

这篇关于Eclipse CDT-“无效参数”使用模板默认值时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆