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
69 lines
2.9 KiB
C++
69 lines
2.9 KiB
C++
// RUN: %clang_cc1 -std=c++2a -verify %s
|
|
|
|
template<typename T, typename U>
|
|
constexpr bool is_same_v = false;
|
|
|
|
template<typename T>
|
|
constexpr bool is_same_v<T, T> = true;
|
|
|
|
using T = void ();
|
|
|
|
void f1non_templ(int a) requires true; // expected-error{{non-templated function cannot have a requires clause}}
|
|
auto f2non_templ(int a) -> bool requires true; // expected-error{{non-templated function cannot have a requires clause}}
|
|
auto f3non_templ(int a) -> bool (*)(int b) requires true; // expected-error{{non-templated function cannot have a requires clause}}
|
|
// expected-error@+1{{non-templated function cannot have a requires clause}}
|
|
auto f4_non_templ(int a) requires true -> bool; // expected-error{{trailing return type must appear before trailing requires clause}}
|
|
void (f7non_templ()) requires true; // expected-error{{non-templated function cannot have a requires clause}}
|
|
// expected-error@+1{{non-templated function cannot have a requires clause}}
|
|
void (f8non_templ() requires true); // expected-error{{trailing requires clause should be placed outside parentheses}}
|
|
// expected-error@+1{{non-templated function cannot have a requires clause}}
|
|
T xnon_templ requires true;
|
|
// expected-error@+2 2{{non-templated function cannot have a requires clause}}
|
|
struct Snon_templ {
|
|
T m1 requires true, m2 requires true;
|
|
};
|
|
|
|
template <typename>
|
|
void f1(int a)
|
|
requires true; // OK
|
|
|
|
template <typename>
|
|
auto f2(int a) -> bool
|
|
requires true; // OK
|
|
|
|
template <typename>
|
|
auto f3(int a) -> bool (*)(int b) requires true; // OK
|
|
template <typename>
|
|
auto f4(int a) requires true -> bool; // expected-error{{trailing return type must appear before trailing requires clause}}
|
|
int f5(int a) requires; // expected-error{{expected expression}}
|
|
int f6(int a) requires {} // expected-error{{expected expression}}
|
|
template<typename>
|
|
void (f7()) requires true;
|
|
template<typename>
|
|
void (f8() requires true); // expected-error{{trailing requires clause should be placed outside parentheses}}
|
|
void (*(f9 requires (true)))(); // expected-error{{trailing requires clause should be placed outside parentheses}}
|
|
static_assert(is_same_v<decltype(f9), void (*)()>);
|
|
void (*pf)() requires true; // expected-error{{trailing requires clause can only be used when declaring a function}}
|
|
void g1(int (*dsdads)() requires false); // expected-error{{trailing requires clause can only be used when declaring a function}}
|
|
void g2(int (*(*dsdads)())() requires true); // expected-error{{trailing requires clause can only be used when declaring a function}}
|
|
void g3(int (*(*dsdads)(int) requires true)() ); // expected-error{{trailing requires clause should be placed outside parentheses}}
|
|
|
|
template<typename U>
|
|
struct Foo{
|
|
T x requires true;
|
|
};
|
|
Foo<int> f;
|
|
|
|
template<typename>
|
|
struct S {
|
|
T m1 requires true, m2 requires true;
|
|
};
|
|
|
|
template<typename T>
|
|
struct R {
|
|
R(T t);
|
|
};
|
|
|
|
template<typename T>
|
|
R(T) -> R<T> requires true;
|