Skip to content

map! does not check for aliasing #46352

@jakobnissen

Description

@jakobnissen
julia> x = [1,2]
2-element Vector{Int64}:
 1
 2

julia> map!(i -> i + 1, x, view(x, 2:-1:1))
2-element Vector{Int64}:
 3
 4

This is silently incorrect. The result should be [3, 2].
Throwing an error would probably be preferable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions