PR c++/58566
authorville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Oct 2015 08:55:19 +0000 (08:55 +0000)
committerville <ville@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Oct 2015 08:55:19 +0000 (08:55 +0000)
/cp
2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

PR c++/58566
* lambda.c (lambda_return_type): Return error_mark_node
instead of void_type_node for the error cases.

/testsuite
2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>

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

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

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

index e89fd02..517ce52 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/58566
+       * lambda.c (lambda_return_type): Return error_mark_node
+       instead of void_type_node for the error cases.
+
 2015-10-08  Jason Merrill  <jason@redhat.com>
 
        * cp-tree.h (SIMPLE_TARGET_EXPR_P): New.
index ceab646..b4f19af 100644 (file)
@@ -175,7 +175,7 @@ lambda_return_type (tree expr)
       || BRACE_ENCLOSED_INITIALIZER_P (expr))
     {
       cxx_incomplete_type_error (expr, TREE_TYPE (expr));
-      return void_type_node;
+      return error_mark_node;
     }
   gcc_checking_assert (!type_dependent_expression_p (expr));
   return cv_unqualified (type_decays_to (unlowered_expr_type (expr)));
index b558a9e..f4b7d26 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-12  Ville Voutilainen  <ville.voutilainen@gmail.com>
+
+       PR c++/58566
+       * g++.dg/cpp0x/lambda/lambda-58566.C: New.
+
 2015-10-10  Jan Hubicka  <hubicka@ucw.cz>
 
        * gfortran.dg/lto/bind_c-2_0.f90: New testcase.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
new file mode 100644 (file)
index 0000000..3101d0a
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/58566
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  int foo()
+  {
+    [this]{ return foo; }; // { dg-error "invalid use of member function|cannot convert" }
+  }
+};