aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-10-08 12:23:26 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-10-08 12:23:26 -0400
commit36cbfdb06604b63e743d3644fdec7dd20d7c0843 (patch)
treeaf475d0e794d94b605e4e12b2a7ae82b9d1972cd /gcc/cp/cvt.c
parent80994c4654c32987e32430121e442df861226966 (diff)
downloadgcc-36cbfdb06604b63e743d3644fdec7dd20d7c0843.zip
gcc-36cbfdb06604b63e743d3644fdec7dd20d7c0843.tar.gz
gcc-36cbfdb06604b63e743d3644fdec7dd20d7c0843.tar.bz2
Further P0135 refinement.
* call.c (build_user_type_conversion_1): Consider conversions from a single element in an initializer-list. (build_temp): Undo early_elide_copy change. (build_over_call): Check that we don't try to copy a TARGET_EXPR in C++17 mode. Set user_conv_p here. (convert_like_real): Not here. (check_self_delegation): Split out from... (build_special_member_call): ...here. Handle C++17 copy elision. * cvt.c (early_elide_copy): Remove. (ocp_convert): Undo early_elide_copy change. * except.c (build_throw): Likewise. * init.c (expand_default_init): Likewise. * typeck.c (cp_build_modify_expr): Likewise. From-SVN: r240889
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 063457f..2f5f15a 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -658,27 +658,6 @@ cp_convert_and_check (tree type, tree expr, tsubst_flags_t complain)
return result;
}
-/* Returns true if we should avoid even doing overload resolution for copying
- EXPR to initialize a TYPE. */
-
-bool
-early_elide_copy (tree type, tree expr)
-{
- if (TREE_CODE (expr) != TARGET_EXPR)
- return false;
- /* List-initialization and direct-initialization don't involve a copy. */
- if (TARGET_EXPR_LIST_INIT_P (expr)
- || TARGET_EXPR_DIRECT_INIT_P (expr))
- return true;
- /* In C++17, "If the initializer expression is a prvalue and the
- cv-unqualified version of the source type is the same class as the class
- of the destination, the initializer expression is used to initialize the
- destination object." */
- return (cxx_dialect >= cxx1z
- && (same_type_ignoring_top_level_qualifiers_p
- (type, TREE_TYPE (expr))));
-}
-
/* Conversion...
FLAGS indicates how we should behave. */
@@ -714,8 +693,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
if (error_operand_p (e))
return error_mark_node;
- if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP)
- && !early_elide_copy (type, e))
+ if (MAYBE_CLASS_TYPE_P (type) && (convtype & CONV_FORCE_TEMP))
/* We need a new temporary; don't take this shortcut. */;
else if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (e)))
{