https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95349
--- Comment #27 from rguenther at suse dot de <rguenther at suse dot de> --- On June 2, 2020 6:34:12 PM GMT+02:00, andrew2085 at gmail dot com <gcc-bugzi...@gcc.gnu.org> wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95349 > >--- Comment #25 from Andrew Downing <andrew2085 at gmail dot com> --- >Do you know how to change that example so that gcc's knowledge is >incomplete >and it not longer does the correct thing? Add std::launder ;) or, for example, conditionally assign another pointer incoming to the function before dereferencing it (untested).