[PATCH] D148924: [clang] Show error if defaulted comparions operator function is volatile or has ref-qualifier &&.

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 11:36:44 PDT 2023


shafik added inline comments.


================
Comment at: clang/test/CXX/class/class.compare/class.compare.default/p1.cpp:18
   bool operator<=(const A&) const = default;
-  bool operator==(const A&) const volatile && = default; // surprisingly, OK
+  bool operator==(const A&) const && = default; // expected-error {{ref-qualifier '&&' is not allowed on defaulted comparison operators}}
+  bool operator>=(const A&) const volatile = default; // expected-error {{defaulted comparison operator function must not be volatile}}
----------------
Can we also have examples with out of line defaulting. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148924/new/

https://reviews.llvm.org/D148924



More information about the cfe-commits mailing list