为什么以下代码会编译?我正在使用Visual Studio;我不确定它是否符合标准,或者是否有充分的理由允许这样做,或者它只是对语言的疏忽。
struct Base {
virtual void foo() = 0;
};
// since this class is final and abstract, it can never be
// instantiated - why isn't its very declaration an error?
struct Derived final : Base {};
int main() {
//Derived derived; // this IS an error, but relies on someone trying
// to instantiate the class, and the error is at the site
// of instantiation, not the class itself
}