On Mon, Sep 08, 2014 at 11:40:41PM +0200, Mike Pall wrote: > Thank you for the bug report and the test case! Fixed in the git > repository. Thank you for the fix! Could LuaJIT compile the initialization of the first union field? The following code generates “NYI: unsupported C type conversion”: local ffi = require("ffi") ffi.cdef[[ typedef union { struct { double x, y, z, w; }; struct { double s0, s1, s2, s3; }; } cl_double4; ]] ffi.metatype("cl_double4", { __add = function(a, b) return ffi.typeof(a)(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w) end, }) local N = 100000 local v = ffi.new("cl_double4[?]", N) local x = ffi.new("cl_double4") for i = 0, N - 1 do x = x + v[i] end The goal is to define vector algebra for the OpenCL C vector types, which are defined as unions of unnamed structs to access components using different notations (x,y,z… or s0,s1,s2…). Thanks, Peter