I have a type defined as %Colour = type { { i32, i32, i32 }, %RED*, %GREEN*, %BLUE*, %RGB* }, I use the first field to store RTTI, I load the field at Colour*.0.0.2 and have it in a variable "arity" but when I try to do a GEP on the object again to get the RGB* with builder.CreateInBoundsGEP(valType, val, {builder.getInt32(0), arity}) I'm getting a "Invalid GetElementPtrInst indices for type!". Dumping the type of arity I get i32 as I expected, what am I doing wrong?
Can I not use a runtime value in a GEP? I ask because, after I ran into this, I tried changing it to builder.CreateInBoundsGEP(valType, val, {builder.getInt32(0), builder.getInt32(4)}) which produce the expected result of %2 = getelementptr inbounds %Colour, %Colour* %0, i32 0, i32 4 so I could then load it %3 = load %RGB*, %RGB** %2