diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d70b1a1..f7253d5 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4707,10 +4707,22 @@ build_over_call (struct z_candidate *cand, int flags) else fn = build_addr_func (fn); + return build_cxx_call (fn, args, converted_args); +} + +/* Build and return a call to FN, using the the CONVERTED_ARGS. ARGS + gives the original form of the arguments. This function performs + no overload resolution, conversion, or other high-level + operations. */ + +tree +build_cxx_call(tree fn, tree args, tree converted_args) +{ + tree fndecl; + /* Recognize certain built-in functions so we can make tree-codes other than CALL_EXPR. We do this when it enables fold-const.c to do something useful. */ - if (TREE_CODE (fn) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL && DECL_BUILT_IN (TREE_OPERAND (fn, 0))) @@ -4721,14 +4733,24 @@ build_over_call (struct z_candidate *cand, int flags) return exp; } - /* Some built-in function calls will be evaluated at - compile-time in fold (). */ - fn = fold (build_call (fn, converted_args)); + fn = build_call (fn, converted_args); + + /* If this call might throw an exception, note that fact. */ + fndecl = get_callee_fndecl (fn); + if ((!fndecl || !TREE_NOTHROW (fndecl)) && at_function_scope_p ()) + cp_function_chain->can_throw = 1; + + /* Some built-in function calls will be evaluated at compile-time in + fold (). */ + fn = fold (fn); + if (VOID_TYPE_P (TREE_TYPE (fn))) return fn; + fn = require_complete_type (fn); if (fn == error_mark_node) return error_mark_node; + if (IS_AGGR_TYPE (TREE_TYPE (fn))) fn = build_cplus_new (TREE_TYPE (fn), fn); return convert_from_reference (fn); |