summaryrefslogtreecommitdiff
path: root/test/SemaCXX/warn-loop-analysis.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:38 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:38 +0000
commit8746d127c04f5bbaf6c6e88cef8606ca5a6a54e9 (patch)
tree84c9d77f8c764f04bcef0b1da4eedfa233d67a46 /test/SemaCXX/warn-loop-analysis.cpp
parentcf1b401909b5e54edfd80656b1a18eaa31f9f6f1 (diff)
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);