summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3c41c9a2585..c2458abfe86 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,8 +1,8 @@
2004-01-16 Mark Mitchell <mark@codesourcery.com>
PR c++/13478
- * call.c (convert_like_real): Do not perform an additional
- direct-initialization when binding to a reference.
+ * call.c (initialize_reference): Pass -1 for inner parameter to
+ convert_like_real.
2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 74878fd5cdc..aaf902ceed6 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4068,7 +4068,8 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner,
conversion, but is not considered during overload resolution.
If the target is a class, that means call a ctor. */
- if (IS_AGGR_TYPE (totype) && inner >= 0)
+ if (IS_AGGR_TYPE (totype)
+ && (inner >= 0 || !lvalue_p (expr)))
{
expr = (build_temp
(expr, totype,
@@ -6250,7 +6251,10 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
else
base_conv_type = NULL_TREE;
/* Perform the remainder of the conversion. */
- expr = convert_like (conv, expr);
+ expr = convert_like_real (conv, expr,
+ /*fn=*/NULL_TREE, /*argnum=*/0,
+ /*inner=*/-1,
+ /*issue_conversion_warnings=*/true);
if (!real_lvalue_p (expr))
{
tree init;
OpenPOWER on IntegriCloud