diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-21 14:38:12 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-21 14:38:12 +0000 |
commit | 1e0510e14349695b26cf843903dc54e2482ee8a8 (patch) | |
tree | 42b2c1b857a8e718389085c5f1550afe34b7ca81 /gcc | |
parent | a06e700f2946df5bfda7a83d1098e0826cb558fb (diff) | |
download | gcc-1e0510e14349695b26cf843903dc54e2482ee8a8.tar.gz |
* tree.c (cp_tree_equal): Fix CONSTRUCTOR handling.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162378 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/tree.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2aebb116c21..b7b08bbb526 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2010-07-21 Jason Merrill <jason@redhat.com> + * tree.c (cp_tree_equal): Fix CONSTRUCTOR handling. + * parser.c (cp_parser_init_declarator): Pass LOOKUP_NORMAL to cp_finish_decl. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 2abd8dd1a2c..450b9e89433 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2023,11 +2023,21 @@ cp_tree_equal (tree t1, tree t2) /* We need to do this when determining whether or not two non-type pointer to member function template arguments are the same. */ - if (!(same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)) - /* The first operand is RTL. */ - && TREE_OPERAND (t1, 0) == TREE_OPERAND (t2, 0))) + if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2)) + || CONSTRUCTOR_NELTS (t1) != CONSTRUCTOR_NELTS (t2)) return false; - return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)); + { + tree field, value; + unsigned int i; + FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t1), i, field, value) + { + constructor_elt *elt2 = CONSTRUCTOR_ELT (t2, i); + if (!cp_tree_equal (field, elt2->index) + || !cp_tree_equal (value, elt2->value)) + return false; + } + } + return true; case TREE_LIST: if (!cp_tree_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))) |