diff options
author | J"orn Rennecke <amylaar@cygnus.co.uk> | 1999-10-14 02:18:10 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 1999-10-14 03:18:10 +0100 |
commit | a59f86402f8ffb904e9dccb10568371a890e1f30 (patch) | |
tree | 4156840afb1607ce49dc0ece52f2b961fbaa942f /gcc/cp | |
parent | 5cf531a862a201c899afabde00e1cdc8b04cd9c9 (diff) | |
download | gcc-a59f86402f8ffb904e9dccb10568371a890e1f30.zip gcc-a59f86402f8ffb904e9dccb10568371a890e1f30.tar.gz gcc-a59f86402f8ffb904e9dccb10568371a890e1f30.tar.bz2 |
gcc toplevel:
* expr.c (store_constructor): Clear union if constructor is empty.
cp:
* typeck2.c (process_init_constructor): Handle empty constructors.
testsuite:
* g++.old-deja/g++.other/union2.C: New test.
From-SVN: r29956
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9c421a8..3593ce4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +Wed Oct 13 22:01:35 1999 J"orn Rennecke <amylaar@cygnus.co.uk> + + * typeck2.c (process_init_constructor): Handle empty constructors. + 1999-10-13 Jason Merrill <jason@yorick.cygnus.com> * decl.c (lang_mark_tree): Mark NAMESPACE_LEVEL. diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 4b37e48..cb089d4 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -921,7 +921,9 @@ process_init_constructor (type, init, elts) members = expr_tree_cons (field, next1, members); } } - else if (TREE_CODE (type) == UNION_TYPE) + else if (TREE_CODE (type) == UNION_TYPE + /* If the initializer was empty, use default zero initialization. */ + && tail) { register tree field = TYPE_FIELDS (type); |