summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-16 13:07:29 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-16 13:07:29 +0000
commit4829ecfcf32eaabc39e5869a575341e83efa7dcb (patch)
treeb2d3d48c1e9e34a20a01c82573b3db0adc9e80d0 /gcc/cp
parentbbf9fb6a7dfb94df60c1f8625f60ce58dccebbbb (diff)
downloadgcc-4829ecfcf32eaabc39e5869a575341e83efa7dcb.tar.gz
* pt.c (UNIFY_ALLOW_MAX_CORRECTION): Define.
(unify): Only handle MINUS_EXPR specially if the above flag is set and the subtracted constant is 1. Clear the flag on recursive calls. Set it when unifying the maximum value in an INTEGER_TYPE's range. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46287 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/pt.c17
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f5a999286d6..1cb628dadc9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,12 @@
2001-10-15 Richard Sandiford <rsandifo@redhat.com>
+ * pt.c (UNIFY_ALLOW_MAX_CORRECTION): Define.
+ (unify): Only handle MINUS_EXPR specially if the above flag is set
+ and the subtracted constant is 1. Clear the flag on recursive calls.
+ Set it when unifying the maximum value in an INTEGER_TYPE's range.
+
+2001-10-15 Richard Sandiford <rsandifo@redhat.com>
+
* decl.c (bad_specifiers): Don't allow exception specifications
on any typedefs.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e2904b5cf5f..5a5cf4dafe9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -84,6 +84,7 @@ static htab_t local_specializations;
#define UNIFY_ALLOW_OUTER_LEVEL 16
#define UNIFY_ALLOW_OUTER_MORE_CV_QUAL 32
#define UNIFY_ALLOW_OUTER_LESS_CV_QUAL 64
+#define UNIFY_ALLOW_MAX_CORRECTION 128
#define GTB_VIA_VIRTUAL 1 /* The base class we are examining is
virtual, or a base class of a virtual
@@ -8473,7 +8474,14 @@ check_cv_quals_for_unify (strict, arg, parm)
qualified at this point.
UNIFY_ALLOW_OUTER_LESS_CV_QUAL:
This is the outermost level of a deduction, and PARM can be less CV
- qualified at this point. */
+ qualified at this point.
+ UNIFY_ALLOW_MAX_CORRECTION:
+ This is an INTEGER_TYPE's maximum value. Used if the range may
+ have been derived from a size specification, such as an array size.
+ If the size was given by a nontype template parameter N, the maximum
+ value will have the form N-1. The flag says that we can (and indeed
+ must) unify N with (ARG + 1), an exception to the normal rules on
+ folding PARM. */
static int
unify (tparms, targs, parm, arg, strict)
@@ -8529,6 +8537,7 @@ unify (tparms, targs, parm, arg, strict)
strict &= ~UNIFY_ALLOW_DERIVED;
strict &= ~UNIFY_ALLOW_OUTER_MORE_CV_QUAL;
strict &= ~UNIFY_ALLOW_OUTER_LESS_CV_QUAL;
+ strict &= ~UNIFY_ALLOW_MAX_CORRECTION;
switch (TREE_CODE (parm))
{
@@ -8784,7 +8793,8 @@ unify (tparms, targs, parm, arg, strict)
return 1;
if (TYPE_MAX_VALUE (parm) && TYPE_MAX_VALUE (arg)
&& unify (tparms, targs, TYPE_MAX_VALUE (parm),
- TYPE_MAX_VALUE (arg), UNIFY_ALLOW_INTEGER))
+ TYPE_MAX_VALUE (arg),
+ UNIFY_ALLOW_INTEGER | UNIFY_ALLOW_MAX_CORRECTION))
return 1;
}
/* We have already checked cv-qualification at the top of the
@@ -8914,7 +8924,8 @@ unify (tparms, targs, parm, arg, strict)
return 1;
case MINUS_EXPR:
- if (TREE_CODE (TREE_OPERAND (parm, 1)) == INTEGER_CST)
+ if (tree_int_cst_equal (TREE_OPERAND (parm, 1), integer_one_node)
+ && (strict_in & UNIFY_ALLOW_MAX_CORRECTION))
{
/* We handle this case specially, since it comes up with
arrays. In particular, something like: