https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91104

            Bug ID: 91104
           Summary: auto... in lambda expression reorders parameters
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antifermion at protonmail dot com
  Target Milestone: ---

Created attachment 46570
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46570&action=edit
source file to reproduce the bug

Code:

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);
    });
}

Actual Output:

2 3 1
1 2 3

Expected Output:

1 2 3
1 2 3

Compiler flags:

g++ -std=c++17 -Wall -Wextra -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations main.cpp -o main && ./main

(c++14 has the same behavior)

Output of g++ -v:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-gnu/9.1.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: /usr/src/gcc/configure --build=x86_64-linux-gnu
--disable-multilib --enable-languages=c,c++,fortran,go
Thread model: posix
gcc version 9.1.0 (GCC)

System type: Debian Stretch (amd64)

Reply via email to