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

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 19 02:42:40 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;
----------------
cor3ntin wrote:

can that be simplified to 

```cpp
if (Trap.hasErrorOccurred())
    return TemplateDeductionResult::SubstitutionFailure;
return Result;
```

?

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


More information about the llvm-branch-commits mailing list