]> granicus.if.org Git - clang/commit
[c++20] Add rewriting from comparison operators to <=> / ==.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 19 Oct 2019 00:04:43 +0000 (00:04 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 19 Oct 2019 00:04:43 +0000 (00:04 +0000)
commit05441b0db7bf23d206dfc865b5c5bde17da1dab0
treeaca95f32bc08960a7da40f397bffc76b8e1a405a
parentea521aa6024431138f7890d486a6e3500822b3d5
[c++20] Add rewriting from comparison operators to <=> / ==.

This adds support for rewriting <, >, <=, and >= to a normal or reversed
call to operator<=>, for rewriting != to a normal or reversed call to
operator==, and for rewriting <=> and == to reversed forms of those same
operators.

Note that this is a breaking change for various C++17 code patterns,
including some in use in LLVM. The most common patterns (where an
operator== becomes ambiguous with a reversed form of itself) are still
accepted under this patch, as an extension (with a warning). I'm hopeful
that we can get the language rules fixed before C++20 ships, and the
extension warning is aimed primarily at providing data to inform that
decision.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375306 91177308-0d34-0410-b5e6-96231b3b80d8
21 files changed:
include/clang/AST/ExprCXX.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/OperatorKinds.h
include/clang/Sema/Overload.h
include/clang/Sema/Sema.h
lib/AST/ExprCXX.cpp
lib/Frontend/FrontendActions.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaOverload.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/TreeTransform.h
test/CXX/over/over.match/over.match.funcs/over.match.oper/p3-2a.cpp [new file with mode: 0644]
test/CXX/over/over.match/over.match.funcs/over.match.oper/p8-2a.cpp [new file with mode: 0644]
test/CXX/over/over.match/over.match.funcs/over.match.oper/p9-2a.cpp [new file with mode: 0644]
test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp
test/CodeGenCXX/mangle-cxx2a.cpp [new file with mode: 0644]
test/PCH/cxx2a-compare.cpp
test/SemaCXX/compare-cxx2a.cpp
test/SemaCXX/self-comparison.cpp
www/cxx_status.html