Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Feb 22, 2025
1 parent 8e3ebc7 commit bddf86c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -3568,7 +3568,9 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type {
tt := c.table.type_to_str(to_type)
c.error('cannot cast incompatible option ${final_to_sym.name} `${ft}` to `${tt}`',
node.pos)
} else if !from_type.is_ptr() && final_from_sym.kind == .struct && final_to_sym.is_int() {
} else if !from_type.is_ptr() && final_from_sym.info is ast.Struct
&& !final_from_sym.info.is_empty_struct() && final_to_sym.kind != .rune
&& final_to_sym.is_int() {
ft := c.table.type_to_str(from_type)
tt := c.table.type_to_str(to_type)
c.error('cannot cast type `${ft}` to `${tt}`', node.pos)
Expand Down

0 comments on commit bddf86c

Please sign in to comment.