extern bool any_type_dependent_arguments_p (const vec<tree, va_gc> *);
extern bool any_type_dependent_elements_p (const_tree);
extern bool type_dependent_expression_p_push (tree);
-extern bool value_dependent_expression_p (tree);
+extern bool value_dependent_expression_p (tree, bool = false);
extern bool instantiation_dependent_expression_p (tree);
extern bool instantiation_dependent_uneval_expression_p (tree);
extern bool any_value_dependent_elements_p (const_tree);
can be tested for value dependence. */
bool
-value_dependent_expression_p (tree expression)
+value_dependent_expression_p (tree expression, bool lval /* = false */)
{
if (!processing_template_decl || expression == NULL_TREE)
return false;
/* A non-type template parm. */
if (DECL_TEMPLATE_PARM_P (expression))
return true;
+ gcc_checking_assert (!lval);
return value_dependent_expression_p (DECL_INITIAL (expression));
case VAR_DECL:
Note that a non-dependent parenthesized initializer will have
already been replaced with its constant value, so if we see
a TREE_LIST it must be dependent. */
- if (DECL_INITIAL (expression)
+ if (!lval
+ && DECL_INITIAL (expression)
&& decl_constant_var_p (expression)
&& (TREE_CODE (DECL_INITIAL (expression)) == TREE_LIST
/* cp_finish_decl doesn't fold reference initializers. */
if (DECL_HAS_VALUE_EXPR_P (expression))
{
tree value_expr = DECL_VALUE_EXPR (expression);
- if (value_dependent_expression_p (value_expr))
+ if (value_dependent_expression_p (value_expr, lval))
return true;
}
return false;
if (TREE_CODE (expression) == TREE_LIST)
return any_value_dependent_elements_p (expression);
- return value_dependent_expression_p (expression);
+ return value_dependent_expression_p (expression, lval);
}
case SIZEOF_EXPR:
return instantiation_dependent_scope_ref_p (expression);
case COMPONENT_REF:
- return (value_dependent_expression_p (TREE_OPERAND (expression, 0))
+ return (value_dependent_expression_p (TREE_OPERAND (expression, 0), lval)
|| value_dependent_expression_p (TREE_OPERAND (expression, 1)));
case NONTYPE_ARGUMENT_PACK:
case ADDR_EXPR:
{
tree op = TREE_OPERAND (expression, 0);
- return (value_dependent_expression_p (op)
+ return (value_dependent_expression_p (op, true)
|| has_value_dependent_address (op));
}