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
Foo :: struct($N: int) where N >= 0 {
to_init: int,
elems: [N]int,
}
new_foo :: proc($N : int) -> (foo: Foo(N)) {
foo.to_init = 1return
}
main :: proc() {
SIZE :: 1000
f := new_foo(SIZE)
}
Is expected that the variable foo will be successfully initialized by the procedure new_foo since the constant SIZE is greater than 0 (thus respecting the where clause) and the size of the underlying array is passed through the constant procedure parameter $N.
Current Behavior
While trying to compile, the initialization of the variable foo cause the compiler to fail. This has been discovered while trying to wrap a Small_Array in a struct carrying extra information.
Failure Information (for bugs)
Trying to initialize the wrapper of a Small_Array, the compiler gives the following logs:
~/odin-lang/Odin/core/container/small_array/small_array.odin(7:16) Error: at caller location
Small_Array :: struct($N: int, $T: typeid) where N >= 0 { ...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
~/odin-lang/Odin/core/container/small_array/small_array.odin(7:50) Error: 'where' clauses expect a constant boolean evaluation
Small_Array :: struct($N: int, $T: typeid) where N >= 0 {
^~~~~^
Wrapping an array in a struct with a where clause of where N >= 0, the compiler gives the following logs:
~/main.odin(13:8) Error: at caller location
Foo :: struct($N : int) where N >= 0 { ...
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
~/main.odin(13:31) Error: 'where' clauses expect a constant boolean evaluation
Foo :: struct($N : int) where N >= 0 {
^~~~~^
The text was updated successfully, but these errors were encountered:
Setup
Expected Behavior
Given the following code:
Is expected that the variable
foo
will be successfully initialized by the procedurenew_foo
since the constantSIZE
is greater than 0 (thus respecting thewhere
clause) and the size of the underlying array is passed through the constant procedure parameter$N
.Current Behavior
While trying to compile, the initialization of the variable
foo
cause the compiler to fail. This has been discovered while trying to wrap aSmall_Array
in a struct carrying extra information.Failure Information (for bugs)
Trying to initialize the wrapper of a
Small_Array
, the compiler gives the following logs:Wrapping an array in a struct with a where clause of
where N >= 0
, the compiler gives the following logs:The text was updated successfully, but these errors were encountered: