aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-09-12 14:04:39 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-09-12 14:04:39 -0400
commite495f6b0c06db941cd213941fe659127eedb13b1 (patch)
treef960a2c3ff3a52f0c1bf0c21ceb10130dcedaa70
parentdbbc379eaa586bae7a5f374fb6e294810af2ae80 (diff)
downloadgcc-e495f6b0c06db941cd213941fe659127eedb13b1.zip
gcc-e495f6b0c06db941cd213941fe659127eedb13b1.tar.gz
gcc-e495f6b0c06db941cd213941fe659127eedb13b1.tar.bz2
call.c (initialize_reference): Add flags parm.
* call.c (initialize_reference): Add flags parm. * decl.c (grok_reference_init): Likewise. (check_initializer): Pass it. * typeck.c (convert_for_initialization): Likewise. * cp-tree.h: Adjust. From-SVN: r178788
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl.c10
-rw-r--r--gcc/cp/typeck.c2
5 files changed, 17 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c72d9d0..476173d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2011-09-12 Jason Merrill <jason@redhat.com>
+ * call.c (initialize_reference): Add flags parm.
+ * decl.c (grok_reference_init): Likewise.
+ (check_initializer): Pass it.
+ * typeck.c (convert_for_initialization): Likewise.
+ * cp-tree.h: Adjust.
+
* cp-tree.h (LOOKUP_NO_RVAL_BIND): New.
* call.c (conditional_conversion): Use it.
(reference_binding): Fix handling of xvalues.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 81c8a90..7912fad 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8717,7 +8717,7 @@ set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
tree
initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
- tsubst_flags_t complain)
+ int flags, tsubst_flags_t complain)
{
conversion *conv;
void *p;
@@ -8729,7 +8729,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup,
p = conversion_obstack_alloc (0);
conv = reference_binding (type, TREE_TYPE (expr), expr, /*c_cast_p=*/false,
- LOOKUP_NORMAL);
+ flags);
if (!conv || conv->bad_p)
{
if (complain & tf_error)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 06572fd..12a2895 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4757,7 +4757,8 @@ extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree);
extern bool is_properly_derived_from (tree, tree);
extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *);
-extern tree initialize_reference (tree, tree, tree, tree *, tsubst_flags_t);
+extern tree initialize_reference (tree, tree, tree, tree *, int,
+ tsubst_flags_t);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals (tree);
extern bool reference_related_p (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a68bcb1240..dc49eb2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -71,7 +71,7 @@ static void require_complete_types_for_parms (tree);
static int ambi_op_p (enum tree_code);
static int unary_op_p (enum tree_code);
static void push_local_name (tree);
-static tree grok_reference_init (tree, tree, tree, tree *);
+static tree grok_reference_init (tree, tree, tree, tree *, int);
static tree grokvardecl (tree, tree, const cp_decl_specifier_seq *,
int, int, tree);
static int check_static_variable_definition (tree, tree);
@@ -4574,7 +4574,8 @@ start_decl_1 (tree decl, bool initialized)
Quotes on semantics can be found in ARM 8.4.3. */
static tree
-grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
+grok_reference_init (tree decl, tree type, tree init, tree *cleanup,
+ int flags)
{
tree tmp;
@@ -4603,7 +4604,8 @@ grok_reference_init (tree decl, tree type, tree init, tree *cleanup)
DECL_INITIAL for local references (instead assigning to them
explicitly); we need to allow the temporary to be initialized
first. */
- tmp = initialize_reference (type, init, decl, cleanup, tf_warning_or_error);
+ tmp = initialize_reference (type, init, decl, cleanup, flags,
+ tf_warning_or_error);
if (DECL_DECLARED_CONSTEXPR_P (decl))
{
tmp = cxx_constant_value (tmp);
@@ -5468,7 +5470,7 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
else if (!init && DECL_REALLY_EXTERN (decl))
;
else if (TREE_CODE (type) == REFERENCE_TYPE)
- init = grok_reference_init (decl, type, init, cleanup);
+ init = grok_reference_init (decl, type, init, cleanup, flags);
else if (init || type_build_ctor_call (type))
{
if (!init)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9db0ce3..ed52f3c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -7510,7 +7510,7 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags,
if (fndecl)
savew = warningcount, savee = errorcount;
rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE,
- /*cleanup=*/NULL, complain);
+ /*cleanup=*/NULL, flags, complain);
if (fndecl)
{
if (warningcount > savew)