Pra*_*rav 5 c++ private comeau
考虑以下测试1代码
struct A {
private:
class face;
friend class face;
};
struct A::face {};
template <typename _CharT>
struct C : public A::face
{};
int main()
{
C<int> x;
}
Run Code Online (Sandbox Code Playgroud)
这段代码是否形成良好?我在g ++和comeau下测试了它.g ++编译好了,而comeau给出了以下错误信息(我认为是正确的)
"ComeauTest.c", line 12: error: class "A::face" (declared at line 9) is inaccessible
struct C : public A::face
^
detected during instantiation of class "C<_CharT> [with _CharT=int]"
at line 17
Run Code Online (Sandbox Code Playgroud)
在这种情况下哪个编译器是正确的?Comeau是我所知道的最标准的符合标准的编译器之一.g ++又错了吗?
(1)这不是现实生活中的代码.