================
@@ -299,3 +299,38 @@ void test10() {
   for (auto[i, j, k] = arr; i < a; ++i) { }
   for (auto[i, j, k] = arr; i < a; ++arr[0]) { }
 };
+
+namespace GH132038 {
+extern void foo(int);
+void test1() {
+  int a = 0;
+  auto incr_a = [&a]() { ++a; };
+
+  for (int b = 10; a <= b; incr_a())
+    foo(a);
+
+  for (int b = 10; a <= b;)
+    incr_a();
+
+  for (int b = 10; a <= b; [&a]() { ++a; }()) { }
+  for (int b = 10; a <= b; [&a]() { }()) { }
----------------
zyn0217 wrote:

Can you test this case?

```cpp
void test() {
  int a = 0;
  int *b = &a;
  auto increase = [b]() { ++*b; };
  for (int a = 10; a <= 20; increase()) {}
}
```


https://github.com/llvm/llvm-project/pull/135573
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to