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

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 16 14:54:52 PDT 2023


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:14930
   LookupQualifiedName(R, Record->getDecl());
-  R.suppressDiagnostics();
+  R.suppressAccessDiagnostics();
 
----------------
rsmith wrote:
> shafik wrote:
> > I was a bit conservative where I changed this but maybe we should do this everywhere.
> Most of the other calls in this file all look wrong. `DiagnoseTwoPhaseLookup` and `BuildRecoveryCallExpr` are doing error recovery and I think it's appropriate for them to suppress all diagnostics, but the rest are doing standard-mandated searches, and so should diagnose lookup ambiguity.
So it looks like `BuildOverloadedArrowExpr` catches the ambiguous lookup when calling `CandidateSet.BestViableFunction(...)` while `BuildCallToObjectOfClassType(...)` does not. So if I change the `suppressDiagnostics()` call in `BuildOverloadedArrowExpr` we get double diagnostic. I am not seeing why we have the inconsistency here.  


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

https://reviews.llvm.org/D155387



More information about the cfe-commits mailing list