github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp --
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/SemaTemplate/temp_arg_template_p0522.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 91f282e48..d22482a91 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -1834,12 +1834,13 @@ static TemplateDeductionResult
DeduceTemplateArgumentsByTypeMatch(
}
// In the context of partial ordering (where TDF_SkipNonDependent is set),
- // we may be matching a dependent parameter type (like `T` from
`template<typename T, T V>`)
- // against a non-dependent argument type (like `int` from `template<typename
U, int>`).
- // If we try to deduce `T` from `int`, we'll incorrectly deduce `T = int`,
which
- // conflicts with the deduction of `T = U` from the type parameter. By
skipping
- // deduction when either type is non-dependent, we prevent this spurious
conflict
- // and allow CheckTemplateArgumentList to perform the final validity check.
+ // we may be matching a dependent parameter type (like `T` from
+ // `template<typename T, T V>`) against a non-dependent argument type (like
+ // `int` from `template<typename U, int>`). If we try to deduce `T` from
+ // `int`, we'll incorrectly deduce `T = int`, which conflicts with the
+ // deduction of `T = U` from the type parameter. By skipping deduction when
+ // either type is non-dependent, we prevent this spurious conflict and allow
+ // CheckTemplateArgumentList to perform the final validity check.
if (TDF & TDF_SkipNonDependent) {
if (!P->isDependentType() || !A->isDependentType())
return TemplateDeductionResult::Success;
``````````
</details>
https://github.com/llvm/llvm-project/pull/207626
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits