[clang] 840d4d9 - [clang] NFCI: don't check deduced constraints when partial ordering (#106882)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 1 01:11:12 PDT 2024
Author: Matheus Izvekov
Date: 2024-09-01T05:11:09-03:00
New Revision: 840d4d9446ef0a49b7600b42a188148a1826e17c
URL: https://github.com/llvm/llvm-project/commit/840d4d9446ef0a49b7600b42a188148a1826e17c
DIFF: https://github.com/llvm/llvm-project/commit/840d4d9446ef0a49b7600b42a188148a1826e17c.diff
LOG: [clang] NFCI: don't check deduced constraints when partial ordering (#106882)
Added:
Modified:
clang/lib/Sema/SemaTemplateDeduction.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 11bc9f2d1e7484..01f18e5a325197 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3313,10 +3313,12 @@ FinishTemplateArgumentDeduction(
if (Trap.hasErrorOccurred())
return TemplateDeductionResult::SubstitutionFailure;
- if (auto Result = CheckDeducedArgumentConstraints(S, Partial, SugaredBuilder,
- CanonicalBuilder, Info);
- Result != TemplateDeductionResult::Success)
- return Result;
+ if (!IsPartialOrdering) {
+ if (auto Result = CheckDeducedArgumentConstraints(
+ S, Partial, SugaredBuilder, CanonicalBuilder, Info);
+ Result != TemplateDeductionResult::Success)
+ return Result;
+ }
return TemplateDeductionResult::Success;
}
@@ -3364,13 +3366,16 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction(
if (Trap.hasErrorOccurred())
return TemplateDeductionResult::SubstitutionFailure;
- if (auto Result = CheckDeducedArgumentConstraints(S, Template, SugaredBuilder,
- CanonicalBuilder, Info);
- Result != TemplateDeductionResult::Success)
- return Result;
+ if (!PartialOrdering) {
+ if (auto Result = CheckDeducedArgumentConstraints(
+ S, Template, SugaredBuilder, CanonicalBuilder, Info);
+ Result != TemplateDeductionResult::Success)
+ return Result;
+ }
return TemplateDeductionResult::Success;
}
+
/// Complete template argument deduction for DeduceTemplateArgumentsFromType.
/// FIXME: this is mostly duplicated with the above two versions. Deduplicate
/// the three implementations.
@@ -5595,19 +5600,8 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction(
TDR != TemplateDeductionResult::Success)
return TDR;
- // C++20 [temp.deduct]p5 - Only check constraints when all parameters have
- // been deduced.
- if (!IsIncomplete) {
- if (auto Result = CheckDeducedArgumentConstraints(S, FTD, SugaredBuilder,
- CanonicalBuilder, Info);
- Result != TemplateDeductionResult::Success)
- return Result;
- }
-
- if (Trap.hasErrorOccurred())
- return TemplateDeductionResult::SubstitutionFailure;
-
- return TemplateDeductionResult::Success;
+ return Trap.hasErrorOccurred() ? TemplateDeductionResult::SubstitutionFailure
+ : TemplateDeductionResult::Success;
}
/// Determine whether the function template \p FT1 is at least as
More information about the cfe-commits
mailing list