You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
templatefoo() =
{.checks: off.}
var s2 =newSeq[int](0)
s2[0] =0foo()
Current Output
Example #1: Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
Example #2: IndexDefect, but not in foo(), but rather in the global/module scope array indexing
Example #3: no IndexDefect, i.e. the pragma appears to function as intended
Example #4: no IndexDefect, so unlike with the proc() (example #1), a template indeed behaves more like example #3
Tested with
Nim Compiler Version 1.2.16 [Linux: amd64]
Compiled at 2022-03-07
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: c6a9f27b3e36bae9aacec1bd6c37893fb98fd33f
active boot switches: -d:release
(s/Defect/Error/, but otherwise the same)
Nim Compiler Version 1.6.4 [Linux: amd64]
Compiled at 2022-02-10
Copyright (c) 2006-2021 by Andreas Rumpf
Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2022-03-14
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: 4c76f9f1523a72f560138709642c2d51ea365b85
active boot switches: -d:release
Expected Output
Not this.
Possible Solution
Avoid pragmas?
Additional Information
I came across these when attempting to selectively enable and disable pragmas to potentially isolate sections of code which
These are related to #19603 but whereas that issue points to a case where pragmas have too much effect, this points to them having too little effect. Reasonably likely a shared set of root causes though.
The text was updated successfully, but these errors were encountered:
Pragmas affect unintuitive parts of code.
Example
Example #1
Example #2
Example #3
Example #4
Current Output
Example #1:
Error: unhandled exception: index out of bounds, the container is empty [IndexDefect]
Example #2:
IndexDefect
, but not infoo()
, but rather in the global/module scope array indexingExample #3: no
IndexDefect
, i.e. the pragma appears to function as intendedExample #4: no
IndexDefect
, so unlike with theproc()
(example #1), a template indeed behaves more like example #3Tested with
(
s/Defect/Error/
, but otherwise the same)Expected Output
Not this.
Possible Solution
Avoid pragmas?
Additional Information
I came across these when attempting to selectively enable and disable pragmas to potentially isolate sections of code which
These are related to #19603 but whereas that issue points to a case where pragmas have too much effect, this points to them having too little effect. Reasonably likely a shared set of root causes though.
The text was updated successfully, but these errors were encountered: