mattd updated this revision to Diff 172503. mattd added a comment. Thanks for the review @rjmccall. I have moved the type-alias check into TemplateSpecializationType's desugar method. I like this solution better.
https://reviews.llvm.org/D54048 Files: include/clang/AST/Type.h test/SemaCXX/alignof.cpp 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<void>) == 16, "Expected alignment of 16" ); Index: include/clang/AST/Type.h =================================================================== --- include/clang/AST/Type.h +++ include/clang/AST/Type.h @@ -4901,7 +4901,9 @@ return !isDependentType() || isCurrentInstantiation() || isTypeAlias(); } - QualType desugar() const { return getCanonicalTypeInternal(); } + QualType desugar() const { + return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal(); + } void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) { Profile(ID, Template, template_arguments(), Ctx);
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<void>) == 16, "Expected alignment of 16" ); Index: include/clang/AST/Type.h =================================================================== --- include/clang/AST/Type.h +++ include/clang/AST/Type.h @@ -4901,7 +4901,9 @@ return !isDependentType() || isCurrentInstantiation() || isTypeAlias(); } - QualType desugar() const { return getCanonicalTypeInternal(); } + QualType desugar() const { + return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal(); + } void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) { Profile(ID, Template, template_arguments(), Ctx);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits