| Issue |
115289
|
| Summary |
Clang rejects valid implicit capture of constexpr variables
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
cgnitash
|
The following [program](https://godbolt.org/z/shzn8aGTP) is rejected in all versions of Clang:
```
int main() {
constexpr int n{};
[] {
n; // error: variable 'n' cannot be implicitly captured in a lambda with no capture-default specified
};
}
```
Actually using `n` (i.e., reading it's value) makes the error go away.
This looks somewhat related to https://github.com/llvm/llvm-project/issues/57760, though this has nothing to do with `noexcept`, and this one is not a regression; it's been this way for all versions of Clang.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs