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