https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20397
--- Comment #18 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(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.
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 {
^
fixit: you may use '::A' to access 'class A'
int c(A *a) { return 7; }
^
::A
note: 'class A' declared here
class A {
^