aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-09-06 18:38:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-09-06 18:38:49 +0000
commita125de0cbf0106312c61b65872eec96a9f28f5d4 (patch)
tree285b9d3567dee4c834ac3ad4c250a9fe0f90759f /gcc/cp
parent566dfd713db9d71de2e1ff4ee176df4aacda7e6f (diff)
downloadgcc-a125de0cbf0106312c61b65872eec96a9f28f5d4.zip
gcc-a125de0cbf0106312c61b65872eec96a9f28f5d4.tar.gz
gcc-a125de0cbf0106312c61b65872eec96a9f28f5d4.tar.bz2
re PR c++/32674 (ICE in lvalue_p_1 initialising static variable inside template class)
/cp 2007-09-06 Paolo Carlini <pcarlini@suse.de> PR c++/32674 * decl.c (cp_finish_decl): When processing_template_decl, deal correctly with init as TREE_LIST. /testsuite 2007-09-06 Paolo Carlini <pcarlini@suse.de> PR c++/32674 * g++.dg/template/static31.C: New. From-SVN: r128201
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c16
2 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index db8b3eb..2c3533d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-06 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/32674
+ * decl.c (cp_finish_decl): When processing_template_decl,
+ deal correctly with init as TREE_LIST.
+
2007-09-06 Tom Tromey <tromey@redhat.com>
* decl.c (finish_function): Put return's location on line zero of
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 86f2a4a..271b8e6 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5333,7 +5333,21 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
goto finish_end;
}
- init = fold_non_dependent_expr (init);
+ if (TREE_CODE (init) == TREE_LIST)
+ {
+ /* If the parenthesized-initializer form was used (e.g.,
+ "int A<N>::i(X)"), then INIT will be a TREE_LIST of initializer
+ arguments. (There is generally only one.) We convert them
+ individually. */
+ tree list = init;
+ for (; list; list = TREE_CHAIN (list))
+ {
+ tree elt = TREE_VALUE (list);
+ TREE_VALUE (list) = fold_non_dependent_expr (elt);
+ }
+ }
+ else
+ init = fold_non_dependent_expr (init);
processing_template_decl = 0;
}