Skip to content

Commit

Permalink
add -d:nimWorkaround14447
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed May 28, 2020
1 parent d5d03b2 commit 832063d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion compiler/lambdalifting.nim
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ proc markAsClosure(g: ModuleGraph; owner: PSym; n: PNode) =
if illegalCapture(s):
localError(g.config, n.info,
("'$1' is of type <$2> which cannot be captured as it would violate memory" &
" safety, declared here: $3") % [s.name.s, typeToString(s.typ), g.config$s.info])
" safety, declared here: $3; using '-d:nimWorkaround14447' helps in some cases") %
[s.name.s, typeToString(s.typ), g.config$s.info])
elif owner.typ.callConv notin {ccClosure, ccDefault}:
localError(g.config, n.info, "illegal capture '$1' because '$2' has the calling convention: <$3>" %
[s.name.s, owner.name.s, CallingConvToStr[owner.typ.callConv]])
Expand Down
2 changes: 1 addition & 1 deletion lib/system/iterators.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
when defined(nimHasLentIterators):
when defined(nimHasLentIterators) and not defined(nimWorkaround14447):
template lent2(T): untyped =
# xxx this should actually depend on T.sizeof >= thresLentSizeof
# with for example `thresLentSizeof ~= int.sizeof`:
Expand Down
2 changes: 1 addition & 1 deletion testament/important_packages.nim
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ pkg2 "websocket", false, "nim c websocket.nim"
pkg2 "with"
pkg2 "ws"
pkg2 "yaml"
pkg2 "zero_functional", false, "nim c -r test.nim"
pkg2 "zero_functional", false, "nim c -r -d:nimWorkaround14447 test.nim"

0 comments on commit 832063d

Please sign in to comment.