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.
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;
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)
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);
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);
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;
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);
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)
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)