-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
What happened?
Using prod
in a type definition causes the compiler to fail with an uninformative error message.
import std/math
type Foo[S:static[array[2, int]]] = object
values: array[prod(S), float]
echo sizeof(Foo[[4,5]])
Curiously, replacing prod
with sum
causes a different outcome. The below program erroneously prints 1
:
import std/math
type Foo[S:static[array[2, int]]] = object
values: array[sum(S), float]
echo sizeof(Foo[[4,5]])
Nim Version
Nim Compiler Version 1.7.3 [Windows: amd64]
Compiled at 2022-10-07
Copyright (c) 2006-2022 by Andreas Rumpf
active boot switches: -d:release
Current Standard Output Logs
C:\Users\dan\.choosenim\toolchains\nim-#devel\lib\pure\math.nim(357, 3) Error: cannot generate VM code for result
Expected Standard Output Logs
No response
Possible Solution
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels