public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 59270
@ 2014-01-15 12:55 Paolo Carlini
  2014-01-15 19:45 ` Jason Merrill
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2014-01-15 12:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

Hi,

this is a 4.9 Regression, but just an ICE on invalid. It's a little 
tricky to fix, because, eg, in mainline (vs 4_8-branch) we want to 
produce somewhat more concise diagnostic in this area (eg, a single 
error for init/array26.C). 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.

Tested x86_64-linux.

Thanks,
Paolo.

//////////////////////

[-- Attachment #2: CL_59270 --]
[-- Type: text/plain, Size: 261 bytes --]

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

	PR c++/59270
	* init.c (build_value_init): Check type for error_mark_node.

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

	PR c++/59270
	* g++.dg/cpp0x/decltype-incomplete1.C: New.

[-- Attachment #3: patch_59270 --]
[-- Type: text/plain, Size: 819 bytes --]

Index: cp/init.c
===================================================================
--- cp/init.c	(revision 206627)
+++ cp/init.c	(working copy)
@@ -311,6 +311,9 @@ build_zero_init (tree type, tree nelts, bool stati
 tree
 build_value_init (tree type, tsubst_flags_t complain)
 {
+  if (type == error_mark_node)
+    return NULL_TREE;
+
   /* [dcl.init]
 
      To value-initialize an object of type T means:
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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] PR 59270
  2014-01-15 12:55 [C++ Patch] PR 59270 Paolo Carlini
@ 2014-01-15 19:45 ` Jason Merrill
  2014-01-15 20:53   ` Paolo Carlini
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2014-01-15 19:45 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] PR 59270
  2014-01-15 19:45 ` Jason Merrill
@ 2014-01-15 20:53   ` Paolo Carlini
  2014-01-17 10:22     ` Paolo Carlini
  2014-01-17 17:02     ` Jason Merrill
  0 siblings, 2 replies; 6+ messages in thread
From: Paolo Carlini @ 2014-01-15 20:53 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

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.

//////////////////////

[-- Attachment #2: CL_59270_2 --]
[-- Type: text/plain, Size: 285 bytes --]

/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.

[-- Attachment #3: patch_59270_2 --]
[-- Type: text/plain, Size: 899 bytes --]

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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] PR 59270
  2014-01-15 20:53   ` Paolo Carlini
@ 2014-01-17 10:22     ` Paolo Carlini
  2014-01-17 17:02     ` Jason Merrill
  1 sibling, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2014-01-17 10:22 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

.. patchlet fixes c++/58811 too.

Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] PR 59270
  2014-01-15 20:53   ` Paolo Carlini
  2014-01-17 10:22     ` Paolo Carlini
@ 2014-01-17 17:02     ` Jason Merrill
  2014-01-17 17:23       ` Paolo Carlini
  1 sibling, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2014-01-17 17:02 UTC (permalink / raw)
  To: Paolo Carlini, gcc-patches

OK.

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

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [C++ Patch] PR 59270
  2014-01-17 17:02     ` Jason Merrill
@ 2014-01-17 17:23       ` Paolo Carlini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2014-01-17 17:23 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-17 17:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15 12:55 [C++ Patch] PR 59270 Paolo Carlini
2014-01-15 19:45 ` Jason Merrill
2014-01-15 20:53   ` Paolo Carlini
2014-01-17 10:22     ` Paolo Carlini
2014-01-17 17:02     ` Jason Merrill
2014-01-17 17:23       ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).