CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
132 lines
3.1 KiB
C++
132 lines
3.1 KiB
C++
// RUN: %clang_cc1 -std=c++2a -include %s %s -ast-print -verify | FileCheck %s
|
|
//
|
|
// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t-cxx2a
|
|
// RUN: %clang_cc1 -std=c++2a -include-pch %t-cxx2a %s -ast-print -verify | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t-cxx2a
|
|
// RUN: %clang_cc1 -std=c++2a -include-pch %t-cxx2a %s -ast-print -verify | FileCheck %s
|
|
|
|
#ifndef USE_PCH
|
|
namespace inheriting_constructor {
|
|
struct S {};
|
|
|
|
template<typename X, typename Y> struct T {
|
|
template<typename A>
|
|
explicit(((void)Y{}, true)) T(A &&a) {}
|
|
};
|
|
|
|
template<typename X, typename Y> struct U : T<X, Y> {
|
|
using T<X, Y>::T;
|
|
};
|
|
|
|
U<S, char> foo(char ch) {
|
|
return U<S, char>(ch);
|
|
}
|
|
}
|
|
#else
|
|
namespace inheriting_constructor {
|
|
U<S, char> a = foo('0');
|
|
}
|
|
|
|
//CHECK: explicit(((void)char{} , true))
|
|
|
|
#endif
|
|
|
|
namespace basic {
|
|
#ifndef USE_PCH
|
|
|
|
struct B {};
|
|
|
|
struct A {
|
|
explicit A(int);
|
|
explicit(false) operator bool();
|
|
explicit(true) operator B();
|
|
};
|
|
#else
|
|
//expected-note@-6+ {{candidate constructor}}
|
|
//expected-note@-9+ {{candidate constructor}}
|
|
//expected-note-re@-7+ {{explicit constructor is not a candidate{{$}}}}
|
|
//expected-note@-7+ {{candidate function}}
|
|
//expected-note@-7+ {{explicit conversion function is not a candidate (explicit specifier evaluates to true)}}
|
|
|
|
//CHECK: explicit{{ +}}A(
|
|
//CHECK-NEXT: explicit(false){{ +}}operator
|
|
//CHECK-NEXT: explicit(true){{ +}}operator
|
|
A a = 0; //expected-error {{no viable conversion}}
|
|
A a1(0);
|
|
|
|
bool b = a1;
|
|
B b1 = a1; //expected-error {{no viable conversion}}
|
|
|
|
#endif
|
|
}
|
|
|
|
|
|
namespace templ {
|
|
#ifndef USE_PCH
|
|
|
|
template<bool b>
|
|
struct B {
|
|
static constexpr bool value = b;
|
|
};
|
|
|
|
template<bool b>
|
|
struct A {
|
|
explicit(b) A(B<b>) {}
|
|
template<typename T>
|
|
explicit(b ^ T::value) operator T();
|
|
};
|
|
B<true> b_true;
|
|
B<false> b_false;
|
|
#else
|
|
//expected-note@-8 {{candidate template ignored}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> A(templ::A<b>) -> templ::A<b>'}}
|
|
//expected-note@-8 {{explicit constructor declared here}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> explicit(b) A(B<b>) -> templ::A<b>'}}
|
|
//expected-note@-15+ {{candidate constructor}}
|
|
//expected-note@-8+ {{explicit conversion function is not a candidate (explicit specifier}}
|
|
//expected-note@-11 {{explicit constructor is not a candidate (explicit specifier}}
|
|
|
|
//CHECK: explicit(b){{ +}}A
|
|
//CHECK: explicit(b{{ +}}^{{ +}}T::value){{ +}}operator
|
|
|
|
A a = { b_true }; //expected-error {{class template argument deduction}}
|
|
A a0 = b_true; //expected-error {{no viable constructor or deduction guide}}
|
|
A a_true(b_true);
|
|
A a_false = b_false;
|
|
|
|
B<true> b = a_true;
|
|
B<true> b1 = a_false; //expected-error {{no viable conversion}}
|
|
B<false> b2(a_true);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
namespace guide {
|
|
|
|
#ifndef USE_PCH
|
|
|
|
template<typename T>
|
|
struct A {
|
|
A(T);
|
|
};
|
|
|
|
template<typename T>
|
|
explicit(true) A(T) -> A<T>;
|
|
|
|
explicit(false) A(int) -> A<int>;
|
|
|
|
#else
|
|
//expected-note@-5 {{explicit deduction guide}}
|
|
|
|
//CHECK: explicit(true){{ +}}A(
|
|
//CHECK: explicit(false){{ +}}A(
|
|
|
|
A a = { 0.0 }; //expected-error {{explicit deduction guide}}
|
|
A a1 = { 0 };
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#define USE_PCH
|