PR c++/51416
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 17 Dec 2011 13:51:51 +0000 (13:51 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 17 Dec 2011 13:51:51 +0000 (13:51 +0000)
* init.c (build_value_init_noctor): Check for incomplete type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182435 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/init.c

index 98a80e3..2355a04 100644 (file)
@@ -377,6 +377,12 @@ build_value_init (tree type, tsubst_flags_t complain)
 tree
 build_value_init_noctor (tree type, tsubst_flags_t complain)
 {
+  if (!COMPLETE_TYPE_P (type))
+    {
+      if (complain & tf_error)
+       error ("value-initialization of incomplete type %qT", type);
+      return error_mark_node;
+    }
   /* FIXME the class and array cases should just use digest_init once it is
      SFINAE-enabled.  */
   if (CLASS_TYPE_P (type))