diff mbox series

C++ PATCH to add test for c++/86875

Message ID 20190102165623.GX21364@redhat.com
State New
Headers show
Series C++ PATCH to add test for c++/86875 | expand

Commit Message

Marek Polacek Jan. 2, 2019, 4:56 p.m. UTC
The testcase in this PR was fixed by r267272, so I've reduced it and am going
to add it to the testsuite.

Tested on x86_64-linux (and with -m32), applying onto trunk.

2019-01-02  Marek Polacek  <polacek@redhat.com>

	PR c++/86875
	* g++.dg/cpp1y/lambda-generic-86875.C: New test.
diff mbox series

Patch

diff --git gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C
new file mode 100644
index 00000000000..3a81b00df96
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-86875.C
@@ -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();
+}