PR c++/53094
gcc/cp/
* semantics.c (cxx_eval_bit_field_ref): Handle VECTOR_CST.
gcc/testsuite/
* g++.dg/cpp0x/constexpr-53094-1.C: Adjust.
* g++.dg/ext/vector24.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200822
138bc75d-0d04-0410-961f-
82ee72b054a4
2013-07-09 Marc Glisse <marc.glisse@inria.fr>
+ PR c++/53094
+ * semantics.c (cxx_eval_bit_field_ref): Handle VECTOR_CST.
+
+2013-07-09 Marc Glisse <marc.glisse@inria.fr>
+
PR c++/53000
* call.c (build_conditional_expr_1): Preserve xvalues.
return t;
/* Don't VERIFY_CONSTANT here; we only want to check that we got a
CONSTRUCTOR. */
- if (!*non_constant_p && TREE_CODE (whole) != CONSTRUCTOR)
+ if (!*non_constant_p
+ && TREE_CODE (whole) != VECTOR_CST
+ && TREE_CODE (whole) != CONSTRUCTOR)
{
if (!allow_non_constant)
error ("%qE is not a constant expression", orig_whole);
if (*non_constant_p)
return t;
+ if (TREE_CODE (whole) == VECTOR_CST)
+ return fold_ternary (BIT_FIELD_REF, TREE_TYPE (t), whole,
+ TREE_OPERAND (t, 1), TREE_OPERAND (t, 2));
+
start = TREE_OPERAND (t, 2);
istart = tree_low_cst (start, 0);
isize = tree_low_cst (TREE_OPERAND (t, 1), 0);
2013-07-09 Marc Glisse <marc.glisse@inria.fr>
+ PR c++/53094
+ * g++.dg/cpp0x/constexpr-53094-1.C: Adjust.
+ * g++.dg/ext/vector24.C: New testcase.
+
+2013-07-09 Marc Glisse <marc.glisse@inria.fr>
+
PR c++/53000
* g++.dg/cpp0x/decltype17.C: Adjust.
typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4;
constexpr V4 v = { 1, 1, 1, 0 };
-constexpr V4 r = v[0] + v; // { dg-bogus "not a constant expression" "" { xfail *-*-* } }
+constexpr V4 r = v[0] + v;
--- /dev/null
+// { dg-do compile { target c++11 } }
+
+typedef long vec __attribute__((vector_size(2*sizeof(long))));
+constexpr vec v = { 33, 42 };
+constexpr auto l0 = v[0];
+constexpr auto l1 = v[1];
+static_assert(l0==33,"Fail");
+static_assert(l1==42,"Fail");