From 86d822aa63c1694e896ab66c92fa660fc4864c9f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 May 2011 11:48:37 -0400 Subject: [PATCH] re PR c++/47263 ([C++0x] lambda + dynamic-exception-specification std::unexpected() is not called.) PR c++/47263 * decl.c (use_eh_spec_block): Do use an EH spec block for a lambda op(). From-SVN: r174076 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl.c | 2 +- gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cfb6b58065c..ea617dfe947 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-05-23 Jason Merrill + PR c++/47263 + * decl.c (use_eh_spec_block): Do use an EH spec block for a + lambda op(). + PR c++/49058 * call.c (splice_viable): Be strict in templates. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 733157a3dfa..234daafb8a1 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/ChangeLog b/gcc/testsuite/ChangeLog index c41c7f60753..72aae61f3ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-23 Jason Merrill + * g++.dg/cpp0x/lambda/lambda-eh2.C: New. + * g++.dg/cpp0x/sfinae24.C: New. * g++.dg/cpp0x/error3.C: New. 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 00000000000..1490a250837 --- /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 + +int main( void ) +{ + std::set_unexpected( []{ throw 0; } ); + try + { + []() throw( int ) { throw nullptr; }(); + } + catch( int ) + { } +} -- 2.30.2