C++ PATCH to add test for c++/91104
Marek Polacek
polacek@redhat.com
Wed Jul 17 17:53:00 GMT 2019
This was a wrong code issue where we printed
2 3 1
1 2 3
instead of
1 2 3
1 2 3
but it was fixed by r271705. I don't know of a good way to check
the auto... expansion here so I used dg-output.
Tested on x86_64-linux, ok for trunk?
2019-07-17 Marek Polacek <polacek@redhat.com>
PR c++/91104
* g++.dg/cpp1y/lambda-generic-variadic20.C: New test.
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic20.C
@@ -0,0 +1,20 @@
+// PR c++/91104
+// { dg-do run { target c++14 } }
+
+#include <cstdio>
+
+void test(void (*f)(int, int, int)) {
+ f(1, 2, 3);
+}
+
+int main() {
+ test([](auto... args) {
+ printf("%d %d %d\n", args...);
+ });
+ test([](int a, int b, int c) {
+ printf("%d %d %d\n", a, b, c);
+ });
+}
+
+// { dg-output "1 2 3(\n|\r\n|\r)" }
+// { dg-output "\[^\n\r]*1 2 3" }
More information about the Gcc-patches
mailing list