Clang fatal errors with the following error: error: variable 'test' cannot be implicitly captured in a lambda with no capture-default specified even though the variable is not referenced anywhere in the lambda.
Minimal reproducing input:
void foo() {
constexpr auto test = 42;
auto lambda = (test, []() noexcept(true) {});
}
test needs to be constexpr
- The lambda expression needs to be a parameter to an expression. It doesn't reproduce if the lambda expression is assigned to a variable first.
test needs to be passed as a parameter to the same expression.
- The
noexcept specifier needs any expression. Passing no expression does not reproduce. Just noexcept does not reproduce even though it should be semantically equivalent.
- Issue doesn't reproduce with LLVM 16 or any version of GCC.
Git bisect has shown this commit to be the culprit: 93d7002