aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/cp/call.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/cp/call.c')
-rw-r--r--gcc-4.9/gcc/cp/call.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc-4.9/gcc/cp/call.c b/gcc-4.9/gcc/cp/call.c
index 98469e9e4..57e08cb8e 100644
--- a/gcc-4.9/gcc/cp/call.c
+++ b/gcc-4.9/gcc/cp/call.c
@@ -3677,11 +3677,20 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags,
return cand;
}
+ tree convtype;
+ if (!DECL_CONSTRUCTOR_P (cand->fn))
+ convtype = non_reference (TREE_TYPE (TREE_TYPE (cand->fn)));
+ else if (cand->second_conv->kind == ck_rvalue)
+ /* DR 5: [in the first step of copy-initialization]...if the function
+ is a constructor, the call initializes a temporary of the
+ cv-unqualified version of the destination type. */
+ convtype = cv_unqualified (totype);
+ else
+ convtype = totype;
/* Build the user conversion sequence. */
conv = build_conv
(ck_user,
- (DECL_CONSTRUCTOR_P (cand->fn)
- ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),
+ convtype,
build_identity_conv (TREE_TYPE (expr), expr));
conv->cand = cand;
if (cand->viable == -1)