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
70 lines
3.1 KiB
C++
70 lines
3.1 KiB
C++
// RUN: %clang_cc1 -std=c++2a -verify %s -Wzero-as-null-pointer-constant
|
|
|
|
// Keep this test before any declarations of operator<=>.
|
|
namespace PR44786 {
|
|
template<typename T> void f(decltype(T{} <=> T{})) {} // expected-note {{previous}}
|
|
|
|
struct S {};
|
|
int operator<=>(S const &, S const &);
|
|
template<typename T> void f(decltype(T{} <=> T{})) {} // expected-error {{redefinition}}
|
|
}
|
|
|
|
struct A {};
|
|
constexpr int operator<=>(A a, A b) { return 42; }
|
|
static_assert(operator<=>(A(), A()) == 42);
|
|
|
|
int operator<=>(); // expected-error {{overloaded 'operator<=>' must have at least one parameter of class or enumeration type}}
|
|
int operator<=>(A); // expected-error {{overloaded 'operator<=>' must be a binary operator}}
|
|
int operator<=>(int, int); // expected-error {{overloaded 'operator<=>' must have at least one parameter of class or enumeration type}}
|
|
int operator<=>(A, A, A); // expected-error {{overloaded 'operator<=>' must be a binary operator}}
|
|
int operator<=>(A, A, ...); // expected-error {{overloaded 'operator<=>' cannot be variadic}}
|
|
int operator<=>(int, A = {}); // expected-error {{parameter of overloaded 'operator<=>' cannot have a default argument}}
|
|
|
|
struct B {
|
|
int &operator<=>(int);
|
|
friend int operator<=>(A, B);
|
|
|
|
friend int operator<=>(int, int); // expected-error {{overloaded 'operator<=>' must have at least one parameter of class or enumeration type}}
|
|
void operator<=>(); // expected-error {{overloaded 'operator<=>' must be a binary operator}};
|
|
void operator<=>(A, ...); // expected-error {{overloaded 'operator<=>' cannot be variadic}}
|
|
void operator<=>(A, A); // expected-error {{overloaded 'operator<=>' must be a binary operator}};
|
|
};
|
|
|
|
int &r = B().operator<=>(0);
|
|
|
|
namespace PR47893 {
|
|
struct A {
|
|
void operator<=>(const A&) const;
|
|
};
|
|
template<typename T> auto f(T a, T b) -> decltype(a < b) = delete;
|
|
int &f(...);
|
|
int &r = f(A(), A());
|
|
}
|
|
|
|
namespace PR44325 {
|
|
struct cmp_cat {};
|
|
bool operator<(cmp_cat, void*);
|
|
bool operator>(cmp_cat, int cmp_cat::*);
|
|
|
|
struct X {};
|
|
cmp_cat operator<=>(X, X);
|
|
|
|
bool b1 = X() < X(); // no warning
|
|
bool b2 = X() > X(); // no warning
|
|
|
|
// FIXME: It's not clear whether warning here is useful, but we can't really
|
|
// tell that this is a comparison category in general. This is probably OK,
|
|
// as comparisons against zero are only really intended for use in the
|
|
// implicit rewrite rules, not for explicit use by programs.
|
|
bool c = cmp_cat() < 0; // expected-warning {{zero as null pointer constant}}
|
|
}
|
|
|
|
namespace GH137452 {
|
|
struct comparable_t {
|
|
__attribute__((vector_size(32))) double numbers; // expected-note {{declared here}}
|
|
auto operator<=>(const comparable_t& rhs) const = default; // expected-warning {{explicitly defaulted three-way comparison operator is implicitly deleted}} \
|
|
expected-note {{replace 'default' with 'delete'}} \
|
|
expected-note {{defaulted 'operator<=>' is implicitly deleted because defaulted comparison of vector types is not supported}}
|
|
};
|
|
} // namespace GH137452
|