public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH to add test for c++/91104
@ 2019-07-17 17:53 Marek Polacek
  2019-07-31 18:54 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2019-07-17 17:53 UTC (permalink / raw)
  To: GCC Patches, Jason Merrill

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" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: C++ PATCH to add test for c++/91104
  2019-07-17 17:53 C++ PATCH to add test for c++/91104 Marek Polacek
@ 2019-07-31 18:54 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2019-07-31 18:54 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

On 7/17/19 1:51 PM, Marek Polacek wrote:
> 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.

You could call another function with the expansion and check the 
arguments there?

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-31 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 17:53 C++ PATCH to add test for c++/91104 Marek Polacek
2019-07-31 18:54 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).