Commit f05f61fd by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_decl): Handle DECL_VALUE_EXPR on reference.

	* pt.c (tsubst_decl): Handle DECL_VALUE_EXPR on reference.
	* decl.c (check_initializer): Handle DECL_VALUE_EXPR_P.

From-SVN: r175153
parent 2516ccfe
2011-06-17 Jason Merrill <jason@redhat.com> 2011-06-17 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_decl): Handle DECL_VALUE_EXPR on reference.
* decl.c (check_initializer): Handle DECL_VALUE_EXPR_P.
* semantics.c (finish_non_static_data_member): Preserve dereference * semantics.c (finish_non_static_data_member): Preserve dereference
in template. in template.
......
...@@ -5387,6 +5387,14 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) ...@@ -5387,6 +5387,14 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
type. */ type. */
TREE_TYPE (decl) = type = complete_type (TREE_TYPE (decl)); TREE_TYPE (decl) = type = complete_type (TREE_TYPE (decl));
if (DECL_HAS_VALUE_EXPR_P (decl))
{
/* A variable with DECL_HAS_VALUE_EXPR_P set is just a placeholder,
it doesn't have storage to be initialized. */
gcc_assert (init == NULL_TREE);
return NULL_TREE;
}
if (type == error_mark_node) if (type == error_mark_node)
/* We will have already complained. */ /* We will have already complained. */
return NULL_TREE; return NULL_TREE;
......
...@@ -10061,6 +10061,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -10061,6 +10061,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
tree ve = DECL_VALUE_EXPR (t); tree ve = DECL_VALUE_EXPR (t);
ve = tsubst_expr (ve, args, complain, in_decl, ve = tsubst_expr (ve, args, complain, in_decl,
/*constant_expression_p=*/false); /*constant_expression_p=*/false);
if (REFERENCE_REF_P (ve))
{
gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
ve = TREE_OPERAND (ve, 0);
}
SET_DECL_VALUE_EXPR (r, ve); SET_DECL_VALUE_EXPR (r, ve);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment