diff options
author | Jason Merrill <jason@redhat.com> | 2012-08-30 22:49:42 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-08-30 22:49:42 -0400 |
commit | fdf565deae60707c7484c3d9226ff2ca5622b263 (patch) | |
tree | be5639ad1b8c19fb937e2d7bf7a4504ed26ce341 /gcc/cp | |
parent | 429f8106ec2d96dae1bef20302e99237b5aa37cf (diff) | |
download | gcc-fdf565deae60707c7484c3d9226ff2ca5622b263.zip gcc-fdf565deae60707c7484c3d9226ff2ca5622b263.tar.gz gcc-fdf565deae60707c7484c3d9226ff2ca5622b263.tar.bz2 |
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
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl.c | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2eca678..1baeaf1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 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 if there are dependent args. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4b2958c..19485fc 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6123,8 +6123,15 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, release_tree_vector (cleanups); } 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) DECL_INITIAL (decl) = init; |