From: Paolo Carlini Date: Sat, 28 Oct 2017 16:10:10 +0000 (+0000) Subject: re PR c++/70971 (ICE in parameter pack expansion) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a3cbda1b7caeb74630f09dc7e01bd59f30085f00;p=gcc.git re PR c++/70971 (ICE in parameter pack expansion) 2017-10-28 Paolo Carlini PR c++/70971 * g++.dg/torture/pr70971.C: New. From-SVN: r254199 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1646f4cb033..49693bca887 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-28 Paolo Carlini + + PR c++/70971 + * g++.dg/torture/pr70971.C: New. + 2017-10-28 Paul Thomas PR fortran/81758 diff --git a/gcc/testsuite/g++.dg/torture/pr70971.C b/gcc/testsuite/g++.dg/torture/pr70971.C new file mode 100644 index 00000000000..23f33aafaba --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr70971.C @@ -0,0 +1,48 @@ +// { dg-additional-options "-std=c++14" } + +template +class function; + +template +class invoker_base +{ + public: + virtual ~invoker_base() { } +}; + +template +class functor_invoker : public invoker_base +{ + public: + explicit functor_invoker(const F& f) : f(f) { } + private: + F f; +}; + +template +class function { + public: + template + function(const F& f) : invoker(0) { + invoker = new functor_invoker(f); + } + ~function() { + if (invoker) + delete invoker; + } + private: + invoker_base* invoker; +}; + +template +struct unique_ptr { }; + +struct A {}; +template struct typelist {}; +template unique_ptr chooseB(typelist); +template +unique_ptr chooseB(typelist choices, Idx, Rest... rest) { + auto f = [=](auto) { return [=] { return chooseB(choices, rest...); }; }; + function()> fs[]{f(Cs{})...}; +} +main() { chooseB(typelist{}, 0, 1, 2); }