[Bug c++/98840] Why does baz call the delete operator for moved unique_ptr

2021-01-26 Thread dmitriy.ovdienko at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98840 --- Comment #4 from Dmitriy Ovdienko --- What if introduce new ABI version and encode into function name (function name mangling). And then have two options: * Either compile code and store both versions into lib file (ABI v1 and v2). Applies

[Bug c++/98840] Why does baz call the delete operator for moved unique_ptr

2021-01-26 Thread dmitriy.ovdienko at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98840 --- Comment #3 from Dmitriy Ovdienko --- > This is not a GCC bug. No it is not. But can we improve that? That approach increases the binary size. In case if `baz` is called from many places, that is going to increase the binary size.

[Bug c++/98840] Why does baz call the delete operator for moved unique_ptr

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98840 --- Comment #2 from Jonathan Wakely --- https://www.youtube.com/watch?v=rHIkrotSwcc discusses exactly this problem. See also https://quuxplusone.github.io/blog/2018/05/02/trivial-abi-101/ This is not a GCC bug.

[Bug c++/98840] Why does baz call the delete operator for moved unique_ptr

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98840 --- Comment #1 from Jonathan Wakely --- The ABI requires it. The caller is responsible for constructing and destroying the argument.