From 8fc1ef712dfc1ae506eea6726448d900eb9b6cf4 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 1 Dec 2018 21:09:31 +0000 Subject: [PATCH] re PR c++/83856 (ICE in tsubst_copy;) PR c++/83856 * g++.dg/cpp1y/lambda-generic-83856.C: New test. From-SVN: r266711 --- gcc/testsuite/ChangeLog | 3 ++ .../g++.dg/cpp1y/lambda-generic-83856.C | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 610a26453fa..c7afb2b71c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 * 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 index 00000000000..ab82b6241aa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-83856.C @@ -0,0 +1,30 @@ +// PR c++/83856 +// { dg-do compile { target c++14 } } + +namespace std { +template _Tp declval(); +template class initializer_list { + _E *_M_len; + +public: + unsigned long size; + _E begin(); +}; +template struct array { void operator[](long); }; +} // namespace std + +template struct simd { + static int size(); + template simd(F, decltype(std::declval()(0)) * = nullptr) {} +}; +template +void test_tuples(std::initializer_list> data, + F... fun_pack) { + auto it = data.begin(); + const int remaining = V::size(); + [](...) {}((fun_pack([&](auto) { it[remaining]; }), 0)...); +} + +void f() { + test_tuples>({}, [](simd) {}); +} -- 2.30.2