[PATCH] D129951: adds `__disable_adl` attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 07:04:41 PST 2023


aaron.ballman 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)
----------------
cor3ntin wrote:
> 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.
Hmmm, I think they're *normally* qualified, but if you call the static function from within a member function, it doesn't have to be qualified.


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