Consider the following test 1 code
struct A { private: class face; friend class face; }; struct A::face {}; template <typename _CharT> struct C : public A::face {}; int main() { C<int> x; }
Is this code well-formed? I tested it under g ++ and comeau. g ++ compiles this well, while comeau gives the following error message (which I think is correct)
"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
Which compiler is right in this case? Como is one of the most standard compilers I know of. Is g ++ wrong?
(1) This is not a real life code.
source share