[clang] Reapply "[Clang] Improve diagnostics for expansion length mismatch" (PR #121044)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 13 01:59:03 PDT 2025
================
@@ -749,132 +759,124 @@ ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
PackExpansionExpr(Context.DependentTy, Pattern, EllipsisLoc, NumExpansions);
}
+static bool IsUnexpandedPackExpansion(const TemplateArgument &TA) {
+ if (!TA.isPackExpansion())
+ return false;
+
+ if (TA.getKind() == TemplateArgument::Type)
+ return !TA.getAsType()->getAs<PackExpansionType>()->getNumExpansions();
+
+ if (TA.getKind() == TemplateArgument::Expression)
+ return !cast<PackExpansionExpr>(TA.getAsExpr())->getNumExpansions();
+
+ return !TA.getNumTemplateExpansions();
+}
----------------
cor3ntin wrote:
Can you leave a comment here? This is a bit confusing.
Actually, I think having it as a lambda, like in the current code, might be clearer.
It's not just that they are unexpended, they are also unresolvable at that point.
https://github.com/llvm/llvm-project/pull/121044
More information about the cfe-commits
mailing list