[C++ Patch] PR 59270

Paolo Carlini paolo.carlini@oracle.com
Wed Jan 15 20:53:00 GMT 2014


Hi,

On 01/15/2014 08:45 PM, Jason Merrill wrote:
> On 01/15/2014 07:54 AM, Paolo Carlini wrote:
>> It seems Ok to me, and passes testing, to
>> return NULL_TREE from build_value_init. Alternately, more
>> conservatively, we could change build_value_init_noctor to not call
>> build_value_init at all when ftype == error_mark_node.
>
> I think I would prefer that.  I'm uncomfortable with returning NULL_TREE.
Ok then, I'm finishing testing the below.

Thanks,
Paolo.

//////////////////////
-------------- next part --------------
/cp
2014-01-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59270
	* init.c (build_value_init_noctor): Don't pass error_mark_node to
	build_value_init.

/testsuite
2014-01-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/59270
	* g++.dg/cpp0x/decltype-incomplete1.C: New.
-------------- next part --------------
Index: cp/init.c
===================================================================
--- cp/init.c	(revision 206643)
+++ cp/init.c	(working copy)
@@ -399,6 +399,9 @@ build_value_init_noctor (tree type, tsubst_flags_t
 
 	      ftype = TREE_TYPE (field);
 
+	      if (ftype == error_mark_node)
+		continue;
+
 	      /* We could skip vfields and fields of types with
 		 user-defined constructors, but I think that won't improve
 		 performance at all; it should be simpler in general just
Index: testsuite/g++.dg/cpp0x/decltype-incomplete1.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-incomplete1.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/decltype-incomplete1.C	(working copy)
@@ -0,0 +1,9 @@
+// PR c++/59270
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  struct B b; // { dg-error "incomplete type" }
+};
+
+decltype(A()) a;


More information about the Gcc-patches mailing list