diff mbox series

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

Message ID 20190118164550.GA26714@redhat.com
State New
Headers show
Series C++ PATCH to add test for c++/86926 | expand

Commit Message

Marek Polacek Jan. 18, 2019, 4:45 p.m. UTC
This test got fixed by r267859, so let's add it.  Unfortunately, it still ICEs
on the gcc-8 branch.

Tested on x86_64-linux, applying to trunk.

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

	PR c++/86926
	* g++.dg/cpp1z/constexpr-lambda23.C: New test.
diff mbox series

Patch

diff --git gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C
new file mode 100644
index 00000000000..4ff866b5d94
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C
@@ -0,0 +1,16 @@ 
+// PR c++/86926
+// { dg-do compile { target c++17 } }
+
+int
+main()
+{
+    constexpr auto f = [](auto self, auto n) {
+        if(n < 2)
+	  return n;
+        return self(self, n - 1) + self(self, n - 2);
+    };
+
+    constexpr auto fibonacci = [=](auto n) { return f(f, n); };
+
+    static_assert(fibonacci(7) == 13);
+}