Skip to content

Commit a601653

Browse files
authored
ci,cgen: put the Interface(unsafe{nil}) change for now behind -experimental (#21593)
1 parent 2d5c457 commit a601653

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

vlib/v/gen/c/cgen.v

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,12 +2564,14 @@ fn (mut g Gen) expr_with_cast(expr ast.Expr, got_type_raw ast.Type, expected_typ
25642564
if exp_sym.info.is_generic {
25652565
fname = g.generic_fn_name(exp_sym.info.concrete_types, fname)
25662566
}
2567-
// Do not allocate for `Interface(unsafe{nil})` casts
2568-
is_nil_cast := expr is ast.UnsafeExpr && expr.expr is ast.Nil
2569-
if is_nil_cast {
2570-
g.write('/*nili*/')
2571-
g.write('((void*)0)')
2572-
return
2567+
if g.pref.experimental {
2568+
// Do not allocate for `Interface(unsafe{nil})` casts
2569+
is_nil_cast := expr is ast.UnsafeExpr && expr.expr is ast.Nil
2570+
if is_nil_cast {
2571+
g.write('/*nili*/')
2572+
g.write('((void*)0)')
2573+
return
2574+
}
25732575
}
25742576
g.call_cfn_for_casting_expr(fname, expr, expected_is_ptr, exp_styp, got_is_ptr,
25752577
false, got_styp)

0 commit comments

Comments
 (0)