Commit fdf565de by Jason Merrill Committed by Jason Merrill

decl.c (cp_finish_decl): Check for invalid multiple initializers even if the…

decl.c (cp_finish_decl): Check for invalid multiple initializers even if the initializer is dependent.

	* decl.c (cp_finish_decl): Check for invalid multiple initializers
	even if the initializer is dependent.

From-SVN: r190826
parent 429f8106
2012-08-30 Jason Merrill <jason@redhat.com> 2012-08-30 Jason Merrill <jason@redhat.com>
* decl.c (cp_finish_decl): Check for invalid multiple initializers
even if the initializer is dependent.
* pt.c (instantiate_template_1): Keep processing_template_decl set * pt.c (instantiate_template_1): Keep processing_template_decl set
if there are dependent args. if there are dependent args.
......
...@@ -6123,8 +6123,15 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, ...@@ -6123,8 +6123,15 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
release_tree_vector (cleanups); release_tree_vector (cleanups);
} }
else if (!DECL_PRETTY_FUNCTION_P (decl)) else if (!DECL_PRETTY_FUNCTION_P (decl))
/* Deduce array size even if the initializer is dependent. */ {
maybe_deduce_size_from_array_init (decl, init); /* Deduce array size even if the initializer is dependent. */
maybe_deduce_size_from_array_init (decl, init);
/* And complain about multiple initializers. */
if (init && TREE_CODE (init) == TREE_LIST && TREE_CHAIN (init)
&& !MAYBE_CLASS_TYPE_P (type))
init = build_x_compound_expr_from_list (init, ELK_INIT,
tf_warning_or_error);
}
if (init) if (init)
DECL_INITIAL (decl) = init; DECL_INITIAL (decl) = init;
......
...@@ -7,4 +7,4 @@ template <int> struct A ...@@ -7,4 +7,4 @@ template <int> struct A
}; };
template <int N> const int A<N>::i1(A<N>::i); template <int N> const int A<N>::i1(A<N>::i);
template <int N> const int A<N>::i2(3, A<N>::i); template <int N> const int A<N>::i2(3, A<N>::i); // { dg-error "expression list" }
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