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


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" );
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to