[clang] [Clang] Address feedback in PR183010 (PR #185608)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 02:53:31 PDT 2026
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/185608
As discussed in #183010, the name MLTAL::isAnyArgInstantiationDependent became misleading after that patch. For type template arguments, it now checks whether the canonical types are dependent, whereas for expression template arguments, it checks the dependence of the expressions themselves.
We turn to using TA::isDependent now.
One concern is that dependent expressions, such as sizeof(T), may no longer be protected from evaluation. But I think they should have been marked as type dependent by this point since we do not have canonical expressions.
>From 9b231a1b8c53155a989102f6795de6b6909f4a55 Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7109 at gmail.com>
Date: Tue, 10 Mar 2026 17:30:02 +0800
Subject: [PATCH] [Clang] Address feedback in PR183010
As discussed there, MLTAL::isAnyArgInstantiationDependent became misleading
after that patch: for type template arguments, it is actually checking
whether the canonical types are dependent and for expression template arguments,
it's checking the dependence of the expressions.
We now rename it to MLTAL::isAnyArgDependent.
---
clang/include/clang/Sema/Template.h | 5 ++---
clang/lib/Sema/SemaConcept.cpp | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h
index 0be46e69f1b6f..2215c5d610c94 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -185,13 +185,12 @@ enum class TemplateSubstitutionKind : char {
return !(*this)(Depth, Index).isNull();
}
- bool isAnyArgInstantiationDependent(const ASTContext &C) const {
+ bool isAnyArgDependent(const ASTContext &C) const {
for (ArgumentListLevel ListLevel : TemplateArgumentLists)
for (const TemplateArgument &TA : ListLevel.Args)
// There might be null template arguments representing unused template
// parameter mappings in an MLTAL during concept checking.
- if (!TA.isNull() &&
- C.getCanonicalTemplateArgument(TA).isInstantiationDependent())
+ if (!TA.isNull() && C.getCanonicalTemplateArgument(TA).isDependent())
return true;
return false;
}
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 38791940247cb..a51c3545ac82b 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1154,7 +1154,7 @@ static bool CheckConstraintSatisfaction(
return false;
}
- if (TemplateArgsLists.isAnyArgInstantiationDependent(S.Context)) {
+ if (TemplateArgsLists.isAnyArgDependent(S.Context)) {
// No need to check satisfaction for dependent constraint expressions.
Satisfaction.IsSatisfied = true;
return false;
More information about the cfe-commits
mailing list