Commit bb7d75ff by Patrick Palka

re PR c++/79360 (ICE with NSDMI and enum in union)

Fix PR c++/79360

gcc/cp/ChangeLog:

	PR c++/79360
	* typeck2.c (process_init_constructor_union): Consider only
	FIELD_DECLs when looking for an NSDMI.

gcc/testsuite/ChangeLog:

	PR c++/79360
	* g++.dg/cpp1y/nsdmi-union2.C: New test.

From-SVN: r245239
parent 10d22398
2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/79360
* typeck2.c (process_init_constructor_union): Consider only
FIELD_DECLs when looking for an NSDMI.
2017-02-06 Jason Merrill <jason@redhat.com>
PR c++/71193 - incomplete types in templates
......
......@@ -1510,7 +1510,8 @@ process_init_constructor_union (tree type, tree init,
{
for (tree field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
{
if (DECL_INITIAL (field))
if (TREE_CODE (field) == FIELD_DECL
&& DECL_INITIAL (field) != NULL_TREE)
{
CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (init),
field,
......
2017-02-07 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/79360
* g++.dg/cpp1y/nsdmi-union2.C: New test.
2017-02-06 Kito Cheng <kito.cheng@gmail.com>
* lib/target-supports.exp: Define the RISC-V target.
......
// PR c++/79360
// { dg-do compile { target c++14 } }
union U
{
enum E { e };
};
struct A
{
U u{};
};
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