https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125243

            Bug ID: 125243
           Summary: Cannot name a non-static member of inaccessible base
                    class in an unevaluated context, even if the member
                    name is accessible
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ensadc at mailnesia dot com
  Target Milestone: ---

struct A { int a; };
struct B : private A {};
struct C : B {
    using t1 = decltype(::A::a);
    using t2 = decltype(&::A::a);
};

====
<source>:4:30: error: 'A' is an inaccessible base of 'C'
    4 |     using t1 = decltype(::A::a);
      |                              ^
<source>:4:30: error: 'A' is an inaccessible base of 'C'
<source>:4:30: error: 'A' is an inaccessible base of 'C'

====
Since `::A::a` is in an unevaluated operand, I think it should not be
transformed to a class member access expression, and the fact that A is an
inaccessible base should be irrelevant.

There's no error for `t2`.

Clang and EDG accept both `t1` and `t2`.

Reply via email to