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 tried to make a quaternion, and any method other than direct field assignment after definition caused either an assertion failure or a panic. I saw the first error and thought that was fine, but both methods of construction that are said to be required are not functioning. I decided to try assigning the values first with explicit types, then placing them in the struct, and that resulted in the panic.
package cq
import"core:fmt"
main :: proc () {
// Error: 'quaternion' requires that all arguments are named (w, x, y, z; or real, imag, jmag, kmag)
fmt.printfln("%#v", quaternion(-0,0,0,-0))
// src/llvm_backend_const.cpp(155): Assertion Failure: `bt->kind == Type_Struct`
fmt.printfln("%#v", quaternion(w = -0, x = 0, y = 0, z = -0))
// src/llvm_backend_const.cpp(155): Assertion Failure: `bt->kind == Type_Struct`
fmt.printfln("%#v", quaternion(real = -0, imag = 0, jmag = 0, kmag = -0))
// src/types.cpp(1746): Panic: Invalid complex type
w, x, y, z: f32 = 0, 0, 0, 0
fmt.printfln("%#v", quaternion(w = w, x = x, y = y, z = z))
// This works fine:
q: quaternion64
q.w = 3
fmt.printfln("%#v", q)
}
The text was updated successfully, but these errors were encountered:
I did some more investigation into this. It is at least partly connected to the assignment by the BuiltinProc to an any datatype. A similar issue is happening with complex and swizzle.
One is that BuiltinProc_* is not taking into account the assignment of complex and quaternions to an any datatype, which I was able to figure out how to solve for complex at least, by building a new complex on the stack and putting that in the any. The other is that the const backend doesn't seem to handle that situation either. You can produce two different segfaults, depending on if you do a: any = complex(1,2) or a: any = complex(i,j).
I'm at the moment stumped on how to handle the second problem. I had a look at constant strings, since they're internally structs and somehow get assigned to an any type just fine, but I haven't found out how that happens yet.
I tried to make a quaternion, and any method other than direct field assignment after definition caused either an assertion failure or a panic. I saw the first error and thought that was fine, but both methods of construction that are said to be required are not functioning. I decided to try assigning the values first with explicit types, then placing them in the struct, and that resulted in the panic.
The text was updated successfully, but these errors were encountered: