/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Feb 2011 17:22:14 +0000 (17:22 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Feb 2011 17:22:14 +0000 (17:22 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170275 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C [new file with mode: 0644]

index db9fa89..0f6ece2 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2011-02-18  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/47208
index 1ad707b..e102ba3 100644 (file)
@@ -1533,6 +1533,9 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
       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
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
new file mode 100644 (file)
index 0000000..8ff3647
--- /dev/null
@@ -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;
+}