Adapted from documentation:
using ComponentArrays
c = (a=2, b=[1, 2]);
x = ComponentArray(a=1, b=[2, 1, 4], c=c)
x2 = x .* x'
good = sum(abs2, x)
bad = sum(abs2, x2) # fails here
workaround = sum(abs2, getdata(x2)) # succeeds
The fact that the 1-dimensional version works without getdata, but the 2-dimensional form needs it is what tripped me up. Would be nice if the error could be handled automatically, but if not, the workaround is fine.
Error message:
ERROR: MethodError: no method matching abs2(::SubArray{Float64,0,Array{Float64,2},Tuple{Int64,Int64},true})