【发布时间】:2017-12-13 07:17:57
【问题描述】:
此代码无法在 Visual Studio 2013 中编译
template <typename X>
constexpr //error C2144: syntax error : 'bool' should be preceded by ';'
bool Test(X x)
{
return true;
}
但是,如果我删除 constexpr 关键字,它会编译。
但是constexpr 应该没问题吧?因为它总是返回 true。
出了什么问题?
【问题讨论】:
-
Visual Studio 2013 不支持
constexpr。您需要升级到 VS2017。见Visual C++ Language Conformance。
标签: c++ templates visual-studio-2013 constexpr