@encode should handle simd types

Number:rdar://38239157 Date Originated:3/7/2018
Status:Open Resolved:
Product:macOS + SDK Product Version:
Classification:Suggestion Reproducible:
When attempting to @encode simd types such as simd_float3, Clang reports, "Encoding of 'simd_float3' (vector of 3 'float' values) type is incomplete because 'simd_float3' component has unknown encoding", and @encode returns the empty string. This makes it impossible to use the expression "@encode(simd_float3)" to box a simd_float3 into an NSValue, which is useful for implementing KVC for types that have properties with simd value type.

One possible workaround is to treat simd vectors as if they were C arrays of the element type (i.e., @encode(float[4]), but this relies on the implementation detail that simd_float3 is comprised of packed floats (and, pedantically, that it has 4 elements instead of 3).


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!