Commit 2f3932b9 by Jason Merrill Committed by Jason Merrill

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
parent 97ca3d0d
2016-01-21 Jason Merrill <jason@redhat.com> 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 PR c++/43407
* decl.c (start_enum): Add attributes parameter. * decl.c (start_enum): Add attributes parameter.
* parser.c (cp_parser_enum_specifier): Pass it. * parser.c (cp_parser_enum_specifier): Pass it.
......
...@@ -13030,8 +13030,12 @@ copy_type_enum (tree dst, tree src) ...@@ -13030,8 +13030,12 @@ copy_type_enum (tree dst, tree src)
TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (src); TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (src);
SET_TYPE_MODE (dst, TYPE_MODE (src)); SET_TYPE_MODE (dst, TYPE_MODE (src));
TYPE_PRECISION (t) = TYPE_PRECISION (src); TYPE_PRECISION (t) = TYPE_PRECISION (src);
TYPE_ALIGN (t) = TYPE_ALIGN (src); unsigned valign = TYPE_ALIGN (src);
TYPE_USER_ALIGN (t) = TYPE_USER_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); TYPE_UNSIGNED (t) = TYPE_UNSIGNED (src);
} }
} }
......
// { dg-do compile { target c++11 } }
#define SA(X) static_assert(X,#X)
enum alignas(16) E {};
SA(alignof(E) == 16);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment