Commit 20afdcd3 by Jason Merrill

c++: Fix ICE with defaulted destructor and template.

In a template we don't instantiate a deferred noexcept-spec, and we don't
need it because we aren't going to do anything with the value of
throwing_cleanup in a template anyway.

	PR c++/93345 - ICE with defaulted dtor and template.
	PR c++/33799
	* decl.c (cxx_maybe_build_cleanup): Don't try to set
	throwing_cleanup in a template.
parent 648796da
2020-01-23 Jason Merrill <jason@redhat.com>
PR c++/93345 - ICE with defaulted dtor and template.
PR c++/33799
* decl.c (cxx_maybe_build_cleanup): Don't try to set
throwing_cleanup in a template.
2020-01-22 Marek Polacek <polacek@redhat.com> 2020-01-22 Marek Polacek <polacek@redhat.com>
PR c++/92907 - noexcept does not consider "const" in member functions. PR c++/92907 - noexcept does not consider "const" in member functions.
......
...@@ -17393,7 +17393,8 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) ...@@ -17393,7 +17393,8 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
&& !mark_used (decl, complain) && !(complain & tf_error)) && !mark_used (decl, complain) && !(complain & tf_error))
return error_mark_node; return error_mark_node;
if (cleanup && cfun && !expr_noexcept_p (cleanup, tf_none)) if (cleanup && cfun && !processing_template_decl
&& !expr_noexcept_p (cleanup, tf_none))
cp_function_chain->throwing_cleanup = true; cp_function_chain->throwing_cleanup = true;
return cleanup; return cleanup;
......
// PR c++/93345
// { dg-do compile { target c++11 } }
struct ln {
~ln ();
};
struct ry {
ln kj;
};
template<typename GC>
void
dz ()
{
ry{};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment