mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
* fixes #14444; add `genLineDir` before raises
* add a test case
* fixes differently
(cherry picked from commit 705da9d452)
This commit is contained in:
@@ -1592,6 +1592,7 @@ proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) =
|
||||
initLoc(a, locNone, le, OnUnknown)
|
||||
a.flags.incl(lfEnforceDeref)
|
||||
a.flags.incl(lfPrepareForMutation)
|
||||
genLineDir(p, le) # it can be a nkBracketExpr, which may raise
|
||||
expr(p, le, a)
|
||||
a.flags.excl(lfPrepareForMutation)
|
||||
if fastAsgn: incl(a.flags, lfNoDeepCopy)
|
||||
|
||||
14
tests/errmsgs/t14444.nim
Normal file
14
tests/errmsgs/t14444.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
matrix: "--hints:off"
|
||||
exitcode: "1"
|
||||
output: '''
|
||||
t14444.nim(13) t14444
|
||||
fatal.nim(54) sysFatal
|
||||
Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
|
||||
'''
|
||||
"""
|
||||
|
||||
when true: # bug #14444
|
||||
var i: string
|
||||
i[10] = 'j'
|
||||
echo i
|
||||
Reference in New Issue
Block a user