[PATCH] D129951: adds `__disable_adl` attribute

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 14:58:14 PDT 2023


cjdb 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:
> > 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.
> nvm, they can be found by adl from within member functions.
Do we have a use-case for this? I'd rather start with global functions and add static member functions if a genuine need arises.


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