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

            Bug ID: 61645
           Summary: forward_list::splice_after shall not throw exceptions
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lh_mouse at 126 dot com

ISO/IEC 14882:2011

23.3.4.6 forward_list operations [forwardlist.ops]
void splice_after(const_iterator position, forward_list& x);
void splice_after(const_iterator position, forward_list&& x);
(... omitted ...)
3 Throws: Nothing. **
4 Complexity: O(distance(x.begin(), x.end()))



// test_case.cpp

#include <forward_list>

int main(){
    std::forward_list<int> l{1,2,3};
    static_assert(
        noexcept(l.splice_after(l.before_begin(), l)),
        "!!"
    ); // fails
    static_assert(
        noexcept(l.splice_after(l.before_begin(), l, l.before_begin())),
        "!!"
    ); // ditto
    static_assert(
        noexcept(l.splice_after(l.before_begin(), l, l.before_begin(),
l.end())),
        "!!"
    ); // ditto
}

Reply via email to