================ @@ -10598,10 +10598,36 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( if (TemplateName.isDependent()) return SubstAutoTypeDependent(TSInfo->getType()); - // We can only perform deduction for class templates. + // We can only perform deduction for class templates or alias templates. auto *Template = dyn_cast_or_null<ClassTemplateDecl>(TemplateName.getAsTemplateDecl()); + TemplateDecl* LookupTemplateDecl = Template; + if (!Template && getLangOpts().CPlusPlus20) { // type alias template + if (auto *AliasTemplate = dyn_cast_or_null<TypeAliasTemplateDecl>( + TemplateName.getAsTemplateDecl()); + AliasTemplate) { + LookupTemplateDecl = AliasTemplate; + auto UnderlyingType = AliasTemplate->getTemplatedDecl() + ->getUnderlyingType() + .getDesugaredType(Context); ---------------- hokein wrote:
thanks for the clarification. Switched to `Canonical`. Per https://eel.is/c++draft/over.match.class.deduct#3, CTAD is only allowed for aliases with the form of `[typename] [nested-name-specifier] [template] simple-template-id`. Pointers and references are not accounted. Added a test case for pointer types. https://github.com/llvm/llvm-project/pull/77890 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits