diff options
-rw-r--r-- | clang/include/clang/AST/Type.h | 4 | ||||
-rw-r--r-- | clang/test/SemaCXX/alignof.cpp | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index cbcce8832e7..f69e1172ace 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -4901,7 +4901,9 @@ public: 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); diff --git a/clang/test/SemaCXX/alignof.cpp b/clang/test/SemaCXX/alignof.cpp index 2895cb9d46c..f2854024da1 100644 --- a/clang/test/SemaCXX/alignof.cpp +++ b/clang/test/SemaCXX/alignof.cpp @@ -97,3 +97,8 @@ struct S { 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" ); |