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

            Bug ID: 109385
           Summary: decltype in lambda causes internal compiler error
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevenxia990430 at gmail dot com
  Target Milestone: ---

The following program reports an internal compiler error: Segmentation fault

To quickly reproduce: https://gcc.godbolt.org/z/WPWjs116W
```
#include <vector>
#include <algorithm>

int main() {
    auto sort_fn = [](auto... vals) {
        return [=]() {
            decltype(vals) vec;
        }();
    };

    auto result = sort_fn();
}
```

Removing the decltype(vals) inside the lambda removes the internal compiler
error. 

This crash seems to happen after and including gcc 8.1 to gcc 12.2

Reply via email to