diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/call.c | 17 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 5 |
3 files changed, 16 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 12f15db..13f80f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2016-07-08 Jason Merrill <jason@redhat.com> + + P0145R2: Refining Expression Order for C++. + * 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. + 2016-07-07 Jakub Jelinek <jakub@redhat.com> Kai Tietz <ktietz70@googlemail.com> 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<tree, va_gc> *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. */ diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 1d81fb1..c04368f 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -780,11 +780,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) ret = GS_ERROR; } } - else if (flag_args_in_order == 1 + else if (flag_strong_eval_order && !CALL_EXPR_OPERATOR_SYNTAX (*expr_p)) { - /* If flag_args_in_order == 1, we don't force an order on all - function arguments, but do evaluate the object argument first. */ + /* If flag_strong_eval_order, evaluate the object argument first. */ tree fntype = TREE_TYPE (CALL_EXPR_FN (*expr_p)); if (POINTER_TYPE_P (fntype)) fntype = TREE_TYPE (fntype); |