aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2017-10-28 16:10:10 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-10-28 16:10:10 +0000
commita3cbda1b7caeb74630f09dc7e01bd59f30085f00 (patch)
treeaf92d9931192d131027e5cb23ee31d5a9519c836 /gcc
parent5ce15f69d23ff9ccd2a597a6a676de43acf531bd (diff)
downloadgcc-a3cbda1b7caeb74630f09dc7e01bd59f30085f00.zip
gcc-a3cbda1b7caeb74630f09dc7e01bd59f30085f00.tar.gz
gcc-a3cbda1b7caeb74630f09dc7e01bd59f30085f00.tar.bz2
re PR c++/70971 (ICE in parameter pack expansion)
2017-10-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70971 * g++.dg/torture/pr70971.C: New. From-SVN: r254199
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr70971.C48
2 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1646f4c..49693bc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/70971
+ * g++.dg/torture/pr70971.C: New.
+
2017-10-28 Paul Thomas <pault@gcc.gnu.org>
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 0000000..23f33aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr70971.C
@@ -0,0 +1,48 @@
+// { dg-additional-options "-std=c++14" }
+
+template<typename Signature>
+class function;
+
+template<typename R, typename... Args>
+class invoker_base
+{
+ public:
+ virtual ~invoker_base() { }
+};
+
+template<typename F, typename R, typename... Args>
+class functor_invoker : public invoker_base<R, Args...>
+{
+ public:
+ explicit functor_invoker(const F& f) : f(f) { }
+ private:
+ F f;
+};
+
+template<typename R, typename... Args>
+class function<R (Args...)> {
+ public:
+ template<typename F>
+ function(const F& f) : invoker(0) {
+ invoker = new functor_invoker<F, R, Args...>(f);
+ }
+ ~function() {
+ if (invoker)
+ delete invoker;
+ }
+ private:
+ invoker_base<R, Args...>* invoker;
+};
+
+template<typename>
+struct unique_ptr { };
+
+struct A {};
+template <class...> struct typelist {};
+template <class... Cs> unique_ptr<A> chooseB(typelist<Cs...>);
+template <class... Cs, class Idx, class... Rest>
+unique_ptr<A> chooseB(typelist<Cs...> choices, Idx, Rest... rest) {
+ auto f = [=](auto) { return [=] { return chooseB(choices, rest...); }; };
+ function<unique_ptr<A>()> fs[]{f(Cs{})...};
+}
+main() { chooseB(typelist<double, char>{}, 0, 1, 2); }