[Bug c++/103177] New: incorrect error message for ambiguous lookup

jens.maurer at gmx dot net gcc-bugzilla@gcc.gnu.org
Wed Nov 10 19:15:58 GMT 2021


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

            Bug ID: 103177
           Summary: incorrect error message for ambiguous lookup
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jens.maurer at gmx dot net
  Target Milestone: ---

This is clearly a case of ambiguous lookup:

struct B {
   static int foo(int);
};

struct B2 {
   int foo();
};

struct D : private B, public B2 {
};

void f()
{
   D d;
   d.foo();
}

Yet, gcc complains about an inaccessible member. (Note that access is checked
at the end of overload resolution, but we should never get to that point.)

g++ -Wfatal-errors x.cc

x.cc: In function ‘void f()’:
x.cc:18:5: error: ‘static int B::foo(int)’ is inaccessible within this 
context
    18 |   d.foo();
       |     ^~~
compilation terminated due to -Wfatal-errors.


More information about the Gcc-bugs mailing list