re PR c++/43790 ([C++0x] In lambda express, calling member function of non-captured...
authorJason Merrill <jason@redhat.com>
Tue, 27 Apr 2010 20:08:47 +0000 (16:08 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 27 Apr 2010 20:08:47 +0000 (16:08 -0400)
PR c++/43790
* tree.c (cv_unqualified): Handle error_mark_node.

From-SVN: r158801

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

index f7456bf3d521ac3ddee9c28775eb77ff3105e0b6..68c6b498b74d53595ea04e2a0e57a232ee234ae8 100644 (file)
@@ -1,5 +1,8 @@
 2010-04-27  Jason Merrill  <jason@redhat.com>
 
+       PR c++/43790
+       * tree.c (cv_unqualified): Handle error_mark_node.
+
        PR c++/41468
        * call.c (convert_like_real) [ck_ambig]: Just return error_mark_node
        if we don't want errors.
index 27ced53a2b4495f40e3f8993a09404f3781ff89c..0abc12ccd57d5177d391cbeacf8698f1637fdf36 100644 (file)
@@ -934,7 +934,12 @@ cp_build_qualified_type_real (tree type,
 tree
 cv_unqualified (tree type)
 {
-  int quals = TYPE_QUALS (type);
+  int quals;
+
+  if (type == error_mark_node)
+    return type;
+
+  quals = TYPE_QUALS (type);
   quals &= ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
   return cp_build_qualified_type (type, quals);
 }
index c48c0fe8bbb6249d61ad7027b697919895fc631e..3a320983f65a1d228839ffec48ab56e30738cd38 100644 (file)
@@ -1,5 +1,7 @@
 2010-04-27  Jason Merrill  <jason@redhat.com>
 
+       * g++.dg/cpp0x/lambda/lambda-ice1.C: New.
+
        PR c++/41468
        * g++.dg/template/sfinae17.C: New.
        * g++.dg/template/sfinae18.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice1.C
new file mode 100644 (file)
index 0000000..1ea8f4d
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/43790
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+  int f();
+};
+
+int main()
+{
+  A a;
+  auto l = [] () { return a.f(); }; // { dg-error "not captured|return" }
+}