diff options
author | Jason Merrill <jason@redhat.com> | 2016-11-17 17:40:28 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-11-17 17:40:28 -0500 |
commit | c2f2350e9b99f92cdda476830c1059152077999d (patch) | |
tree | bb5aa58d8df08bd49849105c2b49aa69731d949a /gcc | |
parent | e389ba3073f8cfaa6209c27418ad175234c15482 (diff) | |
download | gcc-c2f2350e9b99f92cdda476830c1059152077999d.zip gcc-c2f2350e9b99f92cdda476830c1059152077999d.tar.gz gcc-c2f2350e9b99f92cdda476830c1059152077999d.tar.bz2 |
PR c++/78193 - inherited ctor regressions on sparc32.
* call.c (build_over_call): Don't set CALL_FROM_THUNK_P here.
(build_call_a): Set it here, and don't insert EMPTY_CLASS_EXPR.
(convert_like_real) [ck_rvalue]: Also pass non-addressable
types along directly.
From-SVN: r242573
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/call.c | 20 |
2 files changed, 18 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3178c1f..afc2c16 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-11-17 Jason Merrill <jason@redhat.com> + + PR c++/78193 - inherited ctor regressions on sparc32. + * call.c (build_over_call): Don't set CALL_FROM_THUNK_P here. + (build_call_a): Set it here, and don't insert EMPTY_CLASS_EXPR. + (convert_like_real) [ck_rvalue]: Also pass non-addressable + types along directly. + 2016-11-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/55080 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index d25e2e7..97003e5 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -375,10 +375,18 @@ build_call_a (tree function, int n, tree *argarray) TREE_HAS_CONSTRUCTOR (function) = (decl && DECL_CONSTRUCTOR_P (decl)); + if (current_function_decl && decl + && flag_new_inheriting_ctors + && DECL_INHERITED_CTOR (current_function_decl) + && (DECL_INHERITED_CTOR (current_function_decl) + == DECL_CLONED_FUNCTION (decl))) + /* Pass arguments directly to the inherited constructor. */ + CALL_FROM_THUNK_P (function) = true; + /* Don't pass empty class objects by value. This is useful for tags in STL, which are used to control overload resolution. We don't need to handle other cases of copying empty classes. */ - if (! decl || ! DECL_BUILT_IN (decl)) + else if (! decl || ! DECL_BUILT_IN (decl)) for (i = 0; i < n; i++) { tree arg = CALL_EXPR_ARG (function, i); @@ -6844,8 +6852,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, constructor. */ if (current_function_decl && flag_new_inheriting_ctors - && DECL_INHERITED_CTOR (current_function_decl) - && TREE_ADDRESSABLE (totype)) + && DECL_INHERITED_CTOR (current_function_decl)) return expr; /* Fall through. */ @@ -8094,13 +8101,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) /* build_new_op_1 will clear this when appropriate. */ CALL_EXPR_ORDERED_ARGS (c) = true; } - if (current_function_decl - && flag_new_inheriting_ctors - && DECL_INHERITED_CTOR (current_function_decl) - && cand->num_convs) - /* Don't introduce copies when passing arguments along to the inherited - constructor. */ - CALL_FROM_THUNK_P (call) = true; return call; } |