| Issue |
171451
|
| Summary |
Clang 19 regression: variable cannot be implicitly captured in a lambda with no capture-default specified
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
iK4tsu
|
Clang errors with `variable 'i' cannot be implicitly captured in a lambda with no capture-default specified` even though the variable is not being captured anywhere.
Minimal reproducible input:
```cpp
template<typename T>
void fun()
{
constexpr auto lamb = []<typename U>() consteval
{
return [](const int &i ){ (void) i; }
};
lamb.template operator()<T>();
}
int main()
{
fun<int>();
return 0;
}
```
[Godbolt](https://godbolt.org/z/d6TEcj4qo)
* It appears to be an issue with `consteval` and a templated lambda initialized in a templated context.
* This is a regression from **Clang 19 onwards**.
* **Removing `consteval` compiles**
* **Keeping `consteval`** but having the **templated lambda** in a **non templated context** also **compiles**
* **Keeping `consteval`** but having a **non templated lambda** in a **templated context** also **compiles**
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs