Skip to content

Commit 15e3f62

Browse files
authored
checker: disallow constant modification on unsafe {} (#23588)
1 parent 81fd0db commit 15e3f62

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎vlib/v/checker/checker.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ fn (mut c Checker) fail_if_immutable(mut expr ast.Expr) (string, token.Pos) {
921921
}
922922
}
923923
} else if expr.obj is ast.ConstField && expr.name in c.const_names {
924-
if !c.inside_unsafe && !c.pref.translated {
924+
if !c.pref.translated {
925925
// TODO: fix this in c2v, do not allow modification of all consts
926926
// in translated code
927927
c.error('cannot modify constant `${expr.name}`', expr.pos)

0 commit comments

Comments
 (0)