public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/58265] New: std::string move assignment should be noexcept
@ 2013-08-28 21:27 f.heckenbach@fh-soft.de
  2013-08-28 21:48 ` [Bug libstdc++/58265] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: f.heckenbach@fh-soft.de @ 2013-08-28 21:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

            Bug ID: 58265
           Summary: std::string move assignment should be noexcept
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de

According to http://www.cplusplus.com/reference/string/string/operator=/,
the std::string move assignment operator should be noexcept.

#include <string>
static_assert (std::is_nothrow_move_assignable <std::string>::value, "failed");


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
@ 2013-08-28 21:48 ` paolo.carlini at oracle dot com
  2013-08-28 21:57 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-28 21:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-08-28
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'll fix this asap, very simple to do, but note that until we break the ABI
basic_string will remain nonconforming in many serious ways.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
  2013-08-28 21:48 ` [Bug libstdc++/58265] " paolo.carlini at oracle dot com
@ 2013-08-28 21:57 ` paolo.carlini at oracle dot com
  2013-08-31 10:21 ` daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-28 21:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.0                       |---

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
As a matter of fact, isn't, in our current implementation, because std::swap
itself isn't in case the allocators are not equal.

I can preliminarily adjust it for ext/vstring.h (a preview of the future c++11
conforming basic_string) but it still needs work as regards the C++11 memory
allocation model.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
  2013-08-28 21:48 ` [Bug libstdc++/58265] " paolo.carlini at oracle dot com
  2013-08-28 21:57 ` paolo.carlini at oracle dot com
@ 2013-08-31 10:21 ` daniel.kruegler at googlemail dot com
  2013-09-20 15:50 ` [Bug libstdc++/58265] [lwg/2063] " glisse at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-08-31 10:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Similar to containers the move-assignment operator of basic_string should not
be noexcept, because they have a narrow contract. The fact that the
specification currently requires this, is a defect. This is

http://cplusplus.github.io/LWG/lwg-active.html#2063
>From gcc-bugs-return-428744-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Aug 31 10:40:59 2013
Return-Path: <gcc-bugs-return-428744-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18628 invoked by alias); 31 Aug 2013 10:40:59 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18292 invoked by uid 48); 31 Aug 2013 10:40:55 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
Date: Sat, 31 Aug 2013 10:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: SUSPENDED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status short_desc
Message-ID: <bug-58265-4-zLfURoMS5s@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58265-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58265-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg01668.txt.bz2
Content-length: 1000

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX265

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED
            Summary|std::string move assignment |[lwg/2063] std::string move
                   |should be noexcept          |assignment should be
                   |                            |noexcept

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks Daniel. I knew that we would have to revisit this anyway when the C++11
allocator model is implemented for the C++11 conforming basic_string. All in
all, I guess better suspending this for the time being.

Since, as-is, the move assignment of ext/vstring is in fact noexcept, we may
want to declare it as such however. By the way, I seem to remember that Jon has
work almost ready for the C++11 conformance of it.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
                   ` (2 preceding siblings ...)
  2013-08-31 10:21 ` daniel.kruegler at googlemail dot com
@ 2013-09-20 15:50 ` glisse at gcc dot gnu.org
  2013-09-24 10:07 ` glisse at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-20 15:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
Author: glisse
Date: Fri Sep 20 15:50:09 2013
New Revision: 202781

URL: http://gcc.gnu.org/viewcvs?rev=202781&root=gcc&view=rev
Log:
2013-09-20  Marc Glisse  <marc.glisse@inria.fr>

    PR libstdc++/58338
    * include/bits/allocator.h (__alloc_swap::_S_do_it,
    __shrink_to_fit_aux::_S_do_it): Mark as noexcept.
    * include/bits/basic_string.h (basic_string::_Rep) [_S_empty_rep,
    _M_is_leaked, _M_is_shared, _M_set_leaked, _M_set_sharable,
    _M_set_length_and_sharable, _M_dispose]: Likewise.
    (basic_string::_Alloc_hider::_Alloc_hider): Likewise.
    (basic_string) [_M_data, _M_rep, _M_ibegin, _M_iend, _M_limit,
    _M_disjunct, _M_copy, _M_move, _M_assign, _S_copy_chars, _S_compare,
    _S_empty_rep, shrink_to_fit, operator[] const, front const, back const]:
    Likewise.
    [clear]: Link to PR 56166.
    [swap]: Link to PR 58265.
    * include/bits/stl_deque.h (_Deque_iterator) [_S_buffer_size,
    _Deque_iterator, _M_const_cast, operator*, operator->, operator++,
    operator--, operator+=, operator+, operator-=, operator-, operator[],
    _M_set_node]: Mark as noexcept.
    (operator==(const _Deque_iterator&, const _Deque_iterator&),
    operator!=(const _Deque_iterator&, const _Deque_iterator&),
    operator<(const _Deque_iterator&, const _Deque_iterator&),
    operator>(const _Deque_iterator&, const _Deque_iterator&),
    operator<=(const _Deque_iterator&, const _Deque_iterator&),
    operator>=(const _Deque_iterator&, const _Deque_iterator&),
    operator-(const _Deque_iterator&, const _Deque_iterator&),
    operator+(ptrdiff_t, const _Deque_iterator&)): Likewise.
    (_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
    _M_initialize_map.
    [~_Deque_base, _M_deallocate_node, _M_deallocate_map, _M_destroy_nodes]:
    Mark as noexcept.
    (_Deque_base::_Deque_impl) [_Deque_impl(const _Tp_alloc_type&),
    _Deque_impl(_Tp_alloc_type&&)]: Likewise.
    (deque) [_S_buffer_size, operator=(deque&&), shrink_to_fit, operator[],
    front, back, pop_front, pop_back, swap]: Likewise.
    [deque(), deque(const allocator_type&)]: Merge.
    * include/debug/deque (deque) [operator=(deque&&), shrink_to_fit,
    operator[], front, back, pop_front, pop_back, swap]: Mark as noexcept.
    * include/profile/deque (deque) [operator=(deque&&), operator[], front,
    back, pop_front, pop_back, swap]: Likewise.
    * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
    Adjust line number.
    * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
    Likewise.
    * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
    Likewise.
    * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
    Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/allocator.h
    trunk/libstdc++-v3/include/bits/basic_string.h
    trunk/libstdc++-v3/include/bits/stl_deque.h
    trunk/libstdc++-v3/include/debug/deque
    trunk/libstdc++-v3/include/profile/deque
   
trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
   
trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
   
trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
   
trunk/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
                   ` (3 preceding siblings ...)
  2013-09-20 15:50 ` [Bug libstdc++/58265] [lwg/2063] " glisse at gcc dot gnu.org
@ 2013-09-24 10:07 ` glisse at gcc dot gnu.org
  2015-07-17 11:14 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-24 10:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58265

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
Author: glisse
Date: Tue Sep 24 10:07:32 2013
New Revision: 202861

URL: http://gcc.gnu.org/viewcvs?rev=202861&root=gcc&view=rev
Log:
2013-09-24  Marc Glisse  <marc.glisse@inria.fr>

    PR libstdc++/58338
    PR libstdc++/56166
    * include/bits/basic_string.h (basic_string)
    [basic_string(basic_string&&)]: Make the noexcept conditional.
    [operator=(basic_string&&), assign(basic_string&&)]: Link to PR 58265.
    [begin(), end(), rbegin(), rend(), clear]: Remove noexcept.
    [pop_back]: Comment on the lack of noexcept.
    * include/debug/string (basic_string) [basic_string(const _Allocator&),
    basic_string(basic_string&&), begin(), end(), rbegin(), rend(), clear,
    operator[](size_type), pop_back]: Comment out noexcept, until vstring
    replaces basic_string.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/basic_string.h
    trunk/libstdc++-v3/include/debug/string


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
                   ` (4 preceding siblings ...)
  2013-09-24 10:07 ` glisse at gcc dot gnu.org
@ 2015-07-17 11:14 ` redi at gcc dot gnu.org
  2015-09-11 11:02 ` redi at gcc dot gnu.org
  2015-09-11 11:03 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-17 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |ASSIGNED
           Assignee|paolo.carlini at oracle dot com    |redi at gcc dot gnu.org

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I've been working on LWG2063 but forgot there was this PR for it.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
                   ` (5 preceding siblings ...)
  2015-07-17 11:14 ` redi at gcc dot gnu.org
@ 2015-09-11 11:02 ` redi at gcc dot gnu.org
  2015-09-11 11:03 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-11 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Fri Sep 11 11:02:14 2015
New Revision: 227681

URL: https://gcc.gnu.org/viewcvs?rev=227681&root=gcc&view=rev
Log:
Implement N4258 noexcept for std::basic_string.

        PR libstdc++/58265
        * doc/xml/manual/intro.xml: Document LWG 2063 and 2064 resolutions.
        * doc/html/manual/bugs.html: Regenerate.
        * include/bits/basic_string.h (basic_string): Implement N4258. Add
        correct exception-specifications and propagate allocators correctly.
        * include/bits/basic_string.tcc (basic_string::swap): Propagate
        allocators correctly.
        * include/debug/string (__gnu_debug::basic_string): Add correct
        exceptions-specifications and allcoator-extended constructors.
        * testsuite/21_strings/basic_string/allocator/char/copy.cc: New.
        * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
        New.
        * testsuite/21_strings/basic_string/allocator/char/minimal.cc: New.
        * testsuite/21_strings/basic_string/allocator/char/move.cc: New.
        * testsuite/21_strings/basic_string/allocator/char/move_assign.cc:
        New.
        * testsuite/21_strings/basic_string/allocator/char/noexcept.cc: New.
        * testsuite/21_strings/basic_string/allocator/char/swap.cc: New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc: New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
        New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/move.cc: New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc:
        New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc: New.
        * testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc: New.
        * testsuite/util/testsuite_allocator.h (tracker_allocator): Define
        defaulted assignment operators.

Added:
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move_assign.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/noexcept.cc
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/swap.cc
    trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc
   
trunk/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/doc/html/manual/bugs.html
    trunk/libstdc++-v3/doc/xml/manual/intro.xml
    trunk/libstdc++-v3/include/bits/basic_string.h
    trunk/libstdc++-v3/include/bits/basic_string.tcc
    trunk/libstdc++-v3/include/debug/string
    trunk/libstdc++-v3/testsuite/util/testsuite_allocator.h


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libstdc++/58265] [lwg/2063] std::string move assignment should be noexcept
  2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
                   ` (6 preceding siblings ...)
  2015-09-11 11:02 ` redi at gcc dot gnu.org
@ 2015-09-11 11:03 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-11 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-11 11:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-28 21:27 [Bug libstdc++/58265] New: std::string move assignment should be noexcept f.heckenbach@fh-soft.de
2013-08-28 21:48 ` [Bug libstdc++/58265] " paolo.carlini at oracle dot com
2013-08-28 21:57 ` paolo.carlini at oracle dot com
2013-08-31 10:21 ` daniel.kruegler at googlemail dot com
2013-09-20 15:50 ` [Bug libstdc++/58265] [lwg/2063] " glisse at gcc dot gnu.org
2013-09-24 10:07 ` glisse at gcc dot gnu.org
2015-07-17 11:14 ` redi at gcc dot gnu.org
2015-09-11 11:02 ` redi at gcc dot gnu.org
2015-09-11 11:03 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).