re PR c++/40751 (G++ never packs typedef'd enums)
PR c++/40751 PR c++/64987 * decl.c (copy_type_enum): Respect TYPE_USER_ALIGN. From-SVN: r232702
This commit is contained in:
parent
97ca3d0d59
commit
2f3932b910
@ -1,5 +1,9 @@
|
||||
2016-01-21 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/40751
|
||||
PR c++/64987
|
||||
* decl.c (copy_type_enum): Respect TYPE_USER_ALIGN.
|
||||
|
||||
PR c++/43407
|
||||
* decl.c (start_enum): Add attributes parameter.
|
||||
* parser.c (cp_parser_enum_specifier): Pass it.
|
||||
|
@ -13030,8 +13030,12 @@ copy_type_enum (tree dst, tree src)
|
||||
TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (src);
|
||||
SET_TYPE_MODE (dst, TYPE_MODE (src));
|
||||
TYPE_PRECISION (t) = TYPE_PRECISION (src);
|
||||
TYPE_ALIGN (t) = TYPE_ALIGN (src);
|
||||
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (src);
|
||||
unsigned valign = TYPE_ALIGN (src);
|
||||
if (TYPE_USER_ALIGN (t))
|
||||
valign = MAX (valign, TYPE_ALIGN (t));
|
||||
else
|
||||
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (src);
|
||||
TYPE_ALIGN (t) = valign;
|
||||
TYPE_UNSIGNED (t) = TYPE_UNSIGNED (src);
|
||||
}
|
||||
}
|
||||
|
6
gcc/testsuite/g++.dg/cpp0x/alignas5.C
Normal file
6
gcc/testsuite/g++.dg/cpp0x/alignas5.C
Normal file
@ -0,0 +1,6 @@
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
#define SA(X) static_assert(X,#X)
|
||||
|
||||
enum alignas(16) E {};
|
||||
SA(alignof(E) == 16);
|
Loading…
Reference in New Issue
Block a user