https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77686

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #12)
> Index: libstdc++-v3/include/std/functional
> ===================================================================
> --- libstdc++-v3/include/std/functional (revision 240521)
> +++ libstdc++-v3/include/std/functional (working copy)
> @@ -1418,7 +1418,7 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, t
>  
>      _Nocopy_types _M_unused;
>      char _M_pod_data[sizeof(_Nocopy_types)];
> -  };
> +  } __attribute__((may_alias));
>  
>    enum _Manager_operation
>    {
> 
> fixes this testcase.  As std::swap takes reference args I suppose it should
> reliably work to prevent the issue.

I think this is the right fix. IIUC this is a valid use of may_alias, as the
whole point of _Any_data is that it can alias an unbounded set of types.

Reply via email to