From: Marc Glisse <marc.glisse@inria.fr>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/51747 (list-initialization from same type)
Date: Tue, 15 Apr 2014 21:02:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.02.1404152253240.31023@stedding.saclay.inria.fr> (raw)
In-Reply-To: <534D4940.3040702@redhat.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 397 bytes --]
On Tue, 15 Apr 2014, Jason Merrill wrote:
> It's just vectors, because they're an extension; the patch I checked in
> covered the standard language.
Like this? (regtested on x86_64-linux-gnu)
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.
--
Marc Glisse
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1286 bytes --]
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c (revision 209434)
+++ gcc/cp/decl.c (working copy)
@@ -5400,21 +5400,21 @@ reshape_init_r (tree type, reshape_iter
maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
}
d->cur++;
return init;
}
/* "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)))
{
d->cur++;
return init;
}
/* [dcl.init.aggr]
Index: gcc/testsuite/g++.dg/cpp0x/initlist-vect.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/initlist-vect.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/initlist-vect.C (working copy)
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++11 } }
+
+typedef float X __attribute__ ((vector_size (4 * sizeof (float))));
+
+X x;
+X x2{x};
next prev parent reply other threads:[~2014-04-15 20:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 18:19 Jason Merrill
2014-04-14 22:03 ` Marc Glisse
2014-04-15 14:01 ` Jason Merrill
2014-04-15 14:13 ` Marc Glisse
2014-04-15 14:59 ` Jason Merrill
2014-04-15 21:02 ` Marc Glisse [this message]
2014-04-16 17:26 ` Jason Merrill
2015-05-07 16:45 ` Jason Merrill
2015-06-09 17:07 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1404152253240.31023@stedding.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).