[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 14 22:48:19 PDT 2018


EricWF updated this revision to Diff 142539.
EricWF marked 4 inline comments as done.
EricWF edited the summary of this revision.
EricWF added a comment.

- Implement P0946R0. In particular reject comparisons of arrays, and allow comparisons of integrals with unscoped enumeration types.

- Implement [built.over] for operator<=>, but with a twist. As currently specified the  [over.built] doesn't play nice with P0946R0. Specifically it makes the following code ambiguous.

For example:

  enum EnumA : int { A };
  auto x = (A <=> (long)0); // ambiguous.

See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround.


https://reviews.llvm.org/D45476

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/ComparisonCategories.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/AST/CMakeLists.txt
  lib/AST/ComparisonCategories.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGenCXX/Inputs/std-compare.h
  test/CodeGenCXX/cxx2a-compare.cpp
  test/PCH/Inputs/std-compare.h
  test/PCH/cxx2a-compare.cpp
  test/SemaCXX/Inputs/std-compare.h
  test/SemaCXX/compare-cxx2a.cpp
  test/SemaCXX/constant-expression-cxx2a.cpp
  test/SemaCXX/std-compare-cxx2a.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45476.142539.patch
Type: text/x-patch
Size: 163235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180415/2e89d561/attachment-0001.bin>


More information about the cfe-commits mailing list