【发布时间】:2021-12-31 11:47:42
【问题描述】:
我有这段c++代码,VS2019来编译它:
#include <iostream>
template<typename t>
class c
{
};
int main(){
using o = class c<int>;
}
有没有人知道为什么它不能编译,抱怨:
Error C2906 'c<int>': explicit specialization requires 'template <>'
使用 mingw-gcc 编译和运行没有错误。
您可以在此处比较编译器输出:https://godbolt.org/z/55fMzh8qz
提前致谢。
【问题讨论】:
-
微软正在严格控制饮食。 this 有帮助吗?
-
代码中没有
second<int>。class在那里绝对不需要。 -
谢谢@S.M.它实际上在没有
class关键字的情况下编译。
标签: c++ templates visual-studio-2019 using