1 // RUN: %clang_cc1 -std=c++2a -include %s %s -ast-print -verify | FileCheck %s
3 // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t-cxx2a
4 // RUN: %clang_cc1 -std=c++2a -include-pch %t-cxx2a %s -ast-print -verify | FileCheck %s
6 // RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t-cxx2a
7 // RUN: %clang_cc1 -std=c++2a -include-pch %t-cxx2a %s -ast-print -verify | FileCheck %s
10 namespace inheriting_constructor
{
13 template<typename X
, typename Y
> struct T
{
15 explicit(((void)Y
{}, true)) T(A
&&a
) {}
18 template<typename X
, typename Y
> struct U
: T
<X
, Y
> {
22 U
<S
, char> foo(char ch
) {
23 return U
<S
, char>(ch
);
27 namespace inheriting_constructor
{
28 U
<S
, char> a
= foo('0');
31 //CHECK: explicit(((void)char{} , true))
42 explicit(false) operator bool();
43 explicit(true) operator B();
46 //expected-note@-6+ {{candidate constructor}}
47 //expected-note@-9+ {{candidate constructor}}
48 //expected-note-re@-7+ {{explicit constructor is not a candidate{{$}}}}
49 //expected-note@-7+ {{candidate function}}
50 //expected-note@-7+ {{explicit conversion function is not a candidate (explicit specifier evaluates to true)}}
52 //CHECK: explicit{{ +}}A(
53 //CHECK-NEXT: explicit(false){{ +}}operator
54 //CHECK-NEXT: explicit(true){{ +}}operator
55 A a
= 0; //expected-error {{no viable conversion}}
59 B b1
= a1
; //expected-error {{no viable conversion}}
70 static constexpr bool value
= b
;
75 explicit(b
) A(B
<b
>) {}
77 explicit(b
^ T::value
) operator T();
82 //expected-note@-8 {{candidate template ignored}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> A(A<b>) -> A<b>'}}
83 //expected-note@-8 {{explicit constructor declared here}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> explicit(b) A(B<b>) -> A<b>'}}
84 //expected-note@-15+ {{candidate constructor}}
85 //expected-note@-8+ {{explicit conversion function is not a candidate (explicit specifier}}
86 //expected-note@-11 {{explicit constructor is not a candidate (explicit specifier}}
88 //CHECK: explicit(b){{ +}}A
89 //CHECK: explicit(b{{ +}}^{{ +}}T::value){{ +}}operator
91 A a
= { b_true
}; //expected-error {{class template argument deduction}}
92 A a0
= b_true
; //expected-error {{no viable constructor or deduction guide}}
97 B
<true> b1
= a_false
; //expected-error {{no viable conversion}}
114 explicit(true) A(T
) -> A
<T
>;
116 explicit(false) A(int) -> A
<int>;
119 //expected-note@-5 {{explicit deduction guide}}
121 //CHECK: explicit(true){{ +}}A(
122 //CHECK: explicit(false){{ +}}A(
124 A a
= { 0.0 }; //expected-error {{explicit deduction guide}}