================ @@ -11451,7 +11451,11 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R, bool MightInstantiateToSpecialization = false; if (auto RetTST = TSI->getTypeLoc().getAsAdjusted<TemplateSpecializationTypeLoc>()) { - TemplateName SpecifiedName = RetTST.getTypePtr()->getTemplateName(); + const TemplateSpecializationType *TST = RetTST.getTypePtr(); + while (TST && TST->isTypeAlias()) + TST = TST->getAliasedType()->getAs<TemplateSpecializationType>(); + + TemplateName SpecifiedName = TST->getTemplateName(); ---------------- antangelo wrote:
If there is some test case that would trip the assert (i.e. some input for which the alias type is not a template specialization type), then we should handle it more gracefully. If it (conceivably) can't happen, then an assert is fine. I thought about it for a bit and came up with this (somewhat contrived) invalid code that might fall into this path: ```c++ template<class T> struct A {}; struct B {}; template<typename T> using X = B; template<typename T> A() -> X<T>; ``` https://godbolt.org/z/shzK9eccz https://github.com/llvm/llvm-project/pull/117450 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits