]> granicus.if.org Git - clang/commitdiff
Add a test case for the regression in -Wfor-loop-analysis caused by r273548.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 23 Jun 2016 18:11:19 +0000 (18:11 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 23 Jun 2016 18:11:19 +0000 (18:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273590 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/warn-loop-analysis.cpp

index c666c48fc017f283d9729105223841c856bc8108..25ec7a7862edc3a65cc7cd67257258071d498608 100644 (file)
@@ -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) {}
+}