[clang] 33c2e4e - [Clang] Fix access to an unitinialized variable

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 03:34:46 PDT 2023


Author: Corentin Jabot
Date: 2023-07-21T12:34:35+02:00
New Revision: 33c2e4ec7c3efb7d77df0d9f5c3f1c423aac6b0f

URL: https://github.com/llvm/llvm-project/commit/33c2e4ec7c3efb7d77df0d9f5c3f1c423aac6b0f
DIFF: https://github.com/llvm/llvm-project/commit/33c2e4ec7c3efb7d77df0d9f5c3f1c423aac6b0f.diff

LOG: [Clang] Fix access to an unitinialized variable

This fixes the spurious test failure introduced in f9caa12328b2

Added: 
    

Modified: 
    clang/lib/Sema/SemaOverload.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 42a367dca531d5..a3d9abb1537789 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -11658,7 +11658,8 @@ static void NoteSurrogateCandidate(Sema &S, OverloadCandidate *Cand) {
   if (isRValueReference) FnType = S.Context.getRValueReferenceType(FnType);
   if (isLValueReference) FnType = S.Context.getLValueReferenceType(FnType);
 
-  if (Cand->FailureKind == ovl_fail_constraints_not_satisfied) {
+  if (!Cand->Viable &&
+      Cand->FailureKind == ovl_fail_constraints_not_satisfied) {
     S.Diag(Cand->Surrogate->getLocation(),
            diag::note_ovl_surrogate_constraints_not_satisfied)
         << Cand->Surrogate;


        


More information about the cfe-commits mailing list