[PATCH] D155387: [Clang] Fix member lookup so that we don't ignore ambiguous lookups in some cases

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 16 13:16:32 PDT 2023


rsmith added inline comments.


================
Comment at: clang/include/clang/Sema/Lookup.h:228-229
     Other.Paths = nullptr;
-    Other.Diagnose = false;
+    Other.DiagnoseAccess = false;
+    Other.DiagnoseAmbiguous = false;
     return *this;
----------------
cor3ntin wrote:
> rsmith wrote:
> > cor3ntin wrote:
> > > Does anything break if you remove these two lines? they don't appear useful
> > I think these make sense: if we move a lookup result into this one, then the other lookup result shouldn't issue diagnostics any more. (Otherwise we could see the same diagnostics twice.)
> The reason I'm asking is that we don't seem consistent about resetting the state of the moved-from lookup, so i  don;t know if moved from lookup are ever reused. and if they are, should we use std::exchange or something along those lines?
I don't think moved-from `LookupResult`s are ever reused, and I don't think it's the intent for this function to leave a moved-from result in a state suitable for use in further lookups. (If you assign over a moved-from lookup result, that'd presumably work fine, though I doubt we ever do that.) The point here, I think, is just to leave the source of the move in a state where the destructor doesn't have side-effects any more.


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

https://reviews.llvm.org/D155387



More information about the cfe-commits mailing list