Testcase:

struct B1 { void f(); };
struct B2 { void f(double); };

struct I1 : B1 { };
struct I2 : B1 { };

struct D: I1, I2, B2 {
  void g() {
    f();
  }
};


gcc-4.6:

clang-8.C:9:5: error: reference to ‘f’ is ambiguous
clang-8.C:2:18: error: candidates are: void B2::f(double)
clang-8.C:1:18: error:                 void B1::f()
clang-8.C:1:18: error:                 void B1::f()

B1 is printed twice and there is no clear info about the hierarchy.

clang:

t.cc:10:5: error: non-static member 'f' found in multiple base-class subobjects
of type 'B1':
    struct D -> struct I1 -> struct B1
    struct D -> struct I2 -> struct B1
    f(); 
    ^
t.cc:1:18: note: member found by ambiguous name lookup
struct B1 { void f(); };
                 ^


-- 
           Summary: unhelpful candidates for ambiguous lookup
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44521

Reply via email to