case CONSTRUCTOR:
/* And we need to handle PTRMEM_CST wrapped in a CONSTRUCTOR. */
tree field;
+ if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ /* An initialized vector would have a VECTOR_CST. */
+ return false;
if (CONSTRUCTOR_NO_CLEARING (t))
{
- if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
- /* An initialized vector would have a VECTOR_CST. */
- return false;
- else if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
+ if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
{
/* There must be a valid constant initializer at every array
index. */
TREE_SIDE_EFFECTS (ctx->ctor) = side_effects_p;
}
}
- if (*non_constant_p || !changed)
+ if (*non_constant_p)
return t;
+ if (!changed)
+ {
+ if (VECTOR_TYPE_P (type))
+ t = fold (t);
+ return t;
+ }
t = ctx->ctor;
if (!t)
t = build_constructor (type, NULL);
case CONSTRUCTOR:
if (TREE_CONSTANT (t) && reduced_constant_expression_p (t))
{
- /* Don't re-process a constant CONSTRUCTOR, but do fold it to
- VECTOR_CST if applicable. */
+ /* Don't re-process a constant CONSTRUCTOR. */
verify_constructor_flags (t);
if (TREE_CONSTANT (t))
- return fold (t);
+ return t;
}
r = cxx_eval_bare_aggregate (ctx, t, lval,
non_constant_p, overflow_p);
--- /dev/null
+// PR c++/107295
+// { dg-do compile { target c++11 } }
+
+template <typename T> struct A {
+ typedef T __attribute__((vector_size (sizeof (int)))) V;
+};
+template <int, typename T> using B = typename A<T>::V;
+template <typename T> using V = B<4, T>;
+using F = V<float>;
+constexpr F a = F () + 0.0f;
+constexpr F b = F () + (float) 0.0;
+constexpr F c = F () + (float) 0.0L;