[clang] [clang][Sema] fix crash on __type_pack_element with dependent packs (GH180307) (PR #180407)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 28 05:11:42 PST 2026
================
@@ -3406,25 +3406,39 @@ static QualType checkBuiltinTemplateIdType(
Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD,
ArrayRef<TemplateArgument> Converted, SourceLocation TemplateLoc,
TemplateArgumentListInfo &TemplateArgs) {
+ TemplateParameterList *Params = BTD->getTemplateParameters();
+ unsigned RequiredArgs = Params->size();
+ if (Params->hasParameterPack()) {
+ if (Converted.size() < RequiredArgs)
+ return QualType();
+ } else {
+ if (Converted.size() != RequiredArgs)
+ return QualType();
+ }
----------------
Serosh-commits wrote:
> I see the new change. If there are no more pack expansions into fixed lists because we diagnosed this earlier, then under what circumstances are the sizes still different here? Can you point to a test case?
i see u are right abt that i think the extra check is not needed there is no case where sizes can be diff i will remove it but i think we need to add assert backfor it i guess
should we ?
https://github.com/llvm/llvm-project/pull/180407
More information about the cfe-commits
mailing list