diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2012-12-11 21:20:23 +0100 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2012-12-11 20:20:23 +0000 |
commit | 4eab75dd128cec9fd5b1b011f992be6b69f7ee81 (patch) | |
tree | 0277ae7a99c17b3afc64d4b3af39811c76bdd446 /gcc/testsuite | |
parent | 759deff3ac0e0c8a7680dd106e05394ad219f84b (diff) | |
download | gcc-4eab75dd128cec9fd5b1b011f992be6b69f7ee81.zip gcc-4eab75dd128cec9fd5b1b011f992be6b69f7ee81.tar.gz gcc-4eab75dd128cec9fd5b1b011f992be6b69f7ee81.tar.bz2 |
re PR c++/53094 (constexpr vector subscripting)
2012-12-11 Marc Glisse <marc.glisse@inria.fr>
PR c++/53094
cp/
* tree.c (cp_tree_equal): Handle VECTOR_CST.
* semantics.c (cxx_eval_bare_aggregate): Protect a dereference.
Handle VECTOR_CST.
testsuite/
* g++.dg/cpp0x/constexpr-53094-1.C: New testcase.
* g++.dg/cpp0x/constexpr-53094-2.C: Likewise.
* g++.dg/cpp0x/constexpr-53094-3.C: Likewise.
From-SVN: r194421
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-53094-1.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-53094-3.C | 19 |
4 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef71057..2f80e7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2012-12-11 Marc Glisse <marc.glisse@inria.fr> + + PR c++/53094 + * g++.dg/cpp0x/constexpr-53094-1.C: New testcase. + * g++.dg/cpp0x/constexpr-53094-2.C: Likewise. + * g++.dg/cpp0x/constexpr-53094-3.C: Likewise. + 2012-12-11 Jakub Jelinek <jakub@redhat.com> PR c++/55643 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-1.C new file mode 100644 index 0000000..c24ff60 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-1.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +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 *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C new file mode 100644 index 0000000..af4b8d9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-2.C @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4; +constexpr V4 build (float x, float y, float z) { return (V4){ x, y, z, 0 };} +constexpr V4 x = build (1, 0, 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-3.C new file mode 100644 index 0000000..bd17ac7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-53094-3.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +typedef float __attribute__ ((vector_size (4 * sizeof (float)))) V4; + +struct Rot3 { + typedef float T; + typedef V4 Vec; + Vec axis[3]; + constexpr Rot3 (V4 ix, V4 iy, V4 iz) : axis {ix, iy, iz} {} + + constexpr Rot3(T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : + Rot3((Vec) { xx, xy, xz, 0 }, + (Vec) { yx, yy, yz, 0 }, + (Vec) { zx, zy, zz, 0 }) {} + +}; + +constexpr Rot3 r1( 0, 1 ,0, 0, 0, 1, 1, 0, 0); |