Commit 6a279e92 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/33553 (Bogus "array bound is not an integer constant" for parameter in…

re PR c++/33553 (Bogus "array bound is not an integer constant" for parameter in template method of template class)

	PR c++/33553
	* pt.c (tsubst) <case INTEGER_TYPE>: Don't issue error if max is
	value dependent expression.

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

From-SVN: r132126
parent def7425b
2008-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/33553
* pt.c (tsubst) <case INTEGER_TYPE>: Don't issue error if max is
value dependent expression.
2008-02-05 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35074
......
......@@ -8894,9 +8894,9 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/*integral_constant_expression_p=*/false);
max = fold_decl_constant_value (max);
if (TREE_CODE (max) != INTEGER_CST
&& TREE_CODE (max) != TEMPLATE_PARM_INDEX
&& !at_function_scope_p ())
if (TREE_CODE (max) != INTEGER_CST
&& !at_function_scope_p ()
&& !value_dependent_expression_p (max))
{
if (complain & tf_error)
error ("array bound is not an integer constant");
......
2008-02-05 Jakub Jelinek <jakub@redhat.com>
PR c++/33553
* g++.dg/template/array19.C: New test.
2008-02-05 Diego Novillo <dnovillo@google.com>
http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00140.html
// PR c++/33553
// { dg-do compile }
template <class T> struct S { static const int sz = 2; };
template <class T> struct U { enum { sz = 2 }; };
template <class R>
struct P
{
template <class T> void bar (int (&x)[S<T>::sz]);
template <class T> void baz (int (&x)[U<T>::sz]);
};
P<int> p;
void
foo (void)
{
int x[2];
p.bar<int> (x);
p.baz<int> (x);
}
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