This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/51747 (list-initialization from same type)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 09 Jun 2015 12:57:24 -0400
- Subject: Re: C++ PATCH for c++/51747 (list-initialization from same type)
- Authentication-results: sourceware.org; auth=none
- References: <53483236 dot 7030700 at redhat dot com> <554B96A2 dot 4080108 at redhat dot com>
On 05/07/2015 12:45 PM, Jason Merrill wrote:
We also need to adjust digest_init_r.
This was only needed because we weren't calling reshape_init. Now that
Paolo has fixed that, this can become an assert.
commit 8d2793c42fc3de4a0b665f4c2ff2a2946ae0beda
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jun 9 09:51:31 2015 -0400
DR 1467
PR c++/51747
* typeck2.c (digest_init_r): Replace previous change with
gcc_unreachable.
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index b077f02..709875c 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1089,6 +1089,7 @@ digest_init_r (tree type, tree init, bool nested, int flags,
|| TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == COMPLEX_TYPE);
+#ifdef ENABLE_CHECKING
/* "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." */
@@ -1099,8 +1100,10 @@ digest_init_r (tree type, tree init, bool nested, int flags,
{
tree elt = CONSTRUCTOR_ELT (init, 0)->value;
if (reference_related_p (type, TREE_TYPE (elt)))
- init = elt;
+ /* We should have fixed this in reshape_init. */
+ gcc_unreachable ();
}
+#endif
if (BRACE_ENCLOSED_INITIALIZER_P (init)
&& !TYPE_NON_AGGREGATE_CLASS (type))