[clang] [clang-repl] Fix error recovery while PTU cleanup (PR #127467)
Anutosh Bhat via cfe-commits
cfe-commits at lists.llvm.org
Tue May 13 01:30:15 PDT 2025
================
@@ -14,4 +15,13 @@ auto r2 = l2();
auto r3 = l2();
// CHECK: TWO
-%quit
+// Verify non-local lambda capture error is correctly reported
+int x = 42;
+
+// expected-error {{non-local lambda expression cannot have a capture-default}}
+auto capture = [&]() { return x * 2; };
+
----------------
anutosh491 wrote:
Sorry, I think I might have missed this.
If I remember correctly, the above is an expected error
```
clang-repl> int x = 42; auto capture = [&]() { return x * 2; };
In file included from <<< inputs >>>:1:
input_line_1:1:28: error: non-local lambda expression cannot have a capture-default
1 | int x = 42; auto capture = [&]() { return x * 2; };
| ^
error: Parsing failed.
```
So we wouldn't have to check for the value to be 84 here !
https://github.com/llvm/llvm-project/pull/127467
More information about the cfe-commits
mailing list