aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2004-11-24 10:06:54 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2004-11-24 10:06:54 +0000
commitd70b8c3ac3fc7419b4ddec11cf6321ed4e086fdf (patch)
tree0c12974a411269c0d5ba5e09d0d63e06d3cd121e /gcc/tree.c
parentb38cd28c43ada6c2e1529b0f71cb598662d8f77c (diff)
downloadgcc-d70b8c3ac3fc7419b4ddec11cf6321ed4e086fdf.zip
gcc-d70b8c3ac3fc7419b4ddec11cf6321ed4e086fdf.tar.gz
gcc-d70b8c3ac3fc7419b4ddec11cf6321ed4e086fdf.tar.bz2
re PR c++/16882 (overloading confused by const vector arguments)
2004-11-24 Paolo Bonzini <bonzini@gnu.org> PR c++/16882 * tree.c (make_vector_type): Move qualifiers to the vector type, use the inner type's main variant and build a main variant for the vector type if necessary. (type_hash_eq): Check a vector type's TYPE_VECTOR_SUBPARTS. cp: 2004-11-24 Paolo Bonzini <bonzini@gnu.org> PR c++/16882 * call.c (standard_conversion): Move check for conversions between vector pointers... * typeck.c (ptr_reasonably_similar): ... here. testsuite: 2004-11-24 Paolo Bonzini <bonzini@gnu.org> PR c++/16882 * g++.dg/conversion/simd1.C: New test. From-SVN: r91142
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 32ec8a5..643f1de 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3437,11 +3437,13 @@ type_hash_eq (const void *va, const void *vb)
{
case VOID_TYPE:
case COMPLEX_TYPE:
- case VECTOR_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
return 1;
+ case VECTOR_TYPE:
+ return TYPE_VECTOR_SUBPARTS (a->type) == TYPE_VECTOR_SUBPARTS (b->type);
+
case ENUMERAL_TYPE:
if (TYPE_VALUES (a->type) != TYPE_VALUES (b->type)
&& !(TYPE_VALUES (a->type)
@@ -5542,9 +5544,12 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
{
tree t = make_node (VECTOR_TYPE);
- TREE_TYPE (t) = innertype;
+ TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype);
TYPE_VECTOR_SUBPARTS (t) = nunits;
TYPE_MODE (t) = mode;
+ TYPE_READONLY (t) = TYPE_READONLY (innertype);
+ TYPE_VOLATILE (t) = TYPE_VOLATILE (innertype);
+
layout_type (t);
{
@@ -5563,6 +5568,16 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
TYPE_UID (rt) = TYPE_UID (t);
}
+ /* Build our main variant, based on the main variant of the inner type. */
+ if (TYPE_MAIN_VARIANT (innertype) != innertype)
+ {
+ tree innertype_main_variant = TYPE_MAIN_VARIANT (innertype);
+ unsigned int hash = TYPE_HASH (innertype_main_variant);
+ TYPE_MAIN_VARIANT (t)
+ = type_hash_canon (hash, make_vector_type (innertype_main_variant,
+ nunits, mode));
+ }
+
return t;
}