Commit a125de0c by Paolo Carlini Committed by Paolo Carlini

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
parent 566dfd71
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
......
......@@ -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;
}
......
2007-09-06 Paolo Carlini <pcarlini@suse.de>
PR c++/32674
* g++.dg/template/static31.C: New.
2007-09-06 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33271
// PR c++/32674
class C
{
static const int j = 3;
};
template<int> class A
{
static const int i1;
static const int i2;
static const int i3;
static const int i4;
};
template<int N> const int A<N>::i1(C::j);
template<int N> const int A<N>::i2 = C::j;
template<int N> const int A<N>::i3(C::j, 5); // { dg-error "compound expression" }
template<int N> const int A<N>::i4 = (C::j, 7);
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