]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/55573 (ICE in adjust_temp_type, at cp/semantics.c:6454)
authorJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Dec 2012 18:54:25 +0000 (19:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Dec 2012 18:54:25 +0000 (19:54 +0100)
PR c++/55573
* semantics.c (adjust_temp_type): Handle VECTOR_CST.

* g++.dg/cpp0x/constexpr-55573.C: New test.

From-SVN: r194262

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-55573.C [new file with mode: 0644]

index 96a88b92b197662e14296a8dcacea1c1ab838510..23a0a9267dde1b51847d3f79440ecb6278c3d336 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-06  Marc Glisse  <marc.glisse@inria.fr>
+
+       PR c++/55573
+       * semantics.c (adjust_temp_type): Handle VECTOR_CST.
+
 2012-12-06  Jason Merrill  <jason@redhat.com>
 
        PR c++/54947
index 53e849afbef1ed27af1184579ee53255efa8aadd..248326733860cd0425157e49b247b6f73349e6f6 100644 (file)
@@ -6451,7 +6451,7 @@ adjust_temp_type (tree type, tree temp)
   /* Avoid wrapping an aggregate value in a NOP_EXPR.  */
   if (TREE_CODE (temp) == CONSTRUCTOR)
     return build_constructor (type, CONSTRUCTOR_ELTS (temp));
-  gcc_assert (SCALAR_TYPE_P (type));
+  gcc_assert (scalarish_type_p (type));
   return cp_fold_convert (type, temp);
 }
 
index ce14c922f04f443917a9f5f43fce6977ed81fa19..1912926e3860fe17ec905dc502702574a027b3e9 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/55573
+       * g++.dg/cpp0x/constexpr-55573.C: New test.
+
 2012-12-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/55137
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-55573.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-55573.C
new file mode 100644 (file)
index 0000000..1988253
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/55573
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+template <typename T, int N>
+struct ExtVecTraits {
+  typedef T __attribute__((vector_size (N * sizeof (T)))) type;
+};
+
+template <typename T>
+using Vec4 = typename ExtVecTraits<T,4>::type;
+
+template <typename T>
+struct Rot3
+{
+  typedef Vec4<T> Vec;
+  Vec axis[3];
+  constexpr Rot3 (Vec4<T> ix, Vec4<T> iy, Vec4<T> iz) : axis {ix, iy, iz} {}
+};
+
+typedef Vec4<float> Vec;
+Rot3<float> r2 ((Vec) {0, 1, 0, 0}, (Vec){0, 0, 1, 0}, (Vec){1, 0, 0, 0});