@@ -1,7 +1,11 @@ |
|
|
|
1 |
1 |
// REQUIRES: host-supports-jit |
|
2 |
2 |
// UNSUPPORTED: system-aix |
|
|
3 |
+// At -O2, somehow "x = 42" appears first when piped into FileCheck, |
|
|
4 |
+// see https://github.com/llvm/llvm-project/issues/143547. |
|
|
5 |
+// UNSUPPORTED: system-windows |
|
3 |
6 |
// RUN: cat %s | clang-repl |
FileCheck %s |
4 |
|
-// RUN: cat %s | clang-repl -Xcc -O2 |
FileCheck %s |
|
7 |
+// RUN: cat %s | clang-repl -Xcc -Xclang -Xcc -verify -Xcc -O2 |
FileCheck %s |
|
8 |
+ |
|
5 |
9 |
extern "C" int printf(const char *, ...); |
|
6 |
10 |
|
|
7 |
11 |
auto l1 = []() { printf("ONE\n"); return 42; }; |
|
@@ -14,4 +18,14 @@ auto r2 = l2(); |
|
|
|
14 |
18 |
auto r3 = l2(); |
|
15 |
19 |
// CHECK: TWO |
|
16 |
20 |
|
|
17 |
|
-%quit |
|
|
21 |
+// Verify non-local lambda capture error is correctly reported |
|
|
22 |
+int x = 42; |
|
|
23 |
+ |
|
|
24 |
+// expected-error {{non-local lambda expression cannot have a capture-default}} |
|
|
25 |
+auto capture = [&]() { return x * 2; }; |
|
|
26 |
+ |
|
|
27 |
+// Ensure interpreter continues and x is still valid |
|
|
28 |
+printf("x = %d\n", x); |
|
|
29 |
+// CHECK: x = 42 |
|
|
30 |
+ |
|
|
31 |
+%quit |
|