From: Benjamin Kosnik Date: Tue, 9 Mar 2004 06:01:39 +0000 (+0000) Subject: re PR c++/13658 ([testcase] namespace association vs. templates part one) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1c4ca32d04cf16aa78c857acca00f7eebb9b9da;p=gcc.git re PR c++/13658 ([testcase] namespace association vs. templates part one) 2004-03-08 Benjamin Kosnik PR c++/13658 * testsuite/23_containers/deque/modifiers/swap.cc: New. * testsuite/23_containers/list/modifiers/swap.cc: New. * testsuite/23_containers/map/modifiers/swap.cc: New. * testsuite/23_containers/multimap/modifiers/swap.cc: New. * testsuite/23_containers/multiset/modifiers/swap.cc: New. * testsuite/23_containers/set/modifiers/swap.cc: New. * testsuite/23_containers/vector/modifiers/swap.cc: New. From-SVN: r79151 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2b4eea238b1..1538ef3e30e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2004-03-08 Benjamin Kosnik + + PR c++/13658 + * testsuite/23_containers/deque/modifiers/swap.cc: New. + * testsuite/23_containers/list/modifiers/swap.cc: New. + * testsuite/23_containers/map/modifiers/swap.cc: New. + * testsuite/23_containers/multimap/modifiers/swap.cc: New. + * testsuite/23_containers/multiset/modifiers/swap.cc: New. + * testsuite/23_containers/set/modifiers/swap.cc: New. + * testsuite/23_containers/vector/modifiers/swap.cc: New. + 2004-03-08 Petur Runolfsson PR libstdc++/12658 diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc new file mode 100644 index 00000000000..12cfa748b49 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + deque >::swap(deque >&) + { ++swap_calls; } +} + +// Should use deque specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::deque A; + std::deque B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use deque specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + deque A; + deque B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc new file mode 100644 index 00000000000..d20dec03679 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + list >::swap(list >&) + { ++swap_calls; } +} + +// Should use list specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::list A; + std::list B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use list specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + list A; + list B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc new file mode 100644 index 00000000000..8fb48cb6843 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + map::swap(map&) + { ++swap_calls; } +} + +// Should use map specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::map A; + std::map B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use map specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + map A; + map B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc new file mode 100644 index 00000000000..34425bd4cf3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + multimap::swap(multimap&) + { ++swap_calls; } +} + +// Should use multimap specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::multimap A; + std::multimap B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use multimap specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + multimap A; + multimap B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc new file mode 100644 index 00000000000..809e1538d1c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + multiset::swap(multiset&) + { ++swap_calls; } +} + +// Should use multiset specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::multiset A; + std::multiset B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use multiset specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + multiset A; + multiset B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc new file mode 100644 index 00000000000..dbf3b832666 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + set::swap(set&) + { ++swap_calls; } +} + +// Should use set specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::set A; + std::set B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use set specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + set A; + set B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc new file mode 100644 index 00000000000..3122aa1955b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/swap.cc @@ -0,0 +1,63 @@ +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#include +#include + +struct T { int i; }; + +int swap_calls; + +namespace std +{ + template<> + void + vector >::swap(vector >&) + { ++swap_calls; } +} + +// Should use vector specialization for swap. +void test01() +{ + bool test __attribute__((unused)) = true; + std::vector A; + std::vector B; + swap_calls = 0; + std::swap(A, B); + VERIFY(1 == swap_calls); +} + +// Should use vector specialization for swap. +void test02() +{ + bool test __attribute__((unused)) = true; + using namespace std; + vector A; + vector B; + swap_calls = 0; + swap(A, B); + VERIFY(1 == swap_calls); +} + +// See c++/13658 for background info. +int main() +{ + test01(); + test02(); + return 0; +}