From bc7436102afd9129f47ef03c55e3937fe689aeaf Mon Sep 17 00:00:00 2001 From: Swastik Date: Tue, 2 Jan 2024 21:54:23 +0530 Subject: [PATCH] fix --- vlib/v/checker/checker.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 23ee9d217f6901..ae1187448c330f 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3181,7 +3181,7 @@ fn (mut c Checker) cast_expr(mut node ast.CastExpr) ast.Type { tt := c.table.type_to_str(to_type) c.error('cannot cast string to `${tt}`, use `${snexpr}[index]` instead.', node.pos) } else if final_from_sym.kind == .string && to_type.is_voidptr() - && !node.expr_type.has_flag(.generic) { + && !node.expr_type.has_flag(.generic) && !from_type.is_ptr() { c.error('cannot cast string to `voidptr`, use voidptr(s.str) instead', node.pos) } else if final_from_sym.kind == .string && to_type.is_pointer() && !c.inside_unsafe { tt := c.table.type_to_str(to_type)