[clang] [clang][Sema] fix crash on __type_pack_element with dependent packs (GH180307) (PR #180407)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 19:51:03 PST 2026


================
@@ -3406,10 +3406,16 @@ static QualType checkBuiltinTemplateIdType(
     Sema &SemaRef, ElaboratedTypeKeyword Keyword, BuiltinTemplateDecl *BTD,
     ArrayRef<TemplateArgument> Converted, SourceLocation TemplateLoc,
     TemplateArgumentListInfo &TemplateArgs) {
+  if (Converted.size() < BTD->getTemplateParameters()->size())
+    return QualType();
+
   ASTContext &Context = SemaRef.getASTContext();
 
   switch (BTD->getBuiltinTemplateKind()) {
   case BTK__make_integer_seq: {
+    assert(Converted.size() == 3);
+    if (Converted[2].isDependent())
+      return QualType();
----------------
ojhunt wrote:

I think this check can still remain where it currently is as there doesn't seem to be any code depending on this any earlier

https://github.com/llvm/llvm-project/pull/180407


More information about the cfe-commits mailing list