[swift-users] swift 4.0 complains/warns about swapping array elements

Edward Connell ewconnell at gmail.com
Fri May 19 12:10:44 CDT 2017

I just switched to the 5/17 swift 4.0 tool chain on Linux, and I am getting
the following complaint when using swap on array elements. Is this warning
legitimate because of a copy on write issue? If so, is there some new swap
function for array elements? I realize I can turn 1 line into 3 and do the
swapping myself, it's just verbose.

*warning: simultaneous accesses to var 'dims', but modification requires
exclusive access; consider copying to a local variable*
*                                swap(&dims[lastIndex], &dims[lastIndex-1])*

Thanks, Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170519/0dec7671/attachment.html>

More information about the swift-users mailing list