[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.

Matt Davis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 09:27:59 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC346146: [AST] Get aliased type info from an aliased TemplateSpecialization. (authored by mattd, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D54048

Files:
  include/clang/AST/Type.h
  test/SemaCXX/alignof.cpp


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" );


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54048.172606.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181105/b70a79ab/attachment.bin>


More information about the cfe-commits mailing list