Skip to content

Commit

Permalink
checker: disallow constant modification on unsafe {} (#23588)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp authored Jan 28, 2025
1 parent 81fd0db commit 15e3f62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ fn (mut c Checker) fail_if_immutable(mut expr ast.Expr) (string, token.Pos) {
}
}
} else if expr.obj is ast.ConstField && expr.name in c.const_names {
if !c.inside_unsafe && !c.pref.translated {
if !c.pref.translated {
// TODO: fix this in c2v, do not allow modification of all consts
// in translated code
c.error('cannot modify constant `${expr.name}`', expr.pos)
Expand Down

0 comments on commit 15e3f62

Please sign in to comment.