Files
TheRock/compiler/amd-llvm/clang/test/CXX/temp/temp.spec/temp.expl.spec/p2-20.cpp
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

275 lines
6.9 KiB
C++

// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
template<typename T>
int x;
template<typename T>
static int x<T*>;
template<>
static int x<int>; // expected-warning {{explicit specialization cannot have a storage class}}
template<typename T>
extern int y;
template<typename T>
static int y<T*>;
template<>
static int y<int>; // expected-warning {{explicit specialization cannot have a storage class}}
template<typename T>
void f();
template<>
static void f<int>(); // expected-warning {{explicit specialization cannot have a storage class}}
template<typename T>
extern void g();
template<>
static void g<int>(); // expected-warning {{explicit specialization cannot have a storage class}}
struct A {
static int x;
static int y;
static void f();
static void g();
};
int A::x = 0;
static int A::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
void A::f() { }
static void A::g() { } // expected-error {{'static' can only be specified inside the class definition}}
struct B {
template<typename T>
static int x;
template<typename T>
static int y;
template<typename T>
int z; // expected-error {{non-static data member 'z' cannot be declared as a template}}
template<typename T>
static int x<T*>;
template<typename T>
static int y<T*>;
template<typename T>
int x<T**>; // expected-error {{non-static data member 'x' cannot be declared as a template}}
template<>
int x<short>;
template<>
static int x<long>; // expected-warning {{explicit specialization cannot have a storage class}}
template<typename T>
static void f();
template<typename T>
static void g();
template<>
void f<short>();
template<>
static void f<long>(); // expected-warning {{explicit specialization cannot have a storage class}}
};
template<typename T>
int B::x = 0;
template<typename T>
static int B::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
template<typename T>
int B::x<T*> = 0;
template<typename T>
static int B::y<T*> = 0; // expected-error {{'static' can only be specified inside the class definition}}
template<typename T>
int B::x<T***>;
template<typename T>
static int B::y<T***>; // expected-error {{'static' can only be specified inside the class definition}}
template<>
int B::x<unsigned>;
template<>
static int B::y<unsigned>; // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<typename T>
void B::f() { }
template<typename T>
static void B::g() { } // expected-error {{'static' can only be specified inside the class definition}}
template<>
void B::f<unsigned>();
template<>
static void B::g<unsigned>(); // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<typename T>
struct C {
static int x;
static int y;
static void f();
static void g();
};
template<typename T>
int C<T>::x = 0;
template<typename T>
static int C<T>::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
template<typename T>
void C<T>::f() { }
template<typename T>
static void C<T>::g() { } // expected-warning {{'static' can only be specified inside the class definition}}
template<>
int C<int>::x = 0;
template<>
static int C<int>::y = 0; // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<>
void C<int>::f();
template<>
static void C<int>::g(); // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<typename T>
struct D {
template<typename U>
static int x;
template<typename U>
static int y;
template<typename U>
int z; // expected-error {{non-static data member 'z' cannot be declared as a template}}
template<typename U>
static int x<U*>;
template<typename U>
static int y<U*>;
template<typename U>
int x<U**>; // expected-error {{non-static data member 'x' cannot be declared as a template}}
template<>
int x<short>;
template<>
static int x<long>; // expected-warning {{explicit specialization cannot have a storage class}}
template<typename U>
static void f();
template<typename U>
static void g();
template<>
void f<short>();
template<>
static void f<long>(); // expected-warning {{explicit specialization cannot have a storage class}}
};
template<typename T>
template<typename U>
int D<T>::x = 0;
template<typename T>
template<typename U>
static int D<T>::y = 0; // expected-error {{'static' can only be specified inside the class definition}}
template<typename T>
template<typename U>
int D<T>::x<U*> = 0;
template<typename T>
template<typename U>
static int D<T>::y<U*> = 0; // expected-error {{'static' can only be specified inside the class definition}}
template<typename T>
template<typename U>
int D<T>::x<U***>;
template<typename T>
template<typename U>
static int D<T>::y<U***>; // expected-error {{'static' can only be specified inside the class definition}}
template<>
template<typename U>
int D<int>::x;
template<>
template<typename U>
static int D<int>::y; // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<>
template<typename U>
int D<int>::x<U****>;
template<>
template<typename U>
static int D<int>::y<U****>; // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<>
template<>
int D<int>::x<unsigned>;
template<>
template<>
static int D<int>::y<unsigned>; // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<typename T>
template<typename U>
void D<T>::f() { }
template<typename T>
template<typename U>
static void D<T>::g() { } // expected-warning {{'static' can only be specified inside the class definition}}
template<>
template<typename U>
void D<int>::f();
template<>
template<typename U>
static void D<int>::g(); // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}
template<>
template<>
void D<int>::f<unsigned>();
template<>
template<>
static void D<int>::g<unsigned>(); // expected-warning {{explicit specialization cannot have a storage class}}
// expected-error@-1 {{'static' can only be specified inside the class definition}}