diff options
author | Richard Stallman <rms@gnu.org> | 1992-10-18 08:12:53 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-10-18 08:12:53 +0000 |
commit | c2f4acb703873f3a4f4e419afadad78417396f0e (patch) | |
tree | f40afa0e9538d410874f6a3459a1992e23ad125d /gcc | |
parent | e8db4813dbc1f2cd4425da69f5fb2062a5eb5b97 (diff) | |
download | gcc-c2f4acb703873f3a4f4e419afadad78417396f0e.zip gcc-c2f4acb703873f3a4f4e419afadad78417396f0e.tar.gz gcc-c2f4acb703873f3a4f4e419afadad78417396f0e.tar.bz2 |
(process_init_constructor): When initializing a union,
handle the case of an empty init list.
From-SVN: r2507
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-typeck.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6341cc2..9c4c1a4 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) { |