我正在使用与Xcode 9.3捆绑在一起的clang,我试图了解以下结果是否是C++ 17更改的有意部分:
#include <iostream>
template<typename T> struct Test {
static const int TEN;
};
template<typename T> constexpr int Test<T>::TEN = 10;
int main(int argc, const char * argv[]) {
std::cout << Test<int>::TEN << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用c ++ 11或c ++ 14编译时,会打印"10".但是,用c ++ 17编译它会打印"0".
这是怎么回事?