(C++) patch re array size in templates
Jason Merrill
jason@cygnus.com
Wed Feb 24 11:46:00 GMT 1999
This fixes the GNU array-of-zero extension in templates.
1999-02-24 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (tsubst): Allow an array of explicit size zero.
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.264
diff -c -p -r1.264 pt.c
*** pt.c 1999/02/21 16:38:19 1.264
--- pt.c 1999/02/24 19:45:28
*************** tsubst (t, args, complain, in_decl)
*** 6017,6025 ****
return t;
{
! tree max = TREE_OPERAND (TYPE_MAX_VALUE (t), 0);
! max = tsubst_expr (max, args, complain, in_decl);
if (max == error_mark_node)
return error_mark_node;
--- 6017,6025 ----
return t;
{
! tree max, omax = TREE_OPERAND (TYPE_MAX_VALUE (t), 0);
! max = tsubst_expr (omax, args, complain, in_decl);
if (max == error_mark_node)
return error_mark_node;
*************** tsubst (t, args, complain, in_decl)
*** 6032,6038 ****
return itype;
}
! if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node))
{
/* [temp.deduct]
--- 6032,6044 ----
return itype;
}
! if (integer_zerop (omax))
! {
! /* Still allow an explicit array of size zero. */
! if (pedantic)
! pedwarn ("creating array with size zero");
! }
! else if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node))
{
/* [temp.deduct]
More information about the Gcc-patches
mailing list