re PR c++/79205 (ICE in create_tmp_var, at gimple-expr.c:473)
authorJakub Jelinek <jakub@redhat.com>
Tue, 24 Jan 2017 22:33:41 +0000 (23:33 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 24 Jan 2017 22:33:41 +0000 (23:33 +0100)
PR c++/79205
* cp-gimplify.c (cp_genericize_r): Add result of
convert_from_reference on invisiref parm to p_set.

* g++.dg/cpp1z/decomp22.C: New test.
* g++.dg/cpp1z/decomp23.C: New test.

From-SVN: r244885

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/decomp22.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/decomp23.C [new file with mode: 0644]

index 5010aeb1303053e4e050befdd5f16488bbf91929..05c6b6098882f68cbb59c58e5b6733a5a4d19b8a 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79205
+       * cp-gimplify.c (cp_genericize_r): Add result of
+       convert_from_reference on invisiref parm to p_set.
+
 2017-01-24  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/78469 - defaulted ctor and inaccessible dtor
index 2c59c07627079f487a54da6083528d863fbaa7c1..13647033f70fdab4959040e62885fb11dc025c2b 100644 (file)
@@ -1107,6 +1107,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
   if (wtd->handle_invisiref_parm_p && is_invisiref_parm (stmt))
     {
       *stmt_p = convert_from_reference (stmt);
+      p_set->add (*stmt_p);
       *walk_subtrees = 0;
       return NULL;
     }
index 01df86dffd2d5fb0a9203fd62407a845b624c98a..f8a9536886a480c4e592e1d5b9a5d5d7759f478d 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79205
+       * g++.dg/cpp1z/decomp22.C: New test.
+       * g++.dg/cpp1z/decomp23.C: New test.
+
 2017-01-24  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/78469
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp22.C b/gcc/testsuite/g++.dg/cpp1z/decomp22.C
new file mode 100644 (file)
index 0000000..81d40c5
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/79205
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <unsigned long, typename...> struct B;
+template <unsigned long I, typename H> struct B<I, H> { int b; };
+template <typename... E> struct C { B<0, E...> c; C (C &) = default; C (C &&); };
+template <typename> struct tuple_size;
+template <> struct tuple_size<C<int>> { static constexpr int value = 1; };
+template <int, typename> struct tuple_element;
+template <typename H, typename... T>
+struct tuple_element<0, C<H, T...>> { typedef int type; };
+template <int, typename... E>
+int &&get (C<E...> &&);
+
+int
+foo (C<int> t)
+{
+  auto[x0] = t;        // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+  return x0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp23.C b/gcc/testsuite/g++.dg/cpp1z/decomp23.C
new file mode 100644 (file)
index 0000000..c682fa0
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/79205
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+#include <tuple>
+
+int
+foo (std::tuple<int> t)
+{
+  auto [x0] = t;       // { dg-warning "decomposition declaration only available with" "" { target c++14_down } }
+  return x0;
+}