Files
TheRock/compiler/amd-llvm/clang/test/CXX/expr/expr.prim/expr.prim.req/requires-expr.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

83 lines
2.3 KiB
C++

// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify
using A = int;
template<typename T, typename U>
constexpr bool is_same_v = false;
template<typename T>
constexpr bool is_same_v<T, T> = true;
template<typename T, typename U>
concept same_as = is_same_v<T, U>;
static_assert(requires { requires true; 0; typename A;
{ 0 } -> same_as<int>; });
static_assert(is_same_v<bool, decltype(requires { requires false; })>);
// Check that requires expr is an unevaluated context.
struct Y {
int i;
static constexpr bool r = requires { i; };
};
template<typename T> requires requires (T t) {
requires false; // expected-note{{because 'false' evaluated to false}}
requires false;
requires requires {
requires false;
};
}
struct r1 { };
using r1i = r1<int>;
// expected-error@-1 {{constraints not satisfied for class template 'r1' [with T = int]}}
template<typename T> requires requires (T t) {
requires requires {
requires false; // expected-note{{because 'false' evaluated to false}}
};
}
struct r2 { };
using r2i = r2<int>;
// expected-error@-1 {{constraints not satisfied for class template 'r2' [with T = int]}}
template<typename T> requires requires (T t) {
requires requires {
requires true;
};
requires true;
requires requires {
requires false; // expected-note{{because 'false' evaluated to false}}
};
}
struct r3 { };
using r3i = r3<int>;
// expected-error@-1 {{constraints not satisfied for class template 'r3' [with T = int]}}
template<typename T>
struct S { static const int s = T::value; };
template<typename T> requires requires { T::value; S<T>::s; }
// expected-note@-1 {{because 'T::value' would be invalid: type 'int' cannot be used prior to '::' because it has no members}}
struct r4 { };
using r4i = r4<int>;
// expected-error@-1 {{constraints not satisfied for class template 'r4' [with T = int]}}
namespace GH109538 {
static_assert(requires(void *t) { t; });
static_assert(requires(void) { 42; });
static_assert(requires(void t) { // expected-error {{argument may not have 'void' type}}
t;
});
static_assert(requires(void t, int a) { // expected-error {{'void' must be the first and only parameter if specified}}
t;
});
static_assert(requires(const void) { // expected-error {{'void' as parameter must not have type qualifiers}}
42;
});
} // namespace GH109538