On Wed, May 16, 2018 at 11:15 AM, Marek Polacek <pola...@redhat.com> wrote:
> This PR has been on my mind for quite some time but I've not found a solution
> that I'd like.  Maybe one of you can think of something better.
>
> The problem in this test is that in C++11, .eh optimizes out the catch,
> so the exception is never caught.  That is because lower_catch doesn't
> think that the region may throw (eh_region_may_contain_throw).  That's
> so because P::P () is marked as TREE_NOTHROW, which is wrong, because
> it calls X::X() which calls init() with throw.  TREE_NOTHROW is set in
> finish_function:
>
>   /* If this function can't throw any exceptions, remember that.  */
>   if (!processing_template_decl
>       && !cp_function_chain->can_throw
>       && !flag_non_call_exceptions
>       && !decl_replaceable_p (fndecl))
>     TREE_NOTHROW (fndecl) = 1;
>
> P::P() should have been marked as can_throw in set_flags_from_callee, but when
> processing X::X() cfun is null, so we can't set it.  P::P() is created only
> later via implicitly_declare_fn.

This should be handled by bot_manip (under break_out_target_exprs,
under get_nsdmi), but it seems that it currently only calls
set_flags_from_callee for CALL_EXPR, not for AGGR_INIT_EXPR as we have
in this case.

Jason

Reply via email to