summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-01 22:44:35 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-01 22:44:35 +0000
commit96c42edf6f3b6f45cc0662ca2cdbf069ceb16736 (patch)
tree8535c3bcfdf6cc6350aaef2bd598bcf81c004680 /gcc/cp
parentc4d7c2ba245f3ec5ce0bb74ec1bdbbd4e1765b0d (diff)
downloadgcc-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')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ac3f4d71f2e..1a522e7a979 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2011-03-01 Jason Merrill <jason@redhat.com>
+ PR c++/47851
+ * call.c (standard_conversion): Provide requested cv-quals on
+ class rvalue conversion.
+
PR c++/46282
* decl2.c (grokbitfield): Handle type-dependent width.
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