[Bug libstdc++/90934] std::vector self-move-insert yields incorrect result
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 19 13:42:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90934
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is undefined behaviour.
[res.on.arguments] p1(1.3) says "If a function argument binds to an rvalue
reference parameter, the implementation may assume that this parameter is a
unique reference to this argument."
You have created an rvalue reference to an object which is already referenced
by the vector itself, so the rvalue reference is not a unique reference.
More information about the Gcc-bugs
mailing list