Issue 176585
Summary Function parameter is accessible inside of default argument lambda
Labels new issue
Assignees
Reporter dgodfrey206
    This should be ill-formed since the parameter is being odr-used in an evaluated context. Moreover, `x` should not be accessible from within the lambda since it isn't captured.

```cpp
void foo( int x, int (*)() = []{ return x; } );
```

An additional issue is that adding a capture clause to this lambda still allows it to be converted to a function pointer:

```cpp
void foo( int x, int (*)() = [x]{ return x; } );
```

https://godbolt.org/z/W6WzKPa9r
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to