mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen,ci: fix cast_bool_to_int_test.v on windows-tcc
This commit is contained in:
parent
6f9070e06d
commit
c15d1c6e7e
@ -3961,9 +3961,9 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
|
||||
g.expr(node.expr)
|
||||
} else if node.expr_type == ast.bool_type && node.typ.is_int() {
|
||||
styp := g.typ(node.typ)
|
||||
g.write('($styp)(')
|
||||
g.write('($styp[]){(')
|
||||
g.expr(node.expr)
|
||||
g.write(')')
|
||||
g.write(')?1:0}[0]')
|
||||
} else {
|
||||
styp := g.typ(node.typ)
|
||||
if (g.pref.translated || g.file.is_translated) && sym.kind == .function {
|
||||
|
@ -2,6 +2,10 @@ module main
|
||||
|
||||
fn test_cast_bool_to_int() {
|
||||
i := true
|
||||
x := int(i)
|
||||
nx := int(!i)
|
||||
dump(x)
|
||||
dump(nx)
|
||||
a := [1, 2, 3]
|
||||
|
||||
println(a[int(!i)])
|
||||
|
Loading…
Reference in New Issue
Block a user