34 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -verify %s2 3namespace std_example {4 struct A { A(int); };5 struct B : A { using A::A; };6 7 struct C1 : B { using B::B; };8 struct C2 : B { using B::B; };9 10 struct D1 : C1, C2 {11 using C1::C1; // expected-note {{inherited from base class 'C1' here}}12 using C2::C2; // expected-note {{inherited from base class 'C2' here}}13 };14 15 struct V1 : virtual B { using B::B; };16 struct V2 : virtual B { using B::B; };17 18 struct D2 : V1, V2 {19 using V1::V1;20 using V2::V2;21 };22 23 D1 d1(0); // expected-error {{constructor of 'A' inherited from multiple base class subobjects}}24 D2 d2(0); // OK: initializes virtual B base class, which initializes the A base class25 // then initializes the V1 and V2 base classes as if by a defaulted default constructor26 27 struct M { M(); M(int); };28 struct N : M { using M::M; };29 struct O : M {};30 struct P : N, O { using N::N; using O::O; };31 P p(0); // OK: use M(0) to initialize N's base class,32 // use M() to initialize O's base class33}34