diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index e7a5a6b6b8119..4cb1ab56a1e61 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -5788,13 +5788,14 @@ struct CXXNameMangler::TemplateArgManglingInfo { "no parameter for argument"); Param = ResolvedTemplate->getTemplateParameters()->getParam(ParamIdx); - // If we reach an expanded parameter pack whose argument isn't in pack - // form, that means Sema couldn't figure out which arguments belonged to - // it, because it contains a pack expansion. Track the expanded pack for - // all further template arguments until we hit that pack expansion. + // If we reach a parameter pack whose argument isn't in pack form, that + // means Sema couldn't or didn't figure out which arguments belonged to + // it, because it contains a pack expansion or because Sema bailed out of + // computing parameter / argument correspondence before this point. Track + // the pack as the corresponding parameter for all further template + // arguments until we hit a pack expansion, at which point we don't know + // the correspondence between parameters and arguments at all. if (Param->isParameterPack() && Arg.getKind() != TemplateArgument::Pack) { - assert(getExpandedPackSize(Param) && - "failed to form pack argument for parameter pack"); UnresolvedExpandedPack = Param; } } diff --git a/clang/test/CodeGenCXX/mangle-concept.cpp b/clang/test/CodeGenCXX/mangle-concept.cpp index dec26aeaeca46..391cf09ede855 100644 --- a/clang/test/CodeGenCXX/mangle-concept.cpp +++ b/clang/test/CodeGenCXX/mangle-concept.cpp @@ -220,3 +220,11 @@ namespace test7 { } template void f(); } + +namespace gh67244 { + template constexpr bool B = true; + template concept C = B; + template T> void f(T) {} + // CHECK: define {{.*}} @_ZN7gh672441fITkNS_1CIifEEiEEvT_( + template void f(int); +}