-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] Deprecates rel_ops. (#91642)
These operators were deprecated in P0768R1 Library Support for the Spaceship (Comparison) Operator This was discovered while investigating the paper's implementation status.
- Loading branch information
Showing
5 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
libcxx/test/libcxx/depr/depr.rel_ops/rel_ops.depr_in_cxx20.verify.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <utility> | ||
|
||
// UNSUPPORTED: c++03, c++11, c++14, c++17 | ||
|
||
#include <utility> | ||
#include <cassert> | ||
|
||
struct A { | ||
int data_ = 0; | ||
}; | ||
|
||
inline bool operator==(const A& x, const A& y) { return x.data_ == y.data_; } | ||
|
||
inline bool operator<(const A& x, const A& y) { return x.data_ < y.data_; } | ||
|
||
void test() { | ||
using namespace std::rel_ops; | ||
A a1{1}; | ||
A a2{2}; | ||
(void)(a1 == a1); | ||
(void)(a1 != a2); // note not deprecated message, due to compiler generated operator. | ||
std::rel_ops::operator!=(a1, a2); // expected-warning {{is deprecated}} | ||
(void)(a1 < a2); | ||
(void)(a1 > a2); // expected-warning 2 {{is deprecated}} | ||
(void)(a1 <= a2); // expected-warning 2 {{is deprecated}} | ||
(void)(a1 >= a2); // expected-warning 2 {{is deprecated}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters