aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-06-01 19:33:57 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-06-01 19:33:57 +0000
commitf038ec69ccffc38e5038c121cff9e5bbc701b6cd (patch)
tree8ef700a6229ef5bb83f6bbb47d951ce26db24ace /gcc/cp
parentbb9a7f511a3e3fff83ea40d2140a7759456f6b19 (diff)
downloadgcc-f038ec69ccffc38e5038c121cff9e5bbc701b6cd.zip
gcc-f038ec69ccffc38e5038c121cff9e5bbc701b6cd.tar.gz
gcc-f038ec69ccffc38e5038c121cff9e5bbc701b6cd.tar.bz2
* typeck2.c (build_x_arrow): Make types_memoized a VEC.
From-SVN: r160119
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck2.c23
2 files changed, 16 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b7d3e2d..5944313 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-01 Nathan Froyd <froydnj@codesourcery.com>
+
+ * typeck2.c (build_x_arrow): Make types_memoized a VEC.
+
2010-06-01 Arnaud Charlet <charlet@adacore.com>
Matthew Gingell <gingell@adacore.com>
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index e512272..489d3f8 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1400,9 +1400,9 @@ tree
build_x_arrow (tree expr)
{
tree orig_expr = expr;
- tree types_memoized = NULL_TREE;
tree type = TREE_TYPE (expr);
tree last_rval = NULL_TREE;
+ VEC(tree,gc) *types_memoized = NULL;
if (type == error_mark_node)
return error_mark_node;
@@ -1421,19 +1421,20 @@ build_x_arrow (tree expr)
/*overloaded_p=*/NULL,
tf_warning_or_error)))
{
+ tree t;
+ unsigned ix;
+
if (expr == error_mark_node)
return error_mark_node;
- if (value_member (TREE_TYPE (expr), types_memoized))
- {
- error ("circular pointer delegation detected");
- return error_mark_node;
- }
- else
- {
- types_memoized = tree_cons (NULL_TREE, TREE_TYPE (expr),
- types_memoized);
- }
+ for (ix = 0; VEC_iterate (tree, types_memoized, ix, t); ix++)
+ if (TREE_TYPE (expr) == t)
+ {
+ error ("circular pointer delegation detected");
+ return error_mark_node;
+ }
+
+ VEC_safe_push (tree, gc, types_memoized, TREE_TYPE (expr));
last_rval = expr;
}