diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1999-02-24 11:46:56 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1999-02-24 06:46:56 -0500 |
commit | ddce352881f2a8fcea7e43d6e0354b5d03e1874e (patch) | |
tree | 1e5aee575a337c24c45dd986e2256087618d5a0c /gcc | |
parent | 69688f1ed7606189b16bbdbd506dfc6e863e8309 (diff) | |
download | gcc-ddce352881f2a8fcea7e43d6e0354b5d03e1874e.zip gcc-ddce352881f2a8fcea7e43d6e0354b5d03e1874e.tar.gz gcc-ddce352881f2a8fcea7e43d6e0354b5d03e1874e.tar.bz2 |
* pt.c (tsubst): Allow an array of explicit size zero.
From-SVN: r25400
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8aacd3f..348739f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1999-02-24 Jason Merrill <jason@yorick.cygnus.com> + + * pt.c (tsubst): Allow an array of explicit size zero. + 1999-02-23 Jason Merrill <jason@yorick.cygnus.com> * errfn.c: Change varargs code to look like toplev.c. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 905bdf6..b13a8c8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6017,9 +6017,9 @@ tsubst (t, args, complain, in_decl) return t; { - tree max = TREE_OPERAND (TYPE_MAX_VALUE (t), 0); + tree max, omax = TREE_OPERAND (TYPE_MAX_VALUE (t), 0); - max = tsubst_expr (max, args, complain, in_decl); + max = tsubst_expr (omax, args, complain, in_decl); if (max == error_mark_node) return error_mark_node; @@ -6032,7 +6032,13 @@ tsubst (t, args, complain, in_decl) return itype; } - if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node)) + 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] |