Files
clang-p2996/libcxx/test/std/time/time.point/time.point.comparisons/compare.three_way.compile.fail.cpp
Hristo Hristov d94a770f7b [libc++][spaceship] Implement operator<=> for time_point
Depends on D145881

Implements parts of **P1614R2**: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html
Implements `operator<=>` for `time_point`

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D146250
2023-04-09 08:47:20 +03:00

35 lines
1.0 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// <chrono>
// time_point
// template<class Clock, class Duration1,
// three_way_comparable_with<Duration1> Duration2>
// constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs,
// const time_point<Clock, Duration2>& rhs);
// time_points with different clocks should not compare
#include <chrono>
#include "../../clock.h"
int main(int, char**) {
using namespace std::chrono_literals;
std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> t1{3ms};
std::chrono::time_point<Clock, std::chrono::milliseconds> t2{3ms};
t1 <=> t2;
return 0;
}