1// RUN: %clang_cc1 -std=c++11 -verify %s
2
3struct B1 { // expected-note 2{{candidate}}
4  B1(int); // expected-note {{candidate}}
5};
6
7struct B2 { // expected-note 2{{candidate}}
8  B2(int); // expected-note {{candidate}}
9};
10
11struct D1 : B1, B2 { // expected-note 2{{candidate}}
12  using B1::B1; // expected-note 3{{inherited here}}
13  using B2::B2; // expected-note 3{{inherited here}}
14};
15D1 d1(0); // expected-error {{ambiguous}}
16
17struct D2 : B1, B2 {
18  using B1::B1;
19  using B2::B2;
20  D2(int);
21};
22D2 d2(0); // ok
23
24
25// The emergent behavior of implicit special members is a bit odd when
26// inheriting from multiple base classes.
27namespace default_ctor {
28  struct C;
29  struct D;
30
31  struct A { // expected-note 4{{candidate}}
32    A(); // expected-note {{candidate}}
33
34    A(C &&); // expected-note {{candidate}}
35    C &operator=(C&&); // expected-note {{candidate}}
36
37    A(D &&); // expected-note {{candidate}}
38    D &operator=(D&&); // expected-note {{candidate}}
39  };
40
41  struct B { // expected-note 4{{candidate}}
42    B(); // expected-note {{candidate}}
43
44    B(C &&); // expected-note {{candidate}}
45    C &operator=(C&&); // expected-note {{candidate}}
46
47    B(D &&); // expected-note {{candidate}}
48    D &operator=(D&&); // expected-note {{candidate}}
49  };
50
51  struct C : A, B {
52    using A::A;
53    using A::operator=;
54    using B::B;
55    using B::operator=;
56  };
57  struct D : A, B {
58    using A::A; // expected-note 5{{inherited here}}
59    using A::operator=;
60    using B::B; // expected-note 5{{inherited here}}
61    using B::operator=;
62
63    D(int);
64    D(const D&); // expected-note {{candidate}}
65    D &operator=(const D&); // expected-note {{candidate}}
66  };
67
68  C c;
69  void f(C c) {
70    C c2(static_cast<C&&>(c));
71    c = static_cast<C&&>(c);
72  }
73
74  // D does not declare D(), D(D&&), nor operator=(D&&), so the base class
75  // versions are inherited.
76  D d; // expected-error {{ambiguous}}
77  void f(D d) {
78    D d2(static_cast<D&&>(d)); // expected-error {{ambiguous}}
79    d = static_cast<D&&>(d); // expected-error {{ambiguous}}
80  }
81}
82