llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Matheus Izvekov (mizvekov) <details> <summary>Changes</summary> This fixes a regression introduced in #<!-- -->133610 which was reported here #<!-- -->133610 (comment) and in #<!-- -->136119 This redoes previous attempt in #<!-- -->135111 When mangling a DTST which appears in the prefix, the template name is not actually relevant, as its prefix is part of the nested name anyway, and a substitution is not allowed at that position in any case. Fixes #<!-- -->136119 --- Full diff: https://github.com/llvm/llvm-project/pull/136201.diff 2 Files Affected: - (modified) clang/lib/AST/ItaniumMangle.cpp (+2-11) - (modified) clang/test/CodeGenCXX/mangle-template.cpp (+17) ``````````diff diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index d0ab60700cb15..977caa8e55db3 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -1405,16 +1405,6 @@ void CXXNameMangler::mangleUnresolvedPrefix(NestedNameSpecifier *qualifier, // - a template template parameter with arguments // In all of these cases, we should have no prefix. if (NestedNameSpecifier *Prefix = qualifier->getPrefix()) { - if (const auto *DTST = - dyn_cast<DependentTemplateSpecializationType>(type)) { - Out << "srN"; - TemplateName Template = getASTContext().getDependentTemplateName( - {Prefix, DTST->getDependentTemplateName().getName(), - /*HasTemplateKeyword=*/true}); - mangleTemplatePrefix(Template); - mangleTemplateArgs(Template, DTST->template_arguments()); - break; - } mangleUnresolvedPrefix(Prefix, /*recursive=*/true); } else { @@ -2618,7 +2608,8 @@ bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(QualType Ty, cast<DependentTemplateSpecializationType>(Ty); TemplateName Template = getASTContext().getDependentTemplateName( DTST->getDependentTemplateName()); - mangleTemplatePrefix(Template); + const DependentTemplateStorage &S = DTST->getDependentTemplateName(); + mangleSourceName(S.getName().getIdentifier()); mangleTemplateArgs(Template, DTST->template_arguments()); break; } diff --git a/clang/test/CodeGenCXX/mangle-template.cpp b/clang/test/CodeGenCXX/mangle-template.cpp index 365aba5989baa..867f00f379ead 100644 --- a/clang/test/CodeGenCXX/mangle-template.cpp +++ b/clang/test/CodeGenCXX/mangle-template.cpp @@ -416,3 +416,20 @@ namespace unresolved_template_specialization_type { template enable_if<true> raw_hash_set<int>::AbslHashValue<HashStateBase>(); // CHECH: @_ZN39unresolved_template_specialization_type12raw_hash_setIiE13AbslHashValueINS_13HashStateBaseEEENS_9enable_ifIXsrNT_11is_hashableIiEE5valueEEEv } // namespace unresolved_template_specialization_type + +namespace GH133610 { + template <class T> struct A { + template <class V> struct B { int MEM; }; + }; + + struct D {}; + struct C: public A<int>::B<D> {}; + + template <class T, class U, class V> + auto k(T t, U u, V v) -> decltype (t.U::template B<V>::MEM) { return {}; } + + void t() { + k( C(), A<int>(), D() ); + } + // CHECK: @_ZN8GH1336101kINS_1CENS_1AIiEENS_1DEEEDtdtfp_sr1U1BIT1_EE3MEMET_T0_S5_ +} // namespace GH133610 `````````` </details> https://github.com/llvm/llvm-project/pull/136201 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits