[clang] [Clang] prevent errors for deduction guides using deduced type aliases (PR #117450)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 14:48:38 PST 2024


================
@@ -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();
----------------
a-tarasyuk wrote:

@antangelo thanks. I've removed the assert in favor of a condition and added additional tests.






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


More information about the cfe-commits mailing list