1 // RUN: %clang_cc1 -std=c++11 %s -verify
7 template<typename X
, typename Y
> struct T
{
8 template<typename A
> T(X x
, A
&&a
) {}
10 template<typename A
> explicit T(A
&&a
)
11 noexcept(noexcept(T(X(), static_cast<A
&&>(a
))))
12 : T(X(), static_cast<A
&&>(a
)) {}
15 template<typename X
, typename Y
> struct U
: T
<X
, Y
> {
19 U
<S
, char> foo(char ch
) { return U
<S
, char>(ch
); }
28 namespace WrongIdent
{
36 namespace DefaultCtorConflict
{
37 struct A
{ A(int = 0); };
40 } b
; // ok, not ambiguous, inherited constructor suppresses implicit default constructor
46 namespace InvalidConstruction
{
48 struct B
{ B() = delete; };
49 struct C
: A
, B
{ using A::A
; };
50 // Initialization here is performed as if by a defaulted default constructor,
51 // which would be ill-formed (in the immediate context) in this case because
52 // it would be defined as deleted.
53 template<typename T
> void f(decltype(T(0))*);
54 template<typename T
> int &f(...);
58 namespace ExplicitConv
{
60 struct D
: B
{ // expected-note 3{{candidate}}
63 struct X
{ explicit operator B(); } x
;
64 struct Y
{ explicit operator D(); } y
;
66 D
dx(x
); // expected-error {{no matching constructor}}
70 namespace NestedListInit
{
71 struct B
{ B(); } b
; // expected-note 3{{candidate}}
72 struct D
: B
{ // expected-note 14{{not viable}}
75 // This is a bit weird. We're allowed one pair of braces for overload
76 // resolution, and one more pair of braces due to [over.ics.list]/2.
79 B b3
= {{{b
}}}; // expected-error {{no match}}
80 // Per a proposed defect resolution, we don't get to call
81 // D's version of B::B(const B&) here.
82 D d0
= b
; // expected-error {{no viable conversion}}
83 D d1
= {b
}; // expected-error {{no match}}
84 D d2
= {{b
}}; // expected-error {{no match}}
85 D d3
= {{{b
}}}; // expected-error {{no match}}
86 D d4
= {{{{b
}}}}; // expected-error {{no match}}
90 // PR31606: as part of a proposed defect resolution, do not consider
91 // inherited constructors that would be copy constructors for any class
92 // between the declaring class and the constructed class (inclusive).
97 bool operator==(A
const &) const; // expected-note {{no known conversion from 'B' to 'const A' for 1st argument}}
105 // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}.
106 bool b
= A
{} == B
{}; // expected-error {{invalid operands}}
109 namespace implicit_member_srcloc
{
138 struct A
{ constexpr A(int) {} };
139 struct B
: A
{ using A::A
; };
140 template<typename
> void f() {
143 template void f
<int>();
152 struct D
: B
{ using B::B
; };