【发布时间】:2011-11-07 02:12:21
【问题描述】:
此代码适用于 clang,但 g++ 说:
错误:“A::A()”受到保护
class A
{
protected:
A() {}
};
class B : public A
{
static A f() { return A(); } // GCC claims this is an error
};
哪个编译器是正确的?
【问题讨论】:
标签: c++ static constructor compiler-errors protected