[Bug c++/79360] [5.4/6/7 Regression] ICE with NSDMI and enum in union
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Feb 4 00:24:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79360
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #1)
> Confirmed, started with r234443.
Oops, I didn't know that TYPE_FIELDS could contain things other than
FIELD_DECLs. Testing this:
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 014de5c..1e0354d 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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,
More information about the Gcc-bugs
mailing list