[PATCH] D129951: adds `__disable_adl` attribute

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 07:00:38 PST 2023


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:5756
+  if (FunctionDecl *F = D->getAsFunction();
+      F->isOverloadedOperator() || F->isCXXClassMember()) {
+    S.Diag(AL.getLoc(), diag::err_disable_adl_no_operators)
----------------
aaron.ballman wrote:
> cjdb wrote:
> > rsmith wrote:
> > > Maybe also global `operator new` / `operator delete`?
> > How does ADL even work in with the global namespace? Should it be invalid to apply here?
> Should this be `isCXXInstanceMember()` instead? Or do we intend to disallow this on static member functions?
Static member functions would be qualified, and not involve ADL. This seems correct.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:13972-13973
               // Mark member== const or provide matching != to disallow reversed
-              // args. Eg. 
-              // struct S { bool operator==(const S&); }; 
+              // args. Eg.
+              // struct S { bool operator==(const S&); };
               // S()==S();
----------------
White space only changes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129951



More information about the cfe-commits mailing list