r321777 - PR35028: Retain duplicate alignas attributes in template instantiation.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 3 17:02:18 PST 2018
Author: rsmith
Date: Wed Jan 3 17:02:18 2018
New Revision: 321777
URL: http://llvm.org/viewvc/llvm-project?rev=321777&view=rev
Log:
PR35028: Retain duplicate alignas attributes in template instantiation.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/test/SemaTemplate/alignas.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=321777&r1=321776&r2=321777&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Jan 3 17:02:18 2018
@@ -552,6 +552,7 @@ def Aligned : InheritableAttr {
Keyword<"_Alignas">]>,
Accessor<"isDeclspec",[Declspec<"align">]>];
let Documentation = [Undocumented];
+ let DuplicatesAllowedWhileMerging = 1;
}
def AlignValue : Attr {
Modified: cfe/trunk/test/SemaTemplate/alignas.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/alignas.cpp?rev=321777&r1=321776&r2=321777&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/alignas.cpp (original)
+++ cfe/trunk/test/SemaTemplate/alignas.cpp Wed Jan 3 17:02:18 2018
@@ -21,3 +21,14 @@ struct C { char a[16]; };
static_assert(sizeof(my_union<A, B, C>) == 16, "");
static_assert(alignof(my_union<A, B, C>) == 8, "");
+
+namespace PR35028 {
+ template<class X, int Alignment> struct alignas(X) alignas(long long) alignas(long double) alignas(Alignment) Aligned {
+ union {
+ long long align1;
+ long double align2;
+ char data[sizeof(X)];
+ };
+ };
+ Aligned<int, 1> a;
+}
More information about the cfe-commits
mailing list