Skip to content

Commit

Permalink
do not allow vector literals
Browse files Browse the repository at this point in the history
<andrewrk> tomorrow, end of day, ziglang#3580 will be closed and ziglang#3575 will be
closed, and dimenus's examples will work (except for vector literals which
is not happening, see ziglang#208)
  • Loading branch information
shawnl committed Nov 5, 2019
1 parent 5205a50 commit 5c25e26
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion src/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20077,7 +20077,7 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
return ir_analyze_container_init_fields(ira, &instruction->base, container_type, 0, nullptr, result_loc);
}

if (container_type->id != ZigTypeIdArray && container_type->id != ZigTypeIdVector) {
if (container_type->id != ZigTypeIdArray) {
ir_add_error_node(ira, instruction->base.source_node,
buf_sprintf("type '%s' does not support array initialization",
buf_ptr(&container_type->name)));
Expand Down
10 changes: 0 additions & 10 deletions test/stage1/behavior/vector.zig
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,6 @@ test "vector access elements - store" {
}
}

test "vector literal" {
const S = struct {
fn doTheTest() void {
var foo = @Vector(4, f32) { 1, 2, 3, 4 };
}
};
S.doTheTest();
comptime S.doTheTest();
}

const Vec4Obj = struct {
data: @Vector(4, f32),
};
Expand Down

0 comments on commit 5c25e26

Please sign in to comment.