Home | History | Annotate | Download | only in class.member.lookup
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 class V {
      4 public:
      5   int f();
      6   int x;
      7 };
      8 
      9 class W {
     10 public:
     11   int g(); // expected-note{{member found by ambiguous name lookup}}
     12   int y; // expected-note{{member found by ambiguous name lookup}}
     13 };
     14 
     15 class B : public virtual V, public W
     16 {
     17 public:
     18   int f();
     19   int x;
     20   int g();  // expected-note{{member found by ambiguous name lookup}}
     21   int y; // expected-note{{member found by ambiguous name lookup}}
     22 };
     23 
     24 class C : public virtual V, public W { };
     25 
     26 class D : public B, public C { void glorp(); };
     27 
     28 void D::glorp() {
     29   x++;
     30   f();
     31   y++; // expected-error{{member 'y' found in multiple base classes of different types}}
     32   g(); // expected-error{{error: member 'g' found in multiple base classes of different types}}
     33 }
     34 
     35 // PR6462
     36 struct BaseIO { BaseIO* rdbuf() { return 0; } };
     37 struct Pcommon : virtual BaseIO { int rdbuf() { return 0; } };
     38 struct P : virtual BaseIO, Pcommon {};
     39 
     40 void f() { P p; p.rdbuf(); }
     41