MSVC的可变参数函数模板专业化的问题?

时间:2012-12-11 03:13:22

标签: c++ visual-studio c++11 variadic-templates

使用Visual Studio 2012年11月的CTP,它支持可变参数模板(以及其他内容)。以下代码:

template<int, typename... Args>
void myfunc(Args... args)
{
}

template<>
void myfunc<1, float>(float)
{
}

产生以下错误:

error C2785: 'void myfunc(Args...)' and 'void myfunc(float)' have different return types
error C2912: explicit specialization 'void myfunc(float)' is not a specialization of a function template

(是的,第一个非常有趣)

所以我的问题是:

1)我在这里写合法C ++ 11吗?

2)如果是,有没有办法在提交之前查明这是否是MSVC中的已知错误?

1 个答案:

答案 0 :(得分:2)

  1. 这是完全合法的代码; gcc-4.7.2和clang 3.0都接受它。

  2. 尝试搜索Microsoft Connect

相关问题