#include <iostream>
using namespace std;
void fun(int i)
{
cout<<"Called with int "<<i;
}
void main()
{
using df = decltype(&fun);
}我在Visual中得到以下语法错误,
Error 1 error C2143: syntax error : missing ';' before '=' c:\users\kpranit\documents\visual studio 2012\projects\sample\sample\sample.cpp 12
Error 2 error C2873: 'df' : symbol cannot be used in a using-declaration c:\users\kpranit\documents\visual studio 2012\projects\sample\sample\sample.cpp 12发布于 2015-01-07 02:24:17
Visual 2012,基于您的项目目录,是您正在使用的目录,不支持类型混叠。
这是一个C++11特性,在MSDN文档中没有出现,即使是在VS2013中也是如此,尽管我认为这可能只是他们的文档错误-- 微软C++11兼容性站点 (查找“别名模板”)将其列为在VS2013下可用。
因此,如果您想使用该特性,您可能需要升级到后面的编译器。
https://stackoverflow.com/questions/27810446
复制相似问题