Message ID | CAEwic4YAhWSbWS21=NGA8ymQB=UGU90VaexmeDgdZScsk_9xTA@mail.gmail.com |
---|---|
State | New |
Headers | show |
Hi, On 12/12/2014 08:45 PM, Kai Tietz wrote: > #include <cctype> > #include <algorithm> I would recommend reducing the testcase further, <algorithm> is very large. Thanks, Paolo.
I think it would be better to call maybe_instantiate_noexcept so that we can have a definite answer. Jason
2014-12-12 21:15 GMT+01:00 Jason Merrill <jason@redhat.com>: > I think it would be better to call maybe_instantiate_noexcept so that we can > have a definite answer. > > Jason Hmm, for case that decl != NULL_TREE, this is ok. But what if decl is NULL_TREE? Kai
On 12/12/2014 03:58 PM, Kai Tietz wrote: > 2014-12-12 21:15 GMT+01:00 Jason Merrill <jason@redhat.com>: >> I think it would be better to call maybe_instantiate_noexcept so that we can >> have a definite answer. >> >> Jason > > Hmm, for case that decl != NULL_TREE, this is ok. But what if decl is > NULL_TREE? We shouldn't have a deferred noexcept in that case. Jason
Index: call.c =================================================================== --- call.c (Revision 218681) +++ call.c (Arbeitskopie) @@ -335,11 +335,17 @@ set_flags_from_callee (tree call) { int nothrow; tree decl = get_callee_fndecl (call); + tree spec; /* We check both the decl and the type; a function may be known not to throw without being declared throw(). */ - nothrow = ((decl && TREE_NOTHROW (decl)) - || TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (call))))); + nothrow = (decl && TREE_NOTHROW (decl)); + if (!nothrow) + { + spec = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (call))); + nothrow = (!DEFERRED_NOEXCEPT_SPEC_P (TYPE_RAISES_EXCEPTIONS (spec)) + && TYPE_NOTHROW_P (spec)); + } if (!nothrow && at_function_scope_p () && cfun && cp_function_chain) cp_function_chain->can_throw = 1;