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

checker: make null warning an error

This commit is contained in:
Alexander Medvednikov 2023-02-01 18:01:55 +01:00
parent e70848a98b
commit 322eb8197d

View File

@ -147,7 +147,7 @@ fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
if field.typ.is_ptr() { if field.typ.is_ptr() {
if field.default_expr is ast.IntegerLiteral { if field.default_expr is ast.IntegerLiteral {
if !c.inside_unsafe && !c.is_builtin_mod && field.default_expr.val == '0' { if !c.inside_unsafe && !c.is_builtin_mod && field.default_expr.val == '0' {
c.warn('default value of `0` for references can only be used inside `unsafe`', c.error('default value of `0` for references can only be used inside `unsafe`',
field.default_expr.pos) field.default_expr.pos)
} }
} }