summaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-loop-analysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/warn-loop-analysis.cpp')
-rw-r--r--test/SemaCXX/warn-loop-analysis.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-loop-analysis.cpp b/test/SemaCXX/warn-loop-analysis.cpp
index 25ec7a7862edc..2934003848a28 100644
--- a/test/SemaCXX/warn-loop-analysis.cpp
+++ b/test/SemaCXX/warn-loop-analysis.cpp
@@ -202,6 +202,12 @@ void test7() {
if (true) continue;
i--;
}
+
+ // But do warn if the continue is in a nested loop.
+ for (;;i--) { // expected-note{{decremented here}}
+ for (int j = 0; j < 10; ++j) continue;
+ i--; // expected-warning{{decremented both}}
+ }
}
struct iterator {
@@ -259,6 +265,12 @@ void test8() {
if (true) continue;
i--;
}
+
+ // But do warn if the continue is in a nested loop.
+ for (;;i--) { // expected-note{{decremented here}}
+ for (int j = 0; j < 10; ++j) continue;
+ i--; // expected-warning{{decremented both}}
+ }
}
int f(int);