summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-06-23 18:11:19 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-06-23 18:11:19 +0000
commitc4e95c76197d386452a9b4524a4a5429b32bce72 (patch)
tree5c87eedff915c8a8ffea5aadb5511ec9bb4afcb9
parentc52adef5294f5fbd13ebe631db2b77390807aa73 (diff)
Add a test case for the regression in -Wfor-loop-analysis caused by r273548.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273590 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/SemaCXX/warn-loop-analysis.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/SemaCXX/warn-loop-analysis.cpp b/test/SemaCXX/warn-loop-analysis.cpp
index c666c48fc0..25ec7a7862 100644
--- a/test/SemaCXX/warn-loop-analysis.cpp
+++ b/test/SemaCXX/warn-loop-analysis.cpp
@@ -260,3 +260,9 @@ void test8() {
i--;
}
}
+
+int f(int);
+void test9() {
+ // Don't warn when variable is defined by the loop condition.
+ for (int i = 0; int x = f(i); ++i) {}
+}