mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-24 22:11:56 +08:00
forward_list (forward_list::splice_after): Check allocators are equal.
* include/debug/forward_list (forward_list::splice_after): Check allocators are equal. * src/c++11/debug.cc: Fix spelling. * testsuite/23_containers/forward_list/debug/splice_after5_neg.cc: New. * testsuite/23_containers/forward_list/debug/splice_after6_neg.cc: Likewise. * testsuite/23_containers/forward_list/debug/splice_after7_neg.cc: Likewise. From-SVN: r186669
This commit is contained in:
parent
49c45e289e
commit
7c688aded4
@ -1,3 +1,15 @@
|
||||
2012-04-22 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||
|
||||
* include/debug/forward_list (forward_list::splice_after): Check
|
||||
allocators are equal.
|
||||
* src/c++11/debug.cc: Fix spelling.
|
||||
* testsuite/23_containers/forward_list/debug/splice_after5_neg.cc:
|
||||
New.
|
||||
* testsuite/23_containers/forward_list/debug/splice_after6_neg.cc:
|
||||
Likewise.
|
||||
* testsuite/23_containers/forward_list/debug/splice_after7_neg.cc:
|
||||
Likewise.
|
||||
|
||||
2012-04-20 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR libstdc++/53052
|
||||
|
@ -409,6 +409,10 @@ namespace __debug
|
||||
_GLIBCXX_DEBUG_VERIFY(&__list != this,
|
||||
_M_message(__gnu_debug::__msg_self_splice)
|
||||
._M_sequence(*this, "this"));
|
||||
_GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
|
||||
_M_message(__gnu_debug::__msg_splice_alloc)
|
||||
._M_sequence(*this)
|
||||
._M_sequence(__list, "__list"));
|
||||
this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
|
||||
{
|
||||
return __it != __list._M_base().cbefore_begin()
|
||||
@ -433,6 +437,10 @@ namespace __debug
|
||||
_M_message(__gnu_debug::__msg_splice_other)
|
||||
._M_iterator(__i, "__i")
|
||||
._M_sequence(__list, "__list"));
|
||||
_GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
|
||||
_M_message(__gnu_debug::__msg_splice_alloc)
|
||||
._M_sequence(*this)
|
||||
._M_sequence(__list, "__list"));
|
||||
|
||||
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
||||
// 250. splicing invalidates iterators
|
||||
@ -469,6 +477,10 @@ namespace __debug
|
||||
._M_sequence(__list, "list")
|
||||
._M_iterator(__before, "before")
|
||||
._M_iterator(__last, "last"));
|
||||
_GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
|
||||
_M_message(__gnu_debug::__msg_splice_alloc)
|
||||
._M_sequence(*this)
|
||||
._M_sequence(__list, "__list"));
|
||||
|
||||
for (_Base_const_iterator __tmp = std::next(__before.base());
|
||||
__tmp != __last.base(); ++__tmp)
|
||||
|
@ -131,7 +131,7 @@ namespace __gnu_debug
|
||||
"attempt to flip a singular bitset reference",
|
||||
// std::list checks
|
||||
"attempt to splice a list into itself",
|
||||
"attempt to splice lists with inequal allocators",
|
||||
"attempt to splice lists with unequal allocators",
|
||||
"attempt to splice elements referenced by a %1.state; iterator",
|
||||
"attempt to splice an iterator from a different container",
|
||||
"splice destination %1.name;"
|
||||
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-debug-mode "" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
// Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef __gnu_test::uneq_allocator<int> alloc_type;
|
||||
|
||||
std::forward_list<int, alloc_type> fl1({1, 2, 3}, alloc_type(1));
|
||||
std::forward_list<int, alloc_type> fl2({1, 2, 3}, alloc_type(2));
|
||||
|
||||
fl1.splice_after(fl1.before_begin(), fl2);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-debug-mode "" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
// Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef __gnu_test::uneq_allocator<int> alloc_type;
|
||||
|
||||
std::forward_list<int, alloc_type> fl1({1, 2, 3}, alloc_type(1));
|
||||
std::forward_list<int, alloc_type> fl2({1, 2, 3}, alloc_type(2));
|
||||
|
||||
fl1.splice_after(fl1.before_begin(), fl2, fl2.begin());
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-debug-mode "" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
// Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef __gnu_test::uneq_allocator<int> alloc_type;
|
||||
|
||||
std::forward_list<int, alloc_type> fl1({1, 2, 3}, alloc_type(1));
|
||||
std::forward_list<int, alloc_type> fl2({1, 2, 3}, alloc_type(2));
|
||||
|
||||
fl1.splice_after(fl1.before_begin(), fl2, fl2.begin(), fl2.end());
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user