re PR c++/58566 ([c++11] ICE with invalid expression in lambda body)
authorVille Voutilainen <ville.voutilainen@gmail.com>
Mon, 12 Oct 2015 08:55:19 +0000 (11:55 +0300)
committerVille Voutilainen <ville@gcc.gnu.org>
Mon, 12 Oct 2015 08:55:19 +0000 (11:55 +0300)
PR c++/58566

/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.

From-SVN: r228706

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 e89fd0229334505e3850eb1949fe1224614f4347..517ce522960d2ac0bfef26ecd9d4dc2a8ca9d876 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 ceab646957436ff1786da53e70500e4c907f5d99..b4f19af6effc9efd9f366a7c1613c66a6a377a0e 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 b558a9e972395f50b1e5e70b2f95d22fb83df560..f4b7d26d92065e71212f0b7274349fbe6b406a55 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" }
+  }
+};