Index: include/clang/AST/TypeNodes.def =================================================================== --- include/clang/AST/TypeNodes.def +++ include/clang/AST/TypeNodes.def @@ -97,7 +97,7 @@ DEPENDENT_TYPE(TemplateTypeParm, Type) NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type) DEPENDENT_TYPE(SubstTemplateTypeParmPack, Type) -NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type) +TYPE(TemplateSpecialization, Type) ABSTRACT_TYPE(Deduced, Type) TYPE(Auto, DeducedType) TYPE(DeducedTemplateSpecialization, DeducedType) Index: lib/AST/ASTContext.cpp =================================================================== --- lib/AST/ASTContext.cpp +++ lib/AST/ASTContext.cpp @@ -1990,6 +1990,12 @@ return getTypeInfo(A->getDeducedType().getTypePtr()); } + case Type::TemplateSpecialization: { + const auto *TS = cast(T); + return TS->isTypeAlias() ? getTypeInfo(TS->getAliasedType().getTypePtr()) + : getTypeInfo(TS->desugar().getTypePtr()); + } + case Type::Paren: return getTypeInfo(cast(T)->getInnerType().getTypePtr()); @@ -6926,6 +6932,7 @@ // We could see an undeduced auto type here during error recovery. // Just ignore it. case Type::Auto: + case Type::TemplateSpecialization: case Type::DeducedTemplateSpecialization: return; @@ -8738,6 +8745,7 @@ llvm_unreachable("Non-canonical and dependent types shouldn't get here"); case Type::Auto: + case Type::TemplateSpecialization: case Type::DeducedTemplateSpecialization: case Type::LValueReference: case Type::RValueReference: Index: lib/AST/Type.cpp =================================================================== --- lib/AST/Type.cpp +++ lib/AST/Type.cpp @@ -3481,6 +3481,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: // Give non-deduced 'auto' types external linkage. We should only see them // here in error recovery. return CachedProperties(ExternalLinkage, false); @@ -3587,6 +3588,7 @@ case Type::Auto: case Type::DeducedTemplateSpecialization: + case Type::TemplateSpecialization: return LinkageInfo::external(); case Type::Record: Index: test/SemaCXX/alignof.cpp =================================================================== --- test/SemaCXX/alignof.cpp +++ test/SemaCXX/alignof.cpp @@ -97,3 +97,8 @@ typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}} }; } + +typedef int __attribute__(( aligned( 16 ) )) aligned_int; +template < typename > +using template_alias = aligned_int; +static_assert( alignof( template_alias) == 16, "alignof(template_alias<>) is incorrect" );