public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] PR c++/58566
@ 2015-10-11 17:05 Ville Voutilainen
  2015-10-11 17:30 ` Ville Voutilainen
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Voutilainen @ 2015-10-11 17:05 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill

Tested on Linux-PPC64.

/cp
2015-10-11  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-11  Ville Voutilainen  <ville.voutilainen@gmail.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [C++ PATCH] PR c++/58566
  2015-10-11 17:05 [C++ PATCH] PR c++/58566 Ville Voutilainen
@ 2015-10-11 17:30 ` Ville Voutilainen
  2015-10-12  7:55   ` Jason Merrill
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Voutilainen @ 2015-10-11 17:30 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

On 11 October 2015 at 20:05, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> Tested on Linux-PPC64.
>
> /cp
> 2015-10-11  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-11  Ville Voutilainen  <ville.voutilainen@gmail.com>
>
>     PR c++/58566
>     * g++.dg/cpp0x/lambda/lambda-58566.C: New.

..and now with the actual patch attached. :)

[-- Attachment #2: 58566.diff --]
[-- Type: text/plain, Size: 920 bytes --]

diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index ceab646..b4f19af 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -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)));
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
index 0000000..3101d0a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
@@ -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" }
+  }
+};

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [C++ PATCH] PR c++/58566
  2015-10-11 17:30 ` Ville Voutilainen
@ 2015-10-12  7:55   ` Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2015-10-12  7:55 UTC (permalink / raw)
  To: Ville Voutilainen, gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-12  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-11 17:05 [C++ PATCH] PR c++/58566 Ville Voutilainen
2015-10-11 17:30 ` Ville Voutilainen
2015-10-12  7:55   ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).