

playgroundにて以下の様に構造体に格納しようとしたところ、

setVer([SIMD2(-1.0,-1.0),

の箇所にて

error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION
(code=EXC_I386_INVOP, subcode=0x0).

というエラーが発生します。この様な場合どのように対処したらよいのでしょうか。

[code]

    private var testver: [Test]!
    
    struct Test {
        var testPos: SIMD2<Float>
        var testTex: SIMD2<Float>
        
        init(pos: SIMD2<Float>, ted: SIMD2<Float>) {
            self.testPos = pos
            self.testTex = ted
        }
    }
    
    
    
    func setVer(_ test: [SIMD2<Float>], coolt: [SIMD2<Float>]) {
        testver.append(Test(pos: test[0], ted: coolt[0]))
        return
    }
    
    setVer([SIMD2<Float>(-1.0,-1.0),
                          SIMD2<Float>(1.0,-1.0),
                          SIMD2<Float>(-1.0,1.0),
                          SIMD2<Float>(1.0,1.0)],
                         coolt: [SIMD2<Float>(1.0,1.0),
                                     SIMD2<Float>(0.0,1.0),
                                     SIMD2<Float>(0.0,0.0),
                                     SIMD2<Float>(1.0,0.0)])
    
[/code]


CC BY-SA 4.0
2021-05-30T06:30:27.327
76197
2021-05-30T06:30:27.327
14780
question
swift ios xcode
Swiftの構造体への格納で、error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).というエラー