aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-09-24 11:13:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-09-24 11:13:19 -0400
commit3fdb885199d6c52f584aefd9cc1bfa4b3380f97a (patch)
tree2dc41e4ee8c7c9d6492e47eca15c1e8531b3a9f9 /gcc/cp/decl.c
parent75d980abcc4dbd2bcb3d06c3f12ef9312ccac856 (diff)
downloadgcc-3fdb885199d6c52f584aefd9cc1bfa4b3380f97a.zip
gcc-3fdb885199d6c52f584aefd9cc1bfa4b3380f97a.tar.gz
gcc-3fdb885199d6c52f584aefd9cc1bfa4b3380f97a.tar.bz2
decl.c (compute_array_index_type): Remember type dependence of array bound.
* decl.c (compute_array_index_type): Remember type dependence of array bound. * pt.c (dependent_type_p_r): Don't recompute it here. From-SVN: r164598
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 3d1420a..6a44482 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -7402,11 +7402,15 @@ compute_array_index_type (tree name, tree size)
type = TREE_TYPE (size);
}
+ /* A type is dependent if it is...an array type constructed from any
+ dependent type or whose size is specified by a constant expression
+ that is value-dependent. */
/* We can only call value_dependent_expression_p on integral constant
expressions; the parser adds a dummy NOP_EXPR with TREE_SIDE_EFFECTS
set if this isn't one. */
if (processing_template_decl
- && (TREE_SIDE_EFFECTS (size) || value_dependent_expression_p (size)))
+ && (dependent_type_p (type)
+ || TREE_SIDE_EFFECTS (size) || value_dependent_expression_p (size)))
{
/* We cannot do any checking for a SIZE that isn't known to be
constant. Just build the index type and mark that it requires
@@ -7532,10 +7536,16 @@ compute_array_index_type (tree name, tree size)
{
tree t = build_index_type (itype);
TYPE_CANONICAL (abi_1_itype) = TYPE_CANONICAL (t);
- return abi_1_itype;
+ itype = abi_1_itype;
}
else
- return build_index_type (itype);
+ itype = build_index_type (itype);
+
+ /* If the index type were dependent, we would have returned early, so
+ remember that it isn't. */
+ TYPE_DEPENDENT_P (itype) = 0;
+ TYPE_DEPENDENT_P_VALID (itype) = 1;
+ return itype;
}
/* Returns the scope (if any) in which the entity declared by