1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wzero-as-null-pointer-constant -std=c++20
6 // Mock how STD defined unspecified parameters for the operators below.
7 struct _CmpUnspecifiedParam
{
9 _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept
{}
12 struct strong_ordering
{
15 friend constexpr bool operator==(strong_ordering v
,
16 _CmpUnspecifiedParam
) noexcept
{
19 friend constexpr bool operator<(strong_ordering v
,
20 _CmpUnspecifiedParam
) noexcept
{
23 friend constexpr bool operator>(strong_ordering v
,
24 _CmpUnspecifiedParam
) noexcept
{
27 friend constexpr bool operator>=(strong_ordering v
,
28 _CmpUnspecifiedParam
) noexcept
{
31 static const strong_ordering equal
, greater
, less
;
33 constexpr strong_ordering
strong_ordering::equal
= {0};
34 constexpr strong_ordering
strong_ordering::greater
= {1};
35 constexpr strong_ordering
strong_ordering::less
= {-1};
40 constexpr auto operator<=>(const A
&other
) const = default;
43 void test_cxx_rewritten_binary_ops() {
48 int *ptr
= 0; // expected-warning{{zero as null pointer constant}}
49 result
= (a1
> (ptr
== 0 ? a1
: a2
)); // expected-warning{{zero as null pointer constant}}
50 result
= (a1
> ((a1
> (ptr
== 0 ? a1
: a2
)) ? a1
: a2
)); // expected-warning{{zero as null pointer constant}}