Commit fd5b5108 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/29570 (ICE with brace-enclosed initializer)

	PR c++/29570
	* decl.c (cp_finish_decl): Check for value dependent brace enclosed
	scalar initializer.

	* g++.dg/template/static29.C: New test.

From-SVN: r119045
parent 4576ceaf
2006-11-21 Jakub Jelinek <jakub@redhat.com>
PR c++/29570
* decl.c (cp_finish_decl): Check for value dependent brace enclosed
scalar initializer.
PR c++/29734
* cp-tree.h (WANT_VECTOR): Define.
(WANT_ARITH): Add WANT_VECTOR.
......
......@@ -5058,7 +5058,14 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
|| !DECL_CLASS_SCOPE_P (decl)
|| !DECL_INTEGRAL_CONSTANT_VAR_P (decl)
|| type_dependent_p
|| value_dependent_expression_p (init))
|| value_dependent_expression_p (init)
/* Check also if initializer is a value dependent
{ integral_constant_expression }. */
|| (TREE_CODE (init) == CONSTRUCTOR
&& VEC_length (constructor_elt, CONSTRUCTOR_ELTS (init)) == 1
&& value_dependent_expression_p
(VEC_index (constructor_elt,
CONSTRUCTOR_ELTS (init), 0)->value)))
{
if (init)
DECL_INITIAL (decl) = init;
......
2006-11-21 Jakub Jelinek <jakub@redhat.com>
PR c++/29570
* g++.dg/template/static29.C: New test.
PR c++/29734
* g++.dg/conversion/simd4.C: New test.
// PR c++/29570
template<int> struct A { static const int i; };
template<int N> const int A<N>::i = { A<N>::i };
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