mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:40:26 +08:00
re PR c++/36852 (Two dimensional array in template method argument list incorrectly interpreted.)
PR c++/36852 * tree.c (cplus_array_hash, build_cplus_array_type_1): Hash on TYPE_UID instead of pointers. * g++.dg/pch/array-1.C: New test. * g++.dg/pch/array-1.Hs: New file. From-SVN: r138250
This commit is contained in:
parent
11cc454690
commit
eb9c434c0f
@ -1,3 +1,9 @@
|
||||
2008-07-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/36852
|
||||
* tree.c (cplus_array_hash, build_cplus_array_type_1): Hash on
|
||||
TYPE_UID instead of pointers.
|
||||
|
||||
2008-07-29 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* optimize.c (maybe_clone_body): Remove DECL_INLINE.
|
||||
|
@ -504,9 +504,9 @@ cplus_array_hash (const void* k)
|
||||
hashval_t hash;
|
||||
const_tree const t = (const_tree) k;
|
||||
|
||||
hash = (htab_hash_pointer (TREE_TYPE (t))
|
||||
^ htab_hash_pointer (TYPE_DOMAIN (t)));
|
||||
|
||||
hash = TYPE_UID (TREE_TYPE (t));
|
||||
if (TYPE_DOMAIN (t))
|
||||
hash ^= TYPE_UID (TYPE_DOMAIN (t));
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -553,8 +553,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type)
|
||||
cplus_array_htab = htab_create_ggc (61, &cplus_array_hash,
|
||||
&cplus_array_compare, NULL);
|
||||
|
||||
hash = (htab_hash_pointer (elt_type)
|
||||
^ htab_hash_pointer (index_type));
|
||||
hash = TYPE_UID (elt_type);
|
||||
if (index_type)
|
||||
hash ^= TYPE_UID (index_type);
|
||||
cai.type = elt_type;
|
||||
cai.domain = index_type;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2008-07-29 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/36852
|
||||
* g++.dg/pch/array-1.C: New test.
|
||||
* g++.dg/pch/array-1.Hs: New file.
|
||||
|
||||
2008-07-29 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* gcc.dg/20040206-1.c: Expect frontend warning now.
|
||||
|
15
gcc/testsuite/g++.dg/pch/array-1.C
Normal file
15
gcc/testsuite/g++.dg/pch/array-1.C
Normal file
@ -0,0 +1,15 @@
|
||||
// PR c++/36852
|
||||
|
||||
#include "array-1.H"
|
||||
|
||||
template <class T>
|
||||
T
|
||||
A::foo (T t[3][3])
|
||||
{
|
||||
return t[0][1];
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
}
|
4
gcc/testsuite/g++.dg/pch/array-1.Hs
Normal file
4
gcc/testsuite/g++.dg/pch/array-1.Hs
Normal file
@ -0,0 +1,4 @@
|
||||
struct A
|
||||
{
|
||||
template <class T> static T foo (T[3][3]);
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user