From c2f4acb703873f3a4f4e419afadad78417396f0e Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sun, 18 Oct 1992 08:12:53 +0000 Subject: [PATCH] (process_init_constructor): When initializing a union, handle the case of an empty init list. From-SVN: r2507 --- gcc/c-typeck.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6341cc2ef6b..9c4c1a421be 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5202,6 +5202,12 @@ process_init_constructor (type, init, elts, constant_value, constant_element, /* For a union, get the initializer for 1 fld. */ + if (tail == 0) + { + error ("empty initializer for union"); + tail = build_tree_list (0, 0); + } + /* If this element specifies a field, initialize via that field. */ if (TREE_PURPOSE (tail) != 0) { -- 2.30.2