1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 int a
; // expected-note 4{{member found by ambiguous name lookup}}
5 static int c
; // expected-note 2{{member found by ambiguous name lookup}}
12 void f(float); // expected-note 2{{member found by ambiguous name lookup}}
14 static void static_f(int);
15 static void static_f(double);
19 int d
; // expected-note 2{{member found by ambiguous name lookup}}
21 enum E2
{ enumerator2
};
23 enum E3
{ enumerator3
}; // expected-note 2{{member type 'B::E3' found by ambiguous name lookup}}
27 int c
; // expected-note 2{{member found by ambiguous name lookup}}
28 int d
; // expected-note 2{{member found by ambiguous name lookup}}
30 enum E3
{ enumerator3_2
}; // expected-note 2{{member type 'C::E3' found by ambiguous name lookup}}
37 void test_lookup(D d
) {
38 d
.a
; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}}
40 d
.c
; // expected-error{{member 'c' found in multiple base classes of different types}}
41 d
.d
; // expected-error{{member 'd' found in multiple base classes of different types}}
42 d
.f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'A':}}
43 d
.static_f(0); // okay
45 D::E e
= D::enumerator
; // okay
46 D::type t
= 0; // okay
48 D::E2 e2
= D::enumerator2
; // okay
50 D::E3 e3
; // expected-error{{multiple base classes}}
53 void D::test_lookup() {
54 a
; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}}
56 c
; // expected-error{{member 'c' found in multiple base classes of different types}}
57 d
; // expected-error{{member 'd' found in multiple base classes of different types}}
58 f(0); // expected-error{{non-static member 'f' found in multiple base-class subobjects of type 'A':}}
61 E e
= enumerator
; // okay
64 E2 e2
= enumerator2
; // okay
66 E3 e3
; // expected-error{{member 'E3' found in multiple base classes of different types}}
69 struct B2
: virtual A
{
70 int d
; // expected-note 2{{member found by ambiguous name lookup}}
72 enum E2
{ enumerator2
};
74 enum E3
{ enumerator3
}; // expected-note 2 {{member type 'B2::E3' found by ambiguous name lookup}}
77 struct C2
: virtual A
{
79 int d
; // expected-note 2{{member found by ambiguous name lookup}}
81 enum E3
{ enumerator3_2
}; // expected-note 2{{member type 'C2::E3' found by ambiguous name lookup}}
85 void test_virtual_lookup();
90 void test_virtual_lookup();
93 void test_virtual_lookup(D2 d2
, G g
) {
97 d2
.d
; // expected-error{{member 'd' found in multiple base classes of different types}}
99 d2
.static_f(0); // okay
101 D2::E e
= D2::enumerator
; // okay
102 D2::type t
= 0; // okay
104 D2::E2 e2
= D2::enumerator2
; // okay
106 D2::E3 e3
; // expected-error{{member 'E3' found in multiple base classes of different types}}
108 g
.a
; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}}
109 g
.static_f(0); // okay
112 void D2::test_virtual_lookup() {
116 d
; // expected-error{{member 'd' found in multiple base classes of different types}}
120 E e
= enumerator
; // okay
123 E2 e2
= enumerator2
; // okay
125 E3 e3
; // expected-error{{member 'E3' found in multiple base classes of different types}}
128 void G::test_virtual_lookup() {
129 a
; // expected-error{{non-static member 'a' found in multiple base-class subobjects of type 'A':}}
134 struct HasMemberType1
{
135 struct type
{ }; // expected-note{{member type 'HasMemberType1::type' found by ambiguous name lookup}}
138 struct HasMemberType2
{
139 struct type
{ }; // expected-note{{member type 'HasMemberType2::type' found by ambiguous name lookup}}
142 struct HasAnotherMemberType
: HasMemberType1
, HasMemberType2
{
146 struct UsesAmbigMemberType
: HasMemberType1
, HasMemberType2
{
147 type t
; // expected-error{{member 'type' found in multiple base classes of different types}}
155 static const int n
= 17;
158 const int X0::Inner::m
= n
;