From aea5b2e3b65932373562206cd9c5df240de1811c Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 10 Nov 2019 20:14:57 +0300 Subject: [PATCH] make unsafe dereferncing warning an error --- vlib/compiler/parser.v | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 46cfba9aa6..f61abe6174 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -1482,9 +1482,8 @@ fn (p mut Parser) get_var_type(name string, is_ptr bool, is_deref bool) string { // *var if is_deref { if !p.inside_unsafe { - p.warn('dereferencing can only be done inside an `unsafe` block') + p.error('dereferencing can only be done inside an `unsafe` block') } - if !typ.contains('*') && !typ.ends_with('ptr') { println('name="$name", t=$v.typ') p.error('dereferencing requires a pointer, but got `$typ`')