Message ID | 20190717175123.GF32749@redhat.com |
---|---|
State | New |
Headers | show |
Series | C++ PATCH to add test for c++/91104 | expand |
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
--- /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" }