https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85363

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
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).

After further poking it seems the cause is that P::P () is marked as
TREE_NOTHROW, which seems incorrect, because it calls X::X() which calls init()
with throw.  That 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;

Reply via email to