Patchwork [C++] PR 59270

login
register
mail settings
Submitter Paolo Carlini
Date Jan. 15, 2014, 8:53 p.m.
Message ID <52D6F54F.2030406@oracle.com>
Download mbox | patch
Permalink /patch/311263/
State New
Headers show

Comments

Paolo Carlini - Jan. 15, 2014, 8:53 p.m.
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.

//////////////////////
/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.
Paolo Carlini - Jan. 17, 2014, 10:22 a.m.
.. patchlet fixes c++/58811 too.

Paolo.
Jason Merrill - Jan. 17, 2014, 5:02 p.m.
OK.

Does returning error_mark_node from build_value_init in the case of 
erroneous type not work?

Jason
Paolo Carlini - Jan. 17, 2014, 5:22 p.m.
On 01/17/2014 06:02 PM, Jason Merrill wrote:
> OK.
Thanks.
> Does returning error_mark_node from build_value_init in the case of 
> erroneous type not work?
Yeah, doesn't work in the sense that we regress to two errors instead of 
one (like in 4.8.x) on that testcase I mentioned at the beginning of 
this thread (sorry for not being more explicit)

Paolo.

Patch

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;