Skip to content

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

Noah Davis requested to merge work/ndavis/strict-aliasing into master

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)

@aarsen, @thesamesam

Edited by Noah Davis

Merge request reports