Re: [C++ Patch] PR 59270

2014-01-17 Thread Paolo Carlini

.. patchlet fixes c++/58811 too.

Paolo.


Re: [C++ Patch] PR 59270

2014-01-17 Thread Jason Merrill

OK.

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


Jason


Re: [C++ Patch] PR 59270

2014-01-15 Thread Jason Merrill

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.

Jason




Re: [C++ Patch] PR 59270

2014-01-15 Thread Paolo Carlini

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.carl...@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.carl...@oracle.com

PR c++/59270
* g++.dg/cpp0x/decltype-incomplete1.C: New.
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;