1 // RUN: %clang_cc1 -std=c++11 -verify %s
3 // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior
4 // for the wording that used to be there.
6 template<int> struct X
{};
8 // A[n inheriting] constructor [...] has the same access as the corresponding
9 // constructor [in the base class].
14 A(X
<1>) {} // expected-note 2{{declared protected here}}
16 A(X
<2>) {} // expected-note 2{{declared private here}}
26 B b1
{X
<1>{}}; // expected-error {{calling a protected constructor}}
27 B b2
{X
<2>{}}; // expected-error {{calling a private constructor}}
43 FA fa1
{X
<1>{}}; // expected-error {{calling a protected constructor}}
44 FA fa2
{X
<2>{}}; // expected-error {{calling a private constructor}}
47 // It is deleted if the corresponding constructor [...] is deleted.
49 G(int) = delete; // expected-note {{'G' has been explicitly marked deleted here}}
50 template<typename T
> G(T
*) = delete; // expected-note {{'G<const char>' has been explicitly marked deleted here}}
55 H
h1(5); // expected-error {{call to deleted constructor of 'H'}}
56 H
h2("foo"); // expected-error {{call to deleted constructor of 'H'}}
59 // Core defect: It is also deleted if multiple base constructors generate the
63 constexpr A(int, float = 0) {}
64 explicit A(int, int = 0) {} // expected-note {{candidate}}
66 A(int, int, int = 0) = delete; // expected-note {{deleted}}
69 using A::A
; // expected-note 2{{inherited here}}
72 constexpr B
b0(0, 0.0f
); // ok, constexpr
73 B
b1(0, 1); // expected-error {{call to constructor of 'B' is ambiguous}}