http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53094
--- Comment #11 from vincenzo Innocente <vincenzo.innocente at cern dot ch>
2012-12-03 21:58:05 UTC ---
thanks Marc,
adding your proposed change above Jason's one make my full test works (but when
subscripting is involved..)
this is my current svn diff
Hope that c++ maintainers came make, out of all this, an optimal patch for the
trunk.
I'm not expert enough on the details to judge what best (besides that I did not
run regression!)
Index: gcc/cp/tree.c
===================================================================
--- gcc/cp/tree.c (revision 194084)
+++ gcc/cp/tree.c (working copy)
@@ -2468,7 +2468,8 @@
case COMPLEX_CST:
return cp_tree_equal (TREE_REALPART (t1), TREE_REALPART (t2))
&& cp_tree_equal (TREE_IMAGPART (t1), TREE_IMAGPART (t2));
-
+ case VECTOR_CST:
+ return operand_equal_p (t1, t2, OEP_ONLY_CONST);
case CONSTRUCTOR:
/* We need to do this when determining whether or not two
non-type pointer to member function template arguments
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c (revision 194084)
+++ gcc/cp/semantics.c (working copy)
@@ -6451,6 +6451,14 @@
/* Avoid wrapping an aggregate value in a NOP_EXPR. */
if (TREE_CODE (temp) == CONSTRUCTOR)
return build_constructor (type, CONSTRUCTOR_ELTS (temp));
+ if (TREE_CODE (temp) == VECTOR_CST)
+ {
+ int i, count = TYPE_VECTOR_SUBPARTS (type);
+ tree *vec = XALLOCAVEC (tree, count);
+ for (i = 0; i < count; i++)
+ vec[i] = cp_fold_convert (TREE_TYPE (type), VECTOR_CST_ELT (temp, i));
+ return build_vector (type, vec);
+ }
gcc_assert (SCALAR_TYPE_P (type));
return cp_fold_convert (type, temp);
}
@@ -7134,7 +7142,10 @@
vec_free (n);
return t;
}
+
t = build_constructor (TREE_TYPE (t), n);
+ if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ t = fold (t);
TREE_CONSTANT (t) = true;
return t;
}