[clang] [clang][Sema] fix crash on __type_pack_element with dependent packs (GH180307) (PR #180407)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 02:59:26 PST 2026
================
@@ -3406,6 +3406,10 @@ static QualType checkBuiltinTemplateIdType(
Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD,
ArrayRef<TemplateArgument> Converted, SourceLocation TemplateLoc,
TemplateArgumentListInfo &TemplateArgs) {
+ if (llvm::any_of(Converted,
+ [](const TemplateArgument &A) { return A.isDependent(); }))
+ return QualType();
----------------
Serosh-commits wrote:
That's a great point. If the arity is already insufficient, the template is invalid regardless of dependency. I can update the top-level gatekeeper to also check Converted.size() against getMinRequiredArguments()
this would catch these cases early and ensure that the case-specific internal assertions are always safe. Does that sound good to you?
https://github.com/llvm/llvm-project/pull/180407
More information about the cfe-commits
mailing list