https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20397
--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Manuel López-Ibáñez from comment #18) > (In reply to Jonathan Wakely from comment #17) > > FWIW for the original testcase G++ now says: > > > > a.cc:9:8: error: ‘class A A::A’ is inaccessible within this context > > int c(A *a) { return 7; } > > ^ > > Probably we are treating 'A::A' as a type defined in A. This seems wrong. Not really, 'A' is the name of a type, and it is declared in A (as the injected class name). > Perhaps enforce_access could use basetype_path to explain why it is > inaccessible in the same way as Clang does. > > In my ideal world, it would say: > > error: ‘class A’ is inaccessible within this context > int c(A *a) { return 7; } > ^ > note: constrained by implicitly private inheritance here > class B : A { > ^ I don't like "constrained by implicitly private inheritance", the term "constrained" is used in other contexts in C++ but not related to access control. I think it would be better to say that name lookup found 'A' in the base class A, where it is inaccessible.