aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-09-06 00:49:24 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-09-06 00:49:24 -0400
commitbe2b93e68af97a17f24c8f0a5695118502f1a71b (patch)
tree7c7fc0a342e773a5d83a478827c6c0b4533c1432 /gcc/cp
parent40013af7ea17608041127687c5bc0622cc87af73 (diff)
downloadgcc-be2b93e68af97a17f24c8f0a5695118502f1a71b.zip
gcc-be2b93e68af97a17f24c8f0a5695118502f1a71b.tar.gz
gcc-be2b93e68af97a17f24c8f0a5695118502f1a71b.tar.bz2
* decl.c (cp_finish_decl): Don't change init for auto deduction.
From-SVN: r163896
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/decl.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9fe9ef0..58bcab4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,7 @@
2010-09-06 Jason Merrill <jason@redhat.com>
+ * decl.c (cp_finish_decl): Don't change init for auto deduction.
+
* pt.c (fold_non_dependent_expr_sfinae): Split out from...
(fold_non_dependent_expr): ...here.
(convert_nontype_argument): Use it. Take complain parm.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 75fd9f7..409836c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5681,18 +5681,21 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
auto_node = type_uses_auto (type);
if (auto_node)
{
+ tree d_init;
if (init == NULL_TREE)
{
error ("declaration of %q#D has no initializer", decl);
TREE_TYPE (decl) = error_mark_node;
return;
}
- if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init, ELK_INIT,
- tf_warning_or_error);
- if (describable_type (init))
+ d_init = init;
+ if (TREE_CODE (d_init) == TREE_LIST)
+ d_init = build_x_compound_expr_from_list (d_init, ELK_INIT,
+ tf_warning_or_error);
+ if (describable_type (d_init))
{
- type = TREE_TYPE (decl) = do_auto_deduction (type, init, auto_node);
+ type = TREE_TYPE (decl) = do_auto_deduction (type, d_init,
+ auto_node);
if (type == error_mark_node)
return;
}