I'm not sure why the first two cases aren't aligned: type MyArr = ref array[4, int] MyObj = ref object MyArrObj = ref object arr {.align(256).}: array[4, int] var arr {.align(256).}: MyArr var obj {.align(256).}: MyObj var arrObj: MyArrObj arr = new MyArr # not aligned obj = new MyObj # not aligned arrObj = new MyArrObj # arrObj.arr is aligned Run
Why aren't the ref types not aligned as expected? Only the field `arr` in the third type is aligned. It's a workaround I'm using, but it's forcing me to define a field that I don't need. My use case is the first type, i.e. the ref array, so I'm forced to do `arrObj.arr[i]` instead of just `arrObj[i]`.