Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Delta456 committed Jan 2, 2024
1 parent 53f57fc commit bc74361
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,7 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type {
tt := c.table.type_to_str(to_type)
c.error('cannot cast string to `${tt}`, use `${snexpr}[index]` instead.', node.pos)
} else if final_from_sym.kind == .string && to_type.is_voidptr()
&& !node.expr_type.has_flag(.generic) {
&& !node.expr_type.has_flag(.generic) && !from_type.is_ptr() {
c.error('cannot cast string to `voidptr`, use voidptr(s.str) instead', node.pos)
} else if final_from_sym.kind == .string && to_type.is_pointer() && !c.inside_unsafe {
tt := c.table.type_to_str(to_type)
Expand Down

0 comments on commit bc74361

Please sign in to comment.