Skip to content

Commit

Permalink
ci,cgen: put the Interface(unsafe{nil}) change for now behind -expe…
Browse files Browse the repository at this point in the history
…rimental (#21593)
  • Loading branch information
spytheman authored May 29, 2024
1 parent 2d5c457 commit a601653
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -2564,12 +2564,14 @@ fn (mut g Gen) expr_with_cast(expr ast.Expr, got_type_raw ast.Type, expected_typ
if exp_sym.info.is_generic {
fname = g.generic_fn_name(exp_sym.info.concrete_types, fname)
}
// Do not allocate for `Interface(unsafe{nil})` casts
is_nil_cast := expr is ast.UnsafeExpr && expr.expr is ast.Nil
if is_nil_cast {
g.write('/*nili*/')
g.write('((void*)0)')
return
if g.pref.experimental {
// Do not allocate for `Interface(unsafe{nil})` casts
is_nil_cast := expr is ast.UnsafeExpr && expr.expr is ast.Nil
if is_nil_cast {
g.write('/*nili*/')
g.write('((void*)0)')
return
}
}
g.call_cfn_for_casting_expr(fname, expr, expected_is_ptr, exp_styp, got_is_ptr,
false, got_styp)
Expand Down

0 comments on commit a601653

Please sign in to comment.