public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 72800
@ 2016-08-04 17:02 Paolo Carlini
  2016-08-04 18:53 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2016-08-04 17:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

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

Hi,

when back in 2014 I sent the patch for c++/61088 I noticed some cases 
where we wanted to return early error_mark_node from add_capture to 
avoid ICEs during error recovery when COMPLETE_TYPE_P is used on an 
error_mark_node. The new testcase noticed one additional case, where the 
error_mark_node is returned by lambda_capture_field_type. I propose to 
just immediately check it. Alternately we could add the check to the 
else branch of the following conditional (which also passes testing) or 
somewhere else too, I guess. Tested x86_64-linux.

Thanks,

Paolo.

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


[-- Attachment #2: CL_72800 --]
[-- Type: text/plain, Size: 284 bytes --]

/cp
2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/72800
	* lambda.c (add_capture): Check lambda_capture_field_type return
	value for error_mark_node.

/testsuite
2016-08-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/72800
	* g++.dg/cpp1y/lambda-ice1.C: New.

[-- Attachment #3: patch_72800 --]
[-- Type: text/plain, Size: 812 bytes --]

Index: cp/lambda.c
===================================================================
--- cp/lambda.c	(revision 239118)
+++ cp/lambda.c	(working copy)
@@ -492,6 +492,8 @@ add_capture (tree lambda, tree id, tree orig_init,
   else
     {
       type = lambda_capture_field_type (initializer, explicit_init_p);
+      if (type == error_mark_node)
+	return error_mark_node;
       if (by_reference_p)
 	{
 	  type = build_reference_type (type);
Index: testsuite/g++.dg/cpp1y/lambda-ice1.C
===================================================================
--- testsuite/g++.dg/cpp1y/lambda-ice1.C	(revision 0)
+++ testsuite/g++.dg/cpp1y/lambda-ice1.C	(working copy)
@@ -0,0 +1,7 @@
+// PR c++/72800
+// { dg-do compile { target c++14 } }
+
+void foo ()
+{
+  [n {}] {};  // { dg-error "one element|deducing" }
+}

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

* Re: [C++ Patch] PR 72800
  2016-08-04 17:02 [C++ Patch] PR 72800 Paolo Carlini
@ 2016-08-04 18:53 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-08-04 18:53 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

On Thu, Aug 4, 2016 at 1:02 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> when back in 2014 I sent the patch for c++/61088 I noticed some cases where
> we wanted to return early error_mark_node from add_capture to avoid ICEs
> during error recovery when COMPLETE_TYPE_P is used on an error_mark_node.
> The new testcase noticed one additional case, where the error_mark_node is
> returned by lambda_capture_field_type. I propose to just immediately check
> it. Alternately we could add the check to the else branch of the following
> conditional (which also passes testing) or somewhere else too, I guess.
> Tested x86_64-linux.
>
> Thanks,
>
> Paolo.
>
> ////////////////////////
>

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

end of thread, other threads:[~2016-08-04 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 17:02 [C++ Patch] PR 72800 Paolo Carlini
2016-08-04 18:53 ` Jason Merrill

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