diff --git a/examples/gg/drag_n_drop.v b/examples/gg/drag_n_drop.v index a2d8e43876..844ce97b18 100644 --- a/examples/gg/drag_n_drop.v +++ b/examples/gg/drag_n_drop.v @@ -10,7 +10,7 @@ const text_size = 16 struct App { mut: gg &gg.Context = unsafe { nil } - dropped_file_list []string = []string{} + dropped_file_list []string } fn main() { diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 419eaac6a7..47f4dd1374 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -1766,10 +1766,11 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast. // bug with fn... // fn f(p &Foo) => f(foo) -- do not allow this, force f(&foo) // if !c.is_builtin_mod - if param.typ == ast.voidptr_type && func.language == .v + else if param.typ == ast.voidptr_type && func.language == .v && arg_typ !in [ast.voidptr_type, ast.nil_type] && arg_typ.nr_muls() == 0 && func.name !in ['isnil', 'ptr_str'] && !func.name.starts_with('json.') - && arg_typ_sym.kind !in [.float_literal, .int_literal] && !c.pref.backend.is_js() { + && arg_typ_sym.kind !in [.float_literal, .int_literal, .charptr] + && !c.pref.backend.is_js() { c.warn('automatic ${arg_typ_sym.name} referencing/dereferencing into voidptr is deprecated and will be removed soon; use `foo(&x)` instead of `foo(x)`', call_arg.pos) }