From d0cf395a999499cfdc785cdb920bfdf401a628aa Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Jul 2016 16:25:31 -0400 Subject: P0145: Refining Expression Order for C++ (-fstrong-eval-order). gcc/c-family/ * c.opts (-fargs-in-order): Rename to -fstrong-eval-order. * c-opts.c: Adjust. gcc/cp/ * call.c (op_is_ordered, build_over_call): Adjust for -fargs-in-order renaming to -fstrong-eval-order. * cp-gimplify.c (cp_gimplify_expr): Likewise. From-SVN: r238176 --- gcc/cp/call.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d77092b..8b93c61 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5378,14 +5378,15 @@ add_candidates (tree fns, tree first_arg, const vec *args, static int op_is_ordered (tree_code code) { - if (!flag_args_in_order) - return 0; - switch (code) { // 5. b @= a case MODIFY_EXPR: - return -1; + return (flag_strong_eval_order > 1 ? -1 : 0); + + // 6. a[b] + case ARRAY_REF: + return (flag_strong_eval_order > 1 ? 1 : 0); // 1. a.b // Not overloadable (yet). @@ -5393,13 +5394,11 @@ op_is_ordered (tree_code code) // Only one argument. // 3. a->*b case MEMBER_REF: - // 6. a[b] - case ARRAY_REF: // 7. a << b case LSHIFT_EXPR: // 8. a >> b case RSHIFT_EXPR: - return 1; + return (flag_strong_eval_order ? 1 : 0); default: return 0; @@ -7830,9 +7829,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) tree call = build_cxx_call (fn, nargs, argarray, complain|decltype_flag); if (call != error_mark_node - && !magic - && (flag_args_in_order > 1 - || (cand->flags & LOOKUP_LIST_INIT_CTOR))) + && cand->flags & LOOKUP_LIST_INIT_CTOR) { tree c = extract_call_expr (call); /* build_new_op_1 will clear this when appropriate. */ -- cgit v1.1