cgen,ci: fix cast_bool_to_int_test.v on windows-tcc
							parent
							
								
									3e1ff72247
								
							
						
					
					
						commit
						54e851f8de
					
				| 
						 | 
				
			
			@ -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