mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: remove warning of casting same reference type (#17579)
This commit is contained in:
parent
368604f9a5
commit
038fa6c8ab
@ -2872,7 +2872,7 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type {
|
|||||||
'a variadic'
|
'a variadic'
|
||||||
}
|
}
|
||||||
c.error('cannot type cast ${msg}', node.pos)
|
c.error('cannot type cast ${msg}', node.pos)
|
||||||
} else if !c.inside_unsafe && to_type.is_ptr() && from_type.is_ptr()
|
} else if !c.inside_unsafe && to_type.is_ptr() && from_type.is_ptr() && to_type != from_type
|
||||||
&& to_type.deref() != ast.char_type && from_type.deref() != ast.char_type {
|
&& to_type.deref() != ast.char_type && from_type.deref() != ast.char_type {
|
||||||
ft := c.table.type_to_str(from_type)
|
ft := c.table.type_to_str(from_type)
|
||||||
tt := c.table.type_to_str(to_type)
|
tt := c.table.type_to_str(to_type)
|
||||||
|
1
vlib/v/slow_tests/inout/cast_to_reference_type.out
Normal file
1
vlib/v/slow_tests/inout/cast_to_reference_type.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
&&nil
|
5
vlib/v/slow_tests/inout/cast_to_reference_type.vv
Normal file
5
vlib/v/slow_tests/inout/cast_to_reference_type.vv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
fn main() {
|
||||||
|
a := &&char(unsafe { nil })
|
||||||
|
b := &&char(a)
|
||||||
|
println(b)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user