public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/47263 (missing eh-spec on lambda)
@ 2011-05-23 16:47 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2011-05-23 16:47 UTC (permalink / raw)
  To: gcc-patches List

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

G++ was omitting code for the exception specification on the lambda 
because it was confusing it with an synthesized constructor.  This patch 
fixes the test to match the comment better; not all artificial methods 
are [cd]tors.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: 47263.patch --]
[-- Type: text/x-patch, Size: 1164 bytes --]

commit 79adecb0b52f58792a2a2f05394f3df13e2b7fcc
Author: Jason Merrill <jason@redhat.com>
Date:   Sun May 22 16:29:27 2011 -0400

    	PR c++/47263
    	* decl.c (use_eh_spec_block): Do use an EH spec block for a
    	lambda op().

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 733157a..234daaf 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12759,7 +12759,7 @@ use_eh_spec_block (tree fn)
 	     not creating the EH_SPEC_BLOCK we save a little memory,
 	     and we avoid spurious warnings about unreachable
 	     code.  */
-	  && !DECL_ARTIFICIAL (fn));
+	  && !DECL_DEFAULTED_FN (fn));
 }
 
 /* Store the parameter declarations into the current function declaration.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C
new file mode 100644
index 0000000..1490a25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C
@@ -0,0 +1,16 @@
+// PR c++/47263
+// { dg-options -std=c++0x }
+// { dg-do run }
+
+#include <exception>
+
+int main( void )
+{
+  std::set_unexpected( []{ throw 0; } );
+  try
+    {
+      []() throw( int ) { throw nullptr; }();
+    }
+  catch( int )
+    { }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-23 15:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 16:47 C++ PATCH for c++/47263 (missing eh-spec on lambda) 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).