xref: /llvm-project/clang/test/CXX/over/over.built/spaceship.cpp (revision 737f540abd578df094f04f690a9b5b52028374b4)
1 // RUN: %clang_cc1 -std=c++20 -verify %s -Wno-tautological-compare
2 
3 namespace std {
4   struct strong_ordering {
5     int n;
operator intstd::strong_ordering6     constexpr operator int() const { return n; }
7     static const strong_ordering less, equal, greater;
8   };
9   constexpr strong_ordering strong_ordering::less{-1},
10       strong_ordering::equal{0}, strong_ordering::greater{1};
11 }
12 
13 template <typename T>
f(int i,int * pi,T * pt,T t)14 void f(int i, int* pi, T* pt, T t) {
15   (void)(i <=> i);
16   (void)(i <=> pi); // expected-error {{comparison between pointer and integer}}
17   (void)(i <=> pt);
18   (void)(pi <=> pt);
19   (void)(pi <=> t);
20 }
21 
22