c++: Add testcase for already fixed PR [PR90215]
authorPatrick Palka <ppalka@redhat.com>
Fri, 9 Apr 2021 15:37:42 +0000 (11:37 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 9 Apr 2021 15:37:42 +0000 (11:37 -0400)
We accept this testcase after r11-7985.

gcc/testsuite/ChangeLog:

PR c++/90215
* g++.dg/cpp1z/fold-lambda4.C: New test.

gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C b/gcc/testsuite/g++.dg/cpp1z/fold-lambda4.C
new file mode 100644 (file)
index 0000000..b8bae86
--- /dev/null
@@ -0,0 +1,30 @@
+// PR c++/90215
+// { dg-do compile { target c++17 } }
+
+struct X
+{
+    template <class F>
+    void f(F f)
+    {
+        f(0);
+    }
+};
+
+template <class... Xs>
+void bug(Xs... xs)
+{
+    int i;
+
+    [&](auto&... ys)
+    {
+        (xs.f([&](auto)
+        {
+            ys;
+        }), ...);
+    }(i);
+}
+
+int main()
+{
+    bug(X{});
+}