diff mbox

[C++] PR 47795

Message ID 4D5EA78E.2080305@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Feb. 18, 2011, 5:08 p.m. UTC
Hi,

I have this patchlet for an ICE on invalid, 4.5/4.6 Regression. Tested
x86_64-linux.

Ok for mainline? (and, I would say, 4_5-branch too, if the patch works
as-is)

Thanks,
Paolo.

///////////////
/cp
2011-02-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/47795
	* semantics.c (finish_non_static_data_member): Early return if
	object is error_mark_node.

/testsuite
2011-02-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/47795
	* g++.dg/cpp0x/lambda/lambda-ice3.C: New.

Comments

Jason Merrill Feb. 18, 2011, 5:14 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
===================================================================
--- testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C	(revision 0)
@@ -0,0 +1,23 @@ 
+// PR c++/47795
+// { dg-options "-std=c++0x" }
+
+class Klass
+{
+  unsigned int local;
+public:
+  bool dostuff();
+};
+
+bool Klass::dostuff()
+{
+  auto f = []() -> bool {
+    if (local & 1) { return true; } // { dg-error "not captured" }
+    return false;
+  };
+}
+
+int main()
+{
+  Klass c;
+  return 0;
+}
Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 170272)
+++ cp/semantics.c	(working copy)
@@ -1533,6 +1533,9 @@  finish_non_static_data_member (tree decl, tree obj
       object = maybe_dummy_object (scope, NULL);
     }
 
+  if (object == error_mark_node)
+    return error_mark_node;
+
   /* DR 613: Can use non-static data members without an associated
      object in sizeof/decltype/alignof.  */
   if (is_dummy_object (object) && cp_unevaluated_operand == 0