| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
struct B1 { |
| 4 |
void f(); |
| 5 |
static void f(int); |
| 6 |
int i; // expected-note 2{{member found by ambiguous name lookup}} |
| 7 |
}; |
| 8 |
struct B2 { |
| 9 |
void f(double); |
| 10 |
}; |
| 11 |
struct I1: B1 { }; |
| 12 |
struct I2: B1 { }; |
| 13 |
|
| 14 |
struct D: I1, I2, B2 { |
| 15 |
using B1::f; |
| 16 |
using B2::f; |
| 17 |
void g() { |
| 18 |
f(); // expected-error {{ambiguous conversion from derived class 'D' to base class 'B1'}} |
| 19 |
f(0); // ok |
| 20 |
f(0.0); // ok |
| 21 |
// FIXME next line should be well-formed |
| 22 |
int B1::* mpB1 = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}} |
| 23 |
int D::* mpD = &D::i; // expected-error {{non-static member 'i' found in multiple base-class subobjects of type 'B1'}} |
| 24 |
} |
| 25 |
}; |
| 26 |
|
| 27 |
namespace GH80435 { |
| 28 |
struct A { |
| 29 |
void *data; // expected-note {{member found by ambiguous name lookup}} |
| 30 |
}; |
| 31 |
|
| 32 |
class B { |
| 33 |
void *data; // expected-note {{member found by ambiguous name lookup}} |
| 34 |
}; |
| 35 |
|
| 36 |
struct C : A, B {}; |
| 37 |
|
| 38 |
decltype(C().data) x; // expected-error {{member 'data' found in multiple base classes of different types}} |
| 39 |
|
| 40 |
struct D { // expected-note {{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'C' to 'const D' for 1st argument}} |
| 41 |
// expected-note@-1{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'C' to 'D' for 1st argument}} |
| 42 |
template <typename Container, decltype(Container().data) = 0 > |
| 43 |
D(Container); // expected-note {{candidate template ignored: substitution failure [with Container = C]: member 'data' found in multiple base classes of different types}} |
| 44 |
}; |
| 45 |
|
| 46 |
D y(C{}); // expected-error {{no matching constructor for initialization of 'D'}} |
| 47 |
} |