re PR c++/86875 (ICE in tsubst_copy, at cp/pt.c:15478)
authorMarek Polacek <polacek@redhat.com>
Wed, 2 Jan 2019 17:07:02 +0000 (17:07 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 2 Jan 2019 17:07:02 +0000 (17:07 +0000)
PR c++/86875
* g++.dg/cpp1y/lambda-generic-86875.C: New test.

From-SVN: r267519

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

index 782b3d26c19fa810f7d50653a502d19a9a069a94..23691cd282de4db0a4654bc08ae6ac0f4b3df910 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-02  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/86875
+       * g++.dg/cpp1y/lambda-generic-86875.C: New test.
+
 2019-01-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/48543
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C
new file mode 100644 (file)
index 0000000..3a81b00
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/86875
+// { dg-do compile { target c++14 } }
+
+template <typename _Tp> using decay_t = _Tp;
+template <class Fun> class A {
+  Fun fun_;
+
+public:
+  template <class T> A(T p1) : fun_(p1) {}
+  auto operator()() { fun_(this); }
+};
+
+template <class Fun> auto y_combinator(Fun p1) { return A<decay_t<Fun>>(p1); }
+
+int
+main()
+{
+  const unsigned int w = 1;
+  auto foo = y_combinator([=](auto) { auto i = +w; });
+  foo();
+}