Issue |
122710
|
Summary |
[clang] incorrectly tries to capture constexpr variable in lambda with parenthesized noexcept specifier
|
Labels |
clang
|
Assignees |
|
Reporter |
cgnitash
|
The following program https://godbolt.org/z/jTdY6d81n:
```
template<typename ...Ts>
void f(Ts...) {}
int main (){
constexpr int n = 42;
f(n, []() noexcept (true) {});
}
```
is rejected by Clang starting from llvm-17 with
> error: variable 'n' cannot be implicitly captured in a lambda with no capture-default specified
which is obviously wrong.
Note that the `noexcept (/* expr */)` is necessary to reproduce this (dropping the `noexcept`, or using just the `noexcept` without a `(/* expr */)` doesn't manifest the bug).
This is very similar to https://github.com/llvm/llvm-project/issues/120503 except that
1. The cause in that case seems unrelated to `noexcept`.
2. That bug was introduced in llvm-16, whereas this bug only happens from llvm-17.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs