re PR c++/83856 (ICE in tsubst_copy;)
authorMarek Polacek <polacek@redhat.com>
Sat, 1 Dec 2018 21:09:31 +0000 (21:09 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 1 Dec 2018 21:09:31 +0000 (21:09 +0000)
PR c++/83856
* g++.dg/cpp1y/lambda-generic-83856.C: New test.

From-SVN: r266711

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C [new file with mode: 0644]

index 610a26453fa49b90f49c1bdc8582ab9a63d0e1ef..c7afb2b71c2a648da0eb332cfc8146e07cf3c246 100644 (file)
@@ -34,6 +34,9 @@
        * g++.dg/template/typedef6.C: Adjust dg-error.
        * g++.dg/template/typename3.C: Only expect error in c++17_down.
 
+       PR c++/83856
+       * g++.dg/cpp1y/lambda-generic-83856.C: New test.
+
 2018-12-01  Jeff Law  <law@redhat.com>
 
        * gcc.dg/predict-22.c: Update expected output.
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C
new file mode 100644 (file)
index 0000000..ab82b62
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/83856
+// { dg-do compile { target c++14 } }
+
+namespace std {
+template <typename _Tp> _Tp declval();
+template <class _E> class initializer_list {
+  _E *_M_len;
+
+public:
+  unsigned long size;
+  _E begin();
+};
+template <typename, unsigned> struct array { void operator[](long); };
+} // namespace std
+
+template <class> struct simd {
+  static int size();
+  template <class F> simd(F, decltype(std::declval<F>()(0)) * = nullptr) {}
+};
+template <class V, class... F>
+void test_tuples(std::initializer_list<std::array<float, 1>> data,
+                 F... fun_pack) {
+  auto it = data.begin();
+  const int remaining = V::size();
+  [](...) {}((fun_pack([&](auto) { it[remaining]; }), 0)...);
+}
+
+void f() {
+  test_tuples<simd<float>>({}, [](simd<float>) {});
+}