Skip to content

Commit 0005379

Browse files
committed
add FIXME test case
1 parent 93c8fc7 commit 0005379

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

clang/test/SemaCXX/warn-loop-analysis.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,11 @@ void test1() {
318318

319319
void test2() {
320320
int a = 0;
321+
int *c = &a;
322+
321323
auto incr_a = [a]() { };
322324
auto incr_b = [](int b) { };
325+
auto incr_c = [c]() { ++*c; };
323326

324327
for (int b = 10; a <= b; incr_a()) // expected-warning {{variables 'a' and 'b' used in loop condition not modified in loop body}}
325328
foo(a);
@@ -332,5 +335,9 @@ void test2() {
332335

333336
for (int b = 10; a <= b;) // expected-warning {{variables 'a' and 'b' used in loop condition not modified in loop body}}
334337
incr_b(b);
338+
339+
// FIXME: handle modification of loop control variable inside lambda body
340+
for (a = 10; a <= 20; incr_c()) // expected-warning {{variable 'a' used in loop condition not modified in loop body}}
341+
foo(a);
335342
}
336343
}

0 commit comments

Comments
 (0)