building RTL. These routines are used both during actual parsing
and during the instantiation of template functions.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
{
tree deferred_check;
- for (deferred_check = (VEC_last (deferred_access, deferred_access_stack)
- ->deferred_access_checks);
+ for (deferred_check = get_deferred_access_checks ();
deferred_check;
deferred_check = TREE_CHAIN (deferred_check))
/* Check access. */
scope = do_pushlevel (sk_block);
TREE_CHAIN (r) = scope;
- begin_cond (&SWITCH_COND (r));
+ begin_cond (&SWITCH_STMT_COND (r));
return r;
}
cond = index;
}
}
- finish_cond (&SWITCH_COND (switch_stmt), cond);
- SWITCH_TYPE (switch_stmt) = orig_type;
+ finish_cond (&SWITCH_STMT_COND (switch_stmt), cond);
+ SWITCH_STMT_TYPE (switch_stmt) = orig_type;
add_stmt (switch_stmt);
push_switch (switch_stmt);
- SWITCH_BODY (switch_stmt) = push_stmt_list ();
+ SWITCH_STMT_BODY (switch_stmt) = push_stmt_list ();
}
/* Finish the body of a switch-statement, which may be given by
{
tree scope;
- SWITCH_BODY (switch_stmt) = pop_stmt_list (SWITCH_BODY (switch_stmt));
+ SWITCH_STMT_BODY (switch_stmt) =
+ pop_stmt_list (SWITCH_STMT_BODY (switch_stmt));
pop_switch ();
finish_stmt ();
&& TREE_CODE (result) == INTEGER_CST
&& !TYPE_UNSIGNED (TREE_TYPE (result))
&& INT_CST_LT (result, integer_zero_node))
- TREE_NEGATED_INT (result) = 1;
+ {
+ /* RESULT may be a cached INTEGER_CST, so we must copy it before
+ setting TREE_NEGATED_INT. */
+ result = copy_node (result);
+ TREE_NEGATED_INT (result) = 1;
+ }
overflow_warning (result);
return result;
}
need. */
if (TREE_CODE (id_expression) == TEMPLATE_ID_EXPR)
return id_expression;
- /* Since this name was dependent, the expression isn't
- constant -- yet. No error is issued because it might be
- constant when things are instantiated. */
- if (integral_constant_expression_p)
- *non_integral_constant_expression_p = true;
*idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
/* If we found a variable, then name lookup during the
instantiation will always resolve to the same VAR_DECL
/* The same is true for FIELD_DECL, but we also need to
make sure that the syntax is correct. */
else if (TREE_CODE (decl) == FIELD_DECL)
- return finish_non_static_data_member
- (decl, current_class_ref,
- /*qualifying_scope=*/NULL_TREE);
+ {
+ /* Since SCOPE is NULL here, this is an unqualified name.
+ Access checking has been performed during name lookup
+ already. Turn off checking to avoid duplicate errors. */
+ push_deferring_access_checks (dk_no_check);
+ decl = finish_non_static_data_member
+ (decl, current_class_ref,
+ /*qualifying_scope=*/NULL_TREE);
+ pop_deferring_access_checks ();
+ return decl;
+ }
return id_expression;
}
expression. Enumerators and template parameters have already
been handled above. */
if (integral_constant_expression_p
- && !DECL_INTEGRAL_CONSTANT_VAR_P (decl))
+ && ! DECL_INTEGRAL_CONSTANT_VAR_P (decl)
+ && ! builtin_valid_in_constant_expr_p (decl))
{
if (!allow_non_integral_constant_expression_p)
{
}
}
else if (TREE_CODE (decl) == FIELD_DECL)
- decl = finish_non_static_data_member (decl, current_class_ref,
- /*qualifying_scope=*/NULL_TREE);
+ {
+ /* Since SCOPE is NULL here, this is an unqualified name.
+ Access checking has been performed during name lookup
+ already. Turn off checking to avoid duplicate errors. */
+ push_deferring_access_checks (dk_no_check);
+ decl = finish_non_static_data_member (decl, current_class_ref,
+ /*qualifying_scope=*/NULL_TREE);
+ pop_deferring_access_checks ();
+ }
else if (is_overloaded_fn (decl))
{
tree first_fn = OVL_CURRENT (decl);