1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

make unsafe dereferncing warning an error

This commit is contained in:
Alexander Medvednikov 2019-11-10 20:14:57 +03:00
parent ffa9646749
commit aea5b2e3b6

View File

@ -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`')