diff options
author | Jason Merrill <jason@redhat.com> | 2014-05-09 14:16:11 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-05-09 14:16:11 -0400 |
commit | bfa589517b23a771d285e1a0e7cb701b46c63d95 (patch) | |
tree | ec10a8dff78e6dd992fcb2016cbabaaa607ad38c /gcc/cp | |
parent | fc2bfea1399d51ab99516266948a40de92b14a0c (diff) | |
download | gcc-bfa589517b23a771d285e1a0e7cb701b46c63d95.zip gcc-bfa589517b23a771d285e1a0e7cb701b46c63d95.tar.gz gcc-bfa589517b23a771d285e1a0e7cb701b46c63d95.tar.bz2 |
DR 5 PR c++/60019
DR 5
PR c++/60019
* call.c (build_user_type_conversion_1): The copy-init temporary
is cv-unqualified.
From-SVN: r210284
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b13bd99..ab3a3f4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2014-05-09 Jason Merrill <jason@redhat.com> + DR 5 + PR c++/60019 + * call.c (build_user_type_conversion_1): The copy-init temporary + is cv-unqualified. + PR c++/58714 * tree.c (stabilize_expr): A stabilized prvalue is an xvalue. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index cff7ef3..187fc77 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3693,11 +3693,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) |