decl.c (reshape_init_r): Handle a single element of vector type.

2014-04-16  Marc Glisse  <marc.glisse@inria.fr>

gcc/cp/
	* decl.c (reshape_init_r): Handle a single element of vector type.
gcc/testsuite/
	* g++.dg/cpp0x/initlist-vect.C: New file.

From-SVN: r209449
This commit is contained in:
Marc Glisse 2014-04-16 22:46:47 +02:00 committed by Marc Glisse
parent 73cc28d4e7
commit fcde53d03f
4 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2014-04-16 Marc Glisse <marc.glisse@inria.fr>
* decl.c (reshape_init_r): Handle a single element of vector type.
2014-04-16 Patrick Palka <patrick@parcs.ath.cx>
PR c++/60765

View File

@ -5407,7 +5407,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p,
/* "If T is a class type and the initializer list has a single element of
type cv U, where U is T or a class derived from T, the object is
initialized from that element." Even if T is an aggregate. */
if (cxx_dialect >= cxx11 && CLASS_TYPE_P (type)
if (cxx_dialect >= cxx11 && (CLASS_TYPE_P (type) || VECTOR_TYPE_P (type))
&& first_initializer_p
&& d->end - d->cur == 1
&& reference_related_p (type, TREE_TYPE (init)))

View File

@ -1,3 +1,7 @@
2014-04-16 Marc Glisse <marc.glisse@inria.fr>
* g++.dg/cpp0x/initlist-vect.C: New file.
2014-04-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/uninit-B-O0.c: Remove XFAIL.

View File

@ -0,0 +1,6 @@
// { dg-do compile { target c++11 } }
typedef float X __attribute__ ((vector_size (4 * sizeof (float))));
X x;
X x2{x};