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
I had a project that was compiling fine in v2.0.0.
I upgraded to v.2.2.0 and the compiler would segfault with:
Error: internal error: invalid kind for floatRangeCheck:tyGenericParam
SIGSEGV: Illegal storage access. (Attempt to read from nil?
I upgraded to v.2.2.2 and now get this :
Error: type mismatch:
got 'typeof(T.high)' for 'T.high' [fromExpr]
but expected 'typeof(T.high)' [fromExpr]
I was able to construct an example:
funcinitArray[T](arg: array[1, T] = [T.high]): array[1, T] =return arg
echoinitArray[float]() # this would compile and print [inf] in previous versions.
This bug at least affects arrays and seq's, however this still works:
funcinitValue[T](arg: T = T.high): T =return arg
echoinitValue[float]() # this compiles and prints inf.
Also note that things like 100.0.T will not compile but a default value of just 100.0 will compile.
Nim Version
v2.0.0 works
v2.2.0 and v2.2.2 do not work
Current Output
Error: type mismatch:
got 'typeof(T.high)' for 'T.high' [fromExpr]
but expected 'typeof(T.high)' [fromExpr]
Expected Output
[inf]
Known Workarounds
No response
Additional Information
Compiled on Linux with GCC using the C or C++ backends and ORC.
The text was updated successfully, but these errors were encountered:
Clemente90
changed the title
"Nim v2.2.0 and v2.2.2: Compilation Error When Using Template Parameter in Default Argument for Array/Sequence"
Nim v2.2.0 and v2.2.2: Compilation Error When Using Template Parameter in Default Argument for Array/Sequence
Feb 7, 2025
Description
I had a project that was compiling fine in v2.0.0.
I upgraded to v.2.2.0 and the compiler would segfault with:
I upgraded to v.2.2.2 and now get this :
I was able to construct an example:
This bug at least affects arrays and seq's, however this still works:
Also note that things like
100.0.T
will not compile but a default value of just100.0
will compile.Nim Version
v2.0.0 works
v2.2.0 and v2.2.2 do not work
Current Output
Expected Output
Known Workarounds
No response
Additional Information
Compiled on Linux with GCC using the C or C++ backends and ORC.
The text was updated successfully, but these errors were encountered: