#include <iostream>
template<typename T>
struct base {
void hello() {
}
};
template<typename T>
struct ttt : public base<ttt<T>> {
public:
ttt() {
hello();
}
};
int main() {
ttt<int> t();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我使用 c++ 17 或 11 时,这段代码就可以了。但是当我将 c++ 标准设置为 20 时,发生的 C3816 错误说找不到 hello 函数,我对原因感到困惑,为什么这个错误直到 c++ 20 才会出现。