aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2020-05-27 17:00:31 +0300
committerGitHub <noreply@github.com>2020-05-27 17:00:31 +0300
commit2ae9e06363b294f60b62e765d31fce4417e14a9d (patch)
tree2490713f0d933708c4e7b7fd0eaa48af141cba39 /test
parente61e8c94beba912400b71891d8bfcfa9c1c1d837 (diff)
parentcd5b7b9e1d56b22bc2267d5d94acec8d21c29110 (diff)
downloadzig-2ae9e06363b294f60b62e765d31fce4417e14a9d.tar.gz
zig-2ae9e06363b294f60b62e765d31fce4417e14a9d.zip
Merge pull request #5448 from Vexu/translate-c
Translate-c use correct scope in for loop condition
Diffstat (limited to 'test')
-rw-r--r--test/run_translated_c.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/run_translated_c.zig b/test/run_translated_c.zig
index 7dc64f068f..c7f7c2c5c6 100644
--- a/test/run_translated_c.zig
+++ b/test/run_translated_c.zig
@@ -256,4 +256,17 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
\\ return 0;
\\}
, "");
+
+ cases.add("scoped for loops with shadowing",
+ \\#include <stdlib.h>
+ \\int main() {
+ \\ int count = 0;
+ \\ for (int x = 0; x < 2; x++)
+ \\ for (int x = 0; x < 2; x++)
+ \\ count++;
+ \\
+ \\ if (count != 4) abort();
+ \\ return 0;
+ \\}
+ ,"");
}