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
133 lines
3.5 KiB
C++
133 lines
3.5 KiB
C++
// RUN: %clang_cc1 -fsyntax-only -pedantic-errors -verify %s
|
|
template<class T> struct A {
|
|
void f(T);
|
|
template<class X1> void g1(T, X1);
|
|
template<class X2> void g2(T, X2);
|
|
void h(T) { }
|
|
};
|
|
|
|
// specialization
|
|
template<> void A<int>::f(int);
|
|
|
|
// out of class member template definition
|
|
template<class T> template<class X1> void A<T>::g1(T, X1) { }
|
|
|
|
// member template specialization
|
|
template<> template<class X1> void A<int>::g1(int, X1);
|
|
|
|
// member template specialization
|
|
template<> template<>
|
|
void A<int>::g1(int, char); // X1 deduced as char
|
|
|
|
template<> template<>
|
|
void A<int>::g2<char>(int, char); // X2 specified as char
|
|
// member specialization even if defined in class definition
|
|
|
|
template<> void A<int>::h(int) { }
|
|
|
|
namespace PR10024 {
|
|
template <typename T>
|
|
struct Test{
|
|
template <typename U>
|
|
void get(U i) {}
|
|
};
|
|
|
|
template <typename T>
|
|
template <>
|
|
void Test<T>::get<double>(double i) {} // expected-error{{cannot specialize (with 'template<>') a member of an unspecialized template}}
|
|
}
|
|
|
|
namespace extraneous {
|
|
template<typename T> struct A;
|
|
|
|
template<typename T> int x;
|
|
|
|
template<typename T> void f();
|
|
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
struct A<int>;
|
|
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
int x<int>;
|
|
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
void f<int>();
|
|
|
|
template<typename T>
|
|
struct B {
|
|
struct C;
|
|
|
|
template<typename U>
|
|
struct D;
|
|
|
|
static int y;
|
|
|
|
template<typename U>
|
|
static int z;
|
|
|
|
void g();
|
|
|
|
template<typename U>
|
|
void h();
|
|
|
|
enum class E;
|
|
|
|
enum F : int;
|
|
};
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous 'template<>' in declaration of struct 'C'}}
|
|
struct B<int>::C;
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
struct B<int>::D<int>;
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<typename U>
|
|
struct B<int>::D;
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous 'template<>' in declaration of variable 'y'}}
|
|
int B<int>::y;
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
int B<int>::z<int>;
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<typename U>
|
|
int B<int>::z;
|
|
|
|
template<>
|
|
template<>
|
|
void B<int>::g(); // expected-error{{no function template matches function template specialization 'g'}}
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<>
|
|
void B<int>::h<int>();
|
|
|
|
template<>
|
|
template<> // expected-error{{extraneous template parameter list in template specialization}}
|
|
template<typename U>
|
|
void B<int>::h<int>(); // expected-error{{function template partial specialization is not allowed}}
|
|
|
|
// FIXME: We should diagnose this as having an extraneous 'template<>'
|
|
template<>
|
|
template<>
|
|
enum class B<int>::E; // expected-error{{enumeration cannot be a template}}
|
|
|
|
// FIXME: We should diagnose this as having an extraneous 'template<>'
|
|
template<>
|
|
template<>
|
|
enum B<int>::F : int; // expected-error{{enumeration cannot be a template}}
|
|
}
|