From c647799e5eb8fddc7ab0a8af161f2a7634ec7912 Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Sun, 28 May 2023 03:12:14 +0200 Subject: [PATCH] test cases: expected optional type in for loop Closes #10674 --- .../compile_errors/expected_optional_type_in_for.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/cases/compile_errors/expected_optional_type_in_for.zig diff --git a/test/cases/compile_errors/expected_optional_type_in_for.zig b/test/cases/compile_errors/expected_optional_type_in_for.zig new file mode 100644 index 0000000000..5efe468dce --- /dev/null +++ b/test/cases/compile_errors/expected_optional_type_in_for.zig @@ -0,0 +1,10 @@ +export fn entry() void { + var items = [_]u8{ 1, 2, 3 }; + for (&items) |*i| { + i.?.* = 1; + } +} + +// error +// +// :4:10: error: expected optional type, found '*u8'