https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114821
--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Your patch gives me error compiling testcase
jh@ryzen3:/tmp> ~/trunk-install/bin/g++ -O3 ~/t.C
In file included from /home/jh/trunk-install/include/c++/14.0.1/vector:65,
from /home/jh/t.C:1:
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_uninitialized.h: In
instantiation of ‘_ForwardIterator std::__relocate_a(_InputIterator,
_InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = const
pair<unsigned int, unsigned int>*; _ForwardIterator = pair<unsigned int,
unsigned int>*; _Allocator = allocator<pair<unsigned int, unsigned int> >;
_Traits = allocator_traits<allocator<pair<unsigned int, unsigned int> > >]’:
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_uninitialized.h:1127:31:
required from ‘_Tp* std::__relocate_a(_Tp*, _Tp*, _Tp*, allocator<_T2>&) [with
_Tp = pair<unsigned int, unsigned int>; _Up = pair<unsigned int, unsigned
int>]’
1127 | return std::__relocate_a(__cfirst, __clast, __result, __alloc);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_vector.h:509:26: required
from ‘static std::vector<_Tp, _Alloc>::pointer std::vector<_Tp,
_Alloc>::_S_relocate(pointer, pointer, pointer, _Tp_alloc_type&) [with _Tp =
std::pair<unsigned int, unsigned int>; _Alloc =
std::allocator<std::pair<unsigned int, unsigned int> >; pointer =
std::pair<unsigned int, unsigned int>*; _Tp_alloc_type =
std::vector<std::pair<unsigned int, unsigned int> >::_Tp_alloc_type]’
509 | return std::__relocate_a(__first, __last, __result, __alloc);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jh/trunk-install/include/c++/14.0.1/bits/vector.tcc:647:32: required
from ‘void std::vector<_Tp, _Alloc>::_M_realloc_append(_Args&& ...) [with _Args
= {const std::pair<unsigned int, unsigned int>&}; _Tp = std::pair<unsigned int,
unsigned int>; _Alloc = std::allocator<std::pair<unsigned int, unsigned int>
>]’
647 | __new_finish = _S_relocate(__old_start, __old_finish,
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
648 | __new_start,
_M_get_Tp_allocator());
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_vector.h:1294:21: required
from ‘void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp =
std::pair<unsigned int, unsigned int>; _Alloc =
std::allocator<std::pair<unsigned int, unsigned int> >; value_type =
std::pair<unsigned int, unsigned int>]’
1294 | _M_realloc_append(__x);
| ~~~~~~~~~~~~~~~~~^~~~~
/home/jh/t.C:8:25: required from here
8 | stack.push_back (pair);
| ~~~~~~~~~~~~~~~~^~~~~~
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_uninitialized.h:1084:56:
error: use of deleted function ‘const _Tp* std::addressof(const _Tp&&) [with
_Tp = pair<unsigned int, unsigned int>]’
1084 |
std::addressof(std::move(*__first))))
|
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_pair.h:61,
from
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_algobase.h:64,
from /home/jh/trunk-install/include/c++/14.0.1/vector:62:
/home/jh/trunk-install/include/c++/14.0.1/bits/move.h:168:16: note: declared
here
168 | const _Tp* addressof(const _Tp&&) = delete;
| ^~~~~~~~~
/home/jh/trunk-install/include/c++/14.0.1/bits/stl_uninitialized.h:1084:56:
note: use ‘-fdiagnostics-all-candidates’ to display considered candidates
1084 |
std::addressof(std::move(*__first))))
|
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
It is easy to check if conversion happens - just compile it and see if there is
memcpy or memmove in the optimized dump file (or final assembly)