mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix spurious autoref bug, for struct init of a &C.type field, with a byteptr value
This commit is contained in:
parent
74ebce6b1f
commit
0e55534c6e
@ -3850,7 +3850,8 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) {
|
||||
}
|
||||
}
|
||||
if !cloned {
|
||||
if field.expected_type.is_ptr() && !field.typ.is_ptr() && !field.typ.is_number() {
|
||||
if field.expected_type.is_ptr() && !(field.typ.is_ptr() || field.typ.is_pointer()) &&
|
||||
!field.typ.is_number() {
|
||||
g.write('/* autoref */&')
|
||||
}
|
||||
g.expr_with_cast(field.expr, field.typ, field.expected_type)
|
||||
@ -3889,7 +3890,8 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) {
|
||||
}
|
||||
}
|
||||
if !cloned {
|
||||
if sfield.expected_type.is_ptr() && !sfield.typ.is_ptr() && !sfield.typ.is_number() {
|
||||
if sfield.expected_type.is_ptr() && !(sfield.typ.is_ptr() || sfield.typ.is_pointer()) &&
|
||||
!sfield.typ.is_number() {
|
||||
g.write('/* autoref */&')
|
||||
}
|
||||
g.expr_with_cast(sfield.expr, sfield.typ, sfield.expected_type)
|
||||
|
Loading…
Reference in New Issue
Block a user