https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128490
Bug ID: 128490
Summary: internal compiler error: in lambda_expr_this_capture,
at cp/lambda.cc
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 0599jiangyc at gmail dot com
Target Milestone: ---
The following code:
```cpp
struct S {
int x;
auto f() { return [this](this auto) { return this->x; }; }
};
void g() { S s; s.f(); }
```
Resulted in this output:
```
<source>:3:3: error: 'f' function uses 'auto' type specifier without trailing
return type
<source>:3:33: error: use of 'auto' in lambda parameter declaration only
available with '-std=c++14' or '-std=gnu++14'
<source>:3:28: error: a lambda with captures may not have an explicit object
parameter of an unrelated type
<source>:3:48: internal compiler error: in lambda_expr_this_capture, at
cp/lambda.cc:850
```
Trunk reproducer (`-std=c++11`): https://godbolt.org/z/EMqhahxGb