From df0353c0610f4838f6be32608b2eb325a9d60783 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 4 Jan 2018 01:02:18 +0000 Subject: [PATCH] PR35028: Retain duplicate alignas attributes in template instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321777 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 1 + test/SemaTemplate/alignas.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 7bb6c30807..a0dc1a2b9a 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -552,6 +552,7 @@ def Aligned : InheritableAttr { Keyword<"_Alignas">]>, Accessor<"isDeclspec",[Declspec<"align">]>]; let Documentation = [Undocumented]; + let DuplicatesAllowedWhileMerging = 1; } def AlignValue : Attr { diff --git a/test/SemaTemplate/alignas.cpp b/test/SemaTemplate/alignas.cpp index 8a1f96e5bd..680f07b329 100644 --- a/test/SemaTemplate/alignas.cpp +++ b/test/SemaTemplate/alignas.cpp @@ -21,3 +21,14 @@ struct C { char a[16]; }; static_assert(sizeof(my_union) == 16, ""); static_assert(alignof(my_union) == 8, ""); + +namespace PR35028 { + template struct alignas(X) alignas(long long) alignas(long double) alignas(Alignment) Aligned { + union { + long long align1; + long double align2; + char data[sizeof(X)]; + }; + }; + Aligned a; +} -- 2.40.0