summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-28 05:17:14 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-28 05:17:14 +0000
commit9bfe0f4ab82908cb0373a22c72516d3579726792 (patch)
tree7dd36dec39291468ce49f6128a24f9fb8a5593fa /gcc/cp/call.c
parent0b755accc08bd537efa646026020b79888be0cb4 (diff)
downloadgcc-9bfe0f4ab82908cb0373a22c72516d3579726792.tar.gz
PR c++/17435
* call.c (convert_like_real): Fix formatting. (initialize_reference): When binding a temporary to a base class, ensure that the nominal copy made is to the derived class, not the base class. PR c++/18140 * parser.c (cp_parser_next_token_ends_template_argument_p): Do not include ">>". PR c++/17435 * g++.dg/init/ref12.C: New test. PR c++/18140 * g++.dg/template/shift1.C: New test. * g++.dg/template/error10.C: Adjust error markers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89738 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index aedc9278b9d..9ff5b7ca3b1 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4239,7 +4239,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
expr = decl_constant_value (expr);
if (convs->check_copy_constructor_p)
check_constructor_callable (totype, expr);
- return expr;
+ return expr;
case ck_ambig:
/* Call build_user_type_conversion again for the error. */
return build_user_type_conversion
@@ -6467,7 +6467,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
conv = conv->u.next;
/* If the next conversion is a BASE_CONV, skip that too -- but
remember that the conversion was required. */
- if (conv->kind == ck_base && conv->need_temporary_p)
+ if (conv->kind == ck_base)
{
if (conv->check_copy_constructor_p)
check_constructor_callable (TREE_TYPE (expr), expr);
@@ -6537,6 +6537,11 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup)
}
/* Use its address to initialize the reference variable. */
expr = build_address (var);
+ if (base_conv_type)
+ expr = convert_to_base (expr,
+ build_pointer_type (base_conv_type),
+ /*check_access=*/true,
+ /*nonnull=*/true);
expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
}
else