[clang] 35e540d - [Clang] Let isAnyArgInstantiationDependent handle Null template arguments (#174698)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 9 00:34:03 PST 2026
Author: Younan Zhang
Date: 2026-01-09T16:33:59+08:00
New Revision: 35e540d7801ac8e229fac8ef418ee81414f2f249
URL: https://github.com/llvm/llvm-project/commit/35e540d7801ac8e229fac8ef418ee81414f2f249
DIFF: https://github.com/llvm/llvm-project/commit/35e540d7801ac8e229fac8ef418ee81414f2f249.diff
LOG: [Clang] Let isAnyArgInstantiationDependent handle Null template arguments (#174698)
Unused template parameters, though never referenced during substitution,
must remain in the MLTAL to preserve consistent template parameter
indices.
The null type placeholder plays this role, while
isAnyArgInstantiationDependent() doesn't properly handle this case when
checking nested constraints.
There is no release note because this is a regression from concept
parameter mapping.
Fixes https://github.com/llvm/llvm-project/issues/174667
Added:
Modified:
clang/include/clang/Sema/Template.h
clang/test/SemaTemplate/concepts.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h
index e963439b05c98..b0170c21feb1a 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -188,7 +188,9 @@ enum class TemplateSubstitutionKind : char {
bool isAnyArgInstantiationDependent() const {
for (ArgumentListLevel ListLevel : TemplateArgumentLists)
for (const TemplateArgument &TA : ListLevel.Args)
- if (TA.isInstantiationDependent())
+ // There might be null template arguments representing unused template
+ // parameter mappings in an MLTAL during concept checking.
+ if (!TA.isNull() && TA.isInstantiationDependent())
return true;
return false;
}
diff --git a/clang/test/SemaTemplate/concepts.cpp b/clang/test/SemaTemplate/concepts.cpp
index eed8b786f9954..d93391baf9926 100644
--- a/clang/test/SemaTemplate/concepts.cpp
+++ b/clang/test/SemaTemplate/concepts.cpp
@@ -1703,3 +1703,13 @@ struct : named_unit<"", thermodynamic_temperature, zeroth_kelvin> {
struct ice_point : relative_point_origin<point<kelvin>> {};
}
+
+namespace GH174667 {
+
+template<class T, class, class U>
+concept C = requires{ requires U(T(1)); };
+
+template<C<void, bool> T> int f();
+void main() { f<int>(); }
+
+}
More information about the cfe-commits
mailing list