[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #9 from Jonathan Wakely --- (In reply to Charles-Henri Gros from comment #7) > For context, we're trying to detect cases where using "auto" unintentionally > creates a copy (it's regrettably common). > Here the copy is necessary to g

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #8 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #5) > Removing it would make the code less efficient and more complex. In fact, I don't even see how it would be possible, except by making *another* copy, e.g.

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread chgros at synopsys dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #7 from Charles-Henri Gros --- For context, we're trying to detect cases where using "auto" unintentionally creates a copy (it's regrettably common). Here the copy is necessary to get a non-const value; that's definitely something we

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #6 from Jonathan Wakely --- For your reproducer, the allocator is std::allocator which is an empty class and copying is a no-op. There is no efficiency concern whatsoever.

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 Jonathan Wakely changed: What|Removed |Added Resolution|--- |INVALID Status|WAITING

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-28 Thread marc-andre.laverdiere at synopsys dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #4 from Marc-André Laverdière --- The comment is "If this allocation throws there are no effects:" and I didn't understand the implications. Thanks for you spelled it out the logic behind it. May I encourage you to update the comment

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |WAITING Ever confirmed|0

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #2 from Andrew Pinski --- https://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2579 This copy only happens with _S_propagate_on_copy_assign which is true even.

[Bug libstdc++/109305] Allocator copy in basic_string::operator=

2023-03-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109305 --- Comment #1 from Andrew Pinski --- LWG2579