diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ebf9b3d95ee7b96da94d6384e76915d130640464..ebcd865e9b37fdeb801a2db998bd667f4176f12e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-20  Paolo Carlini  <pcarlini@suse.de>
+
+	PR c++/33459
+	* init.c (build_zero_init): If, recursively, build_zero_init
+	returns a NULL_TREE, do not append it to the VEC of constructors.
+
 2007-09-18  Jason Merrill  <jason@redhat.com>
 
 	PR c++/17743
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e11d18433b3cd99c6a61c80b0d38d76ed5c93a43..247879cc5a03d29e39d4387b140eb4b364bd7326 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -136,11 +136,12 @@ initialize_vtbl_ptrs (tree addr)
 /* Return an expression for the zero-initialization of an object with
    type T.  This expression will either be a constant (in the case
    that T is a scalar), or a CONSTRUCTOR (in the case that T is an
-   aggregate).  In either case, the value can be used as DECL_INITIAL
-   for a decl of the indicated TYPE; it is a valid static initializer.
-   If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS is the
-   number of elements in the array.  If STATIC_STORAGE_P is TRUE,
-   initializers are only generated for entities for which
+   aggregate), or NULL (in the case that T does not require
+   initialization).  In either case, the value can be used as
+   DECL_INITIAL for a decl of the indicated TYPE; it is a valid static
+   initializer. If NELTS is non-NULL, and TYPE is an ARRAY_TYPE, NELTS
+   is the number of elements in the array.  If STATIC_STORAGE_P is
+   TRUE, initializers are only generated for entities for which
    zero-initialization does not simply mean filling the storage with
    zero bytes.  */
 
@@ -199,7 +200,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
 	      tree value = build_zero_init (TREE_TYPE (field),
 					    /*nelts=*/NULL_TREE,
 					    static_storage_p);
-	      CONSTRUCTOR_APPEND_ELT(v, field, value);
+	      if (value)
+		CONSTRUCTOR_APPEND_ELT(v, field, value);
 	    }
 
 	  /* For unions, only the first field is initialized.  */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b36320df6ead4b6d158755ce6c83184c0a109bc1..804f300832a31869251231c448ac6592ecb05dca 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-20  Paolo Carlini  <pcarlini@suse.de>
+
+	PR c++/33459
+	* g++.dg/init/ref14.C: New.
+
 2007-09-19  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gnat.dg/slice2.ad[sb]: New testcase.
diff --git a/gcc/testsuite/g++.dg/init/ref14.C b/gcc/testsuite/g++.dg/init/ref14.C
new file mode 100644
index 0000000000000000000000000000000000000000..212e6e95d7eab4152eb8ed9d949b21eb0b52a855
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/ref14.C
@@ -0,0 +1,11 @@
+// PR c++/33459
+
+union A
+{
+  int &i; // { dg-error "may not have reference type" }
+};
+
+void foo()
+{
+  A();
+}