diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-01 22:44:35 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-01 22:44:35 +0000 |
commit | 96c42edf6f3b6f45cc0662ca2cdbf069ceb16736 (patch) | |
tree | 8535c3bcfdf6cc6350aaef2bd598bcf81c004680 /gcc/cp/call.c | |
parent | c4d7c2ba245f3ec5ce0bb74ec1bdbbd4e1765b0d (diff) | |
download | gcc-96c42edf6f3b6f45cc0662ca2cdbf069ceb16736.tar.gz |
PR c++/47851
* call.c (standard_conversion): Provide requested cv-quals on
class rvalue conversion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 8dccbbef412..a297f5313e3 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -850,6 +850,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, enum tree_code fcode, tcode; conversion *conv; bool fromref = false; + tree qualified_to; to = non_reference (to); if (TREE_CODE (from) == REFERENCE_TYPE) @@ -857,6 +858,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, fromref = true; from = TREE_TYPE (from); } + qualified_to = to; to = strip_top_quals (to); from = strip_top_quals (from); @@ -918,7 +920,11 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, } if (same_type_p (from, to)) - return conv; + { + if (CLASS_TYPE_P (to) && conv->kind == ck_rvalue) + conv->type = qualified_to; + return conv; + } /* [conv.ptr] A null pointer constant can be converted to a pointer type; ... A |