Commit 0212e31e by Jakub Jelinek Committed by Jason Merrill

re PR c++/65690 (typedef alignment lost since r219705)

	PR c++/65690
 	* tree.c (cp_build_qualified_type_real): Copy TYPE_ALIGN and
	TYPE_USER_ALIGN.

From-SVN: r221960
parent 51c5c6b5
2015-04-09 Jakub Jelinek <jakub@redhat.com>
PR c++/65690
* tree.c (cp_build_qualified_type_real): Copy TYPE_ALIGN and
TYPE_USER_ALIGN.
PR c++/65690
* tree.c (build_cplus_array_type): Layout type before variants are
set, but copy over TYPE_SIZE and TYPE_SIZE_UNIT from the main
variant.
......
......@@ -1079,6 +1079,8 @@ cp_build_qualified_type_real (tree type,
{
t = build_variant_type_copy (t);
TYPE_NAME (t) = TYPE_NAME (type);
TYPE_ALIGN (t) = TYPE_ALIGN (type);
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (type);
}
}
......
/* PR c++/65690 */
/* { dg-do run } */
typedef double T[4][4] __attribute__((aligned (2 * __alignof__ (double))));
void foo (const T);
struct S { T s; };
int
main ()
{
if (__alignof__ (struct S) != 2 * __alignof__ (double)
|| __alignof__ (T) != 2 * __alignof__ (double)
|| __alignof__ (const struct S) != 2 * __alignof__ (double)
|| __alignof__ (const T) != 2 * __alignof__ (double))
__builtin_abort ();
return 0;
}
#if defined(__cplusplus) && __cplusplus >= 201103L
static_assert (alignof (S) == 2 * alignof (double), "alignment of S");
static_assert (alignof (T) == 2 * alignof (double), "alignment of T");
static_assert (alignof (const S) == 2 * alignof (double), "alignment of const S");
static_assert (alignof (const T) == 2 * alignof (double), "alignment of const T");
#endif
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