Patchwork [C++] PR 42083

login
register
mail settings
Submitter Paolo Carlini
Date Dec. 9, 2010, 11:56 a.m.
Message ID <4D00C405.5030305@oracle.com>
Download mbox | patch
Permalink /patch/74877/
State New
Headers show

Comments

Paolo Carlini - Dec. 9, 2010, 11:56 a.m.
Hi,

I have this patchlet for an ICE on invalid. Tested x86_64-linux.

Ok for mainline?

Thanks,
Paolo.

//////////////////////
/cp
2010-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42083
	* init.c (build_value_init): Check build_special_member_call return
	value for error_mark_node.

/testsuite
2010-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/42083
	* g++.dg/cpp0x/lambda/lambda-ice2.C: New.
Jason Merrill - Dec. 15, 2010, 4:48 p.m.
On 12/09/2010 06:56 AM, Paolo Carlini wrote:
> Ok for mainline?

OK (and obvious).

Jason

Patch

Index: testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C
===================================================================
--- testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/lambda/lambda-ice2.C	(revision 0)
@@ -0,0 +1,16 @@ 
+// PR c++/42083
+// { dg-options "-std=c++0x" }
+
+template<typename F>
+decltype(F()) run(F f) // { dg-message "note" }
+{
+  return f();
+}
+
+int main()
+{
+  auto l = []() { return 5; };
+
+  run(l); // { dg-error "no match" }
+  // { dg-message "candidate" "candidate note" { target *-*-* } 14 }
+}
Index: cp/init.c
===================================================================
--- cp/init.c	(revision 167632)
+++ cp/init.c	(working copy)
@@ -314,9 +314,11 @@  build_value_init (tree type, tsubst_flags_t compla
 	  tree ctor = build_special_member_call
 	    (NULL_TREE, complete_ctor_identifier,
 	     NULL, type, LOOKUP_NORMAL, complain);
-
-	  ctor = build_aggr_init_expr (type, ctor);
-	  AGGR_INIT_ZERO_FIRST (ctor) = 1;
+	  if (ctor != error_mark_node)
+	    {
+	      ctor = build_aggr_init_expr (type, ctor);
+	      AGGR_INIT_ZERO_FIRST (ctor) = 1;
+	    }
 	  return ctor;
 	}
     }