Skip to content

History: fix strict-aliasing warnings by using std::ranges

Noah Davis requested to merge work/cherry-pick-aa55610f into release/24.05

With this patch, we no longer use reinterpret_cast to make the underlying data of the shared pointers in the undo and redo lists immutable.

Now we use std::ranges::transform_view and std::static_pointer_cast to make the underlying data immutable.

We also use std::ranges::subrange instead of std::span because std::span doesn't work with std::ranges views.

Gentoo and openSUSE Tumbleweed get strict-aliasing warnings with the -flto and -O3 GCC flags with the old behavior using reinterpret_cast.

Also see !321 (comment 969233)

(cherry picked from commit aa55610f)

Co-authored-by: Noah Davis noahadvs@gmail.com

Merge request reports