Skip to content

Commit 6422d70

Browse files
committed
fix expr_sym
1 parent d17faa6 commit 6422d70

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

vlib/v/gen/c/cgen.v

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5652,10 +5652,11 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
56525652
node_typ := g.unwrap_generic(node.typ)
56535653
mut expr_type := node.expr_type
56545654
sym := g.table.sym(node_typ)
5655-
final_sym := g.table.final_sym(node_typ)
56565655
if g.comptime.is_comptime(node.expr) {
56575656
expr_type = g.unwrap_generic(g.type_resolver.get_type(node.expr))
56585657
}
5658+
expr_sym := g.table.sym(expr_type)
5659+
final_expr_sym := g.table.final_sym(expr_type)
56595660
node_typ_is_option := node.typ.has_flag(.option)
56605661
if sym.kind in [.sum_type, .interface] {
56615662
if g.table.unaliased_type(expr_type) == node_typ {
@@ -5674,7 +5675,8 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
56745675
}
56755676
} else if !node_typ_is_option && !node_typ.is_ptr() && !expr_type.is_ptr()
56765677
&& ((sym.info is ast.Struct && !sym.info.is_typedef)
5677-
|| (sym.kind == .alias && final_sym.info is ast.Struct && !final_sym.info.is_typedef)) {
5678+
|| (expr_sym.kind == .alias && final_expr_sym.info is ast.Struct
5679+
&& !final_expr_sym.info.is_typedef)) {
56785680
// deprecated, replaced by Struct{...exr}
56795681
styp := g.styp(node_typ)
56805682
g.write('*((${styp} *)(&')

0 commit comments

Comments
 (0)