From: Peter Collingbourne Date: Thu, 23 Jun 2016 18:11:19 +0000 (+0000) Subject: Add a test case for the regression in -Wfor-loop-analysis caused by r273548. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4e95c76197d386452a9b4524a4a5429b32bce72;p=clang 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 --- 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) {} +}