[llvm-branch-commits] [clang] [clang] Finish implementation of P0522 (PR #96023)

Matheus Izvekov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 19 09:19:49 PDT 2024


================
@@ -3284,16 +3345,20 @@ DeduceTemplateArguments(Sema &S, T *Partial,
   if (Inst.isInvalid())
     return TemplateDeductionResult::InstantiationDepth;
 
-  if (Trap.hasErrorOccurred())
-    return TemplateDeductionResult::SubstitutionFailure;
-
   TemplateDeductionResult Result;
   S.runWithSufficientStackSpace(Info.getLocation(), [&] {
     Result = ::FinishTemplateArgumentDeduction(S, Partial,
                                                /*IsPartialOrdering=*/false,
                                                TemplateArgs, Deduced, Info);
   });
-  return Result;
+
+  if (Result != TemplateDeductionResult::Success)
+    return Result;
+
+  if (Trap.hasErrorOccurred())
+    return TemplateDeductionResult::SubstitutionFailure;
+
+  return TemplateDeductionResult::Success;
----------------
mizvekov wrote:

It would change the priority we give to these errors, and I think there is a better chance the previous error would have had more context and been more helpful.

https://github.com/llvm/llvm-project/pull/96023


More information about the llvm-branch-commits mailing list