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
127 lines
4.3 KiB
C++
127 lines
4.3 KiB
C++
// RUN: %clang_cc1 -std=c++17 -verify=expected,cxx17 %s -Wno-c++20-extensions
|
|
// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx20 %s
|
|
|
|
namespace pr41427 {
|
|
template <typename T> class A {
|
|
public:
|
|
A(void (*)(T)) {}
|
|
};
|
|
|
|
void D(int) {}
|
|
|
|
void f() {
|
|
A a(&D);
|
|
using T = decltype(a);
|
|
using T = A<int>;
|
|
}
|
|
}
|
|
|
|
namespace Access {
|
|
struct B {
|
|
protected:
|
|
struct type {};
|
|
};
|
|
template<typename T> struct D : B { // expected-note {{not viable}} \
|
|
expected-note {{implicit deduction guide declared as 'template <typename T> D(Access::D<T>) -> Access::D<T>'}}
|
|
D(T, typename T::type); // expected-note {{private member}} \
|
|
// expected-note {{implicit deduction guide declared as 'template <typename T> D(T, typename T::type) -> Access::D<T>'}}
|
|
};
|
|
D b = {B(), {}};
|
|
|
|
class X {
|
|
using type = int;
|
|
};
|
|
D x = {X(), {}}; // expected-error {{no viable constructor or deduction guide}}
|
|
|
|
// Once we implement proper support for dependent nested name specifiers in
|
|
// friends, this should still work.
|
|
class Y {
|
|
template <typename T> friend D<T>::D(T, typename T::type); // expected-warning {{dependent nested name specifier}}
|
|
struct type {};
|
|
};
|
|
D y = {Y(), {}};
|
|
|
|
class Z {
|
|
template <typename T> friend class D;
|
|
struct type {};
|
|
};
|
|
D z = {Z(), {}};
|
|
}
|
|
|
|
namespace GH69987 {
|
|
template<class> struct X {};
|
|
template<class = void> struct X;
|
|
X x;
|
|
|
|
template<class T, class B> struct Y { Y(T); };
|
|
template<class T, class B=void> struct Y ;
|
|
Y y(1);
|
|
}
|
|
|
|
namespace NoCrashOnGettingDefaultArgLoc {
|
|
template <typename>
|
|
class A {
|
|
A(int = 1); // expected-note {{candidate template ignored: couldn't infer template argumen}} \
|
|
// expected-note {{implicit deduction guide declared as 'template <typename> D(int = <null expr>) -> NoCrashOnGettingDefaultArgLoc::D<type-parameter-0-0>'}}
|
|
};
|
|
class C : A<int> {
|
|
using A::A;
|
|
};
|
|
template <typename>
|
|
class D : C { // expected-note {{candidate function template not viable: requires 1 argument}} \
|
|
expected-note {{implicit deduction guide declared as 'template <typename> D(NoCrashOnGettingDefaultArgLoc::D<type-parameter-0-0>) -> NoCrashOnGettingDefaultArgLoc::D<type-parameter-0-0>'}}
|
|
using C::C;
|
|
};
|
|
D abc; // expected-error {{no viable constructor or deduction guide}}
|
|
}
|
|
|
|
namespace AsValueParameter {
|
|
namespace foo {
|
|
// cxx17-note@+2 {{template is declared here}}
|
|
// cxx20-note@+1 {{'A<int>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}}
|
|
template <class> struct A {
|
|
A();
|
|
};
|
|
}
|
|
template <foo::A> struct B {}; // expected-note {{template parameter is declared here}}
|
|
// cxx17-error@-1 {{use of class template 'foo::A' requires template arguments; argument deduction not allowed in template parameter}}
|
|
|
|
template struct B<foo::A<int>{}>;
|
|
// cxx17-error@-1 {{value of type 'foo::A<int>' is not implicitly convertible to 'int'}}
|
|
// cxx20-error@-2 {{non-type template parameter has non-literal type 'foo::A<int>' (aka 'AsValueParameter::foo::A<int>')}}
|
|
} // namespace AsValueParameter
|
|
|
|
namespace ConvertDeducedTemplateArgument {
|
|
namespace A {
|
|
template <class> struct B {};
|
|
}
|
|
|
|
template <template <class> class TT1> struct C {
|
|
C(TT1<int>);
|
|
};
|
|
|
|
template <template <class> class TT2> using D = TT2<int>;
|
|
|
|
auto x = C(D<A::B>());
|
|
}
|
|
|
|
namespace pr165560 {
|
|
template <class T, class> struct S {
|
|
using A = T;
|
|
template <class> struct I { // expected-note{{candidate function template not viable: requires 1 argument, but 0 were provided}} \
|
|
// expected-note{{implicit deduction guide declared as 'template <class> I(pr165560::S<int, int>::I<type-parameter-0-0>) -> pr165560::S<int, int>::I<type-parameter-0-0>'}}
|
|
I(typename A::F) {} // expected-error{{type 'A' (aka 'int') cannot be used prior to '::' because it has no members}}
|
|
};
|
|
};
|
|
S<int, int>::I i; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'S<int, int>::I'}} \
|
|
// expected-note{{while building implicit deduction guide first needed here}}
|
|
}
|
|
|
|
namespace GH167513 {
|
|
template <class T, T> struct A {
|
|
A(T) {}
|
|
};
|
|
template <class T> using AA = A<T, T{}>;
|
|
AA b{0};
|
|
} // namespace GH167513
|