【发布时间】:2020-07-01 10:56:11
【问题描述】:
使用 clang++ 编译失败,谁能解释为什么? (这可以用 g++ 编译)
struct X
{
template <typename T> X() {}
};
template X::X<int>();
int main() { return 1; }
instantiate.cc:7:13: error: qualified reference to 'X' is a constructor name rather than a type in this context
template X::X<int>();
^
instantiate.cc:7:14: error: expected unqualified-id
template X::X<int>();
^
2 errors generated.
【问题讨论】: