[committed] c++: Add test for c++/91104

Message ID 20200625230655.1631743-1-polacek@redhat.com
State New
Headers show
Series
  • [committed] c++: Add test for c++/91104
Related show

Commit Message

Peter Bergner via Gcc-patches June 25, 2020, 11:06 p.m.
Fixed by r271705.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/testsuite/ChangeLog:

	PR c++/91104
	* g++.dg/cpp1y/lambda-generic-variadic21.C: New test.
---
 .../g++.dg/cpp1y/lambda-generic-variadic21.C  | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic21.C


base-commit: 77d455ee81ec3a23f8b20259a31ab963716f8e82
-- 
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA

Patch

diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic21.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic21.C
new file mode 100644
index 00000000000..affb1ffd474
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic21.C
@@ -0,0 +1,26 @@ 
+// PR c++/91104
+// { dg-do run { target c++14 } }
+
+void
+test (void (*f)(int, int, int))
+{
+  f(1, 2, 3);
+}
+
+void
+check (int a, int b, int c)
+{
+  if (a != 1 || b != 2 || c != 3)
+    __builtin_abort ();
+}
+
+int
+main ()
+{
+  test ([](auto... args) {
+    check (args...);
+  });
+  test ([](int a, int b, int c) {
+    check (a, b, c);
+  });
+}