Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1054)

Side by Side Diff: gcc/libstdc++-v3/testsuite/23_containers/map/modifiers/swap/1.cc

Issue 3050029: [gcc] GCC 4.5.0=>4.5.1 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/nacl-toolchain.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (C) 2004, 2005, 2009 Free Software Foundation
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 #include <map>
19 #include <testsuite_hooks.h>
20
21 struct T { int i; };
22
23 // T must be LessThanComparable to pass concept-checks
24 bool operator<(T l, T r) { return l.i < r.i; }
25
26 int swap_calls;
27
28 namespace std
29 {
30 template<>
31 void
32 map<T, int>::swap(map<T, int>&)
33 { ++swap_calls; }
34 }
35
36 // Should use map specialization for swap.
37 void test01()
38 {
39 bool test __attribute__((unused)) = true;
40 std::map<T, int> A;
41 std::map<T, int> B;
42 swap_calls = 0;
43 std::swap(A, B);
44 VERIFY(1 == swap_calls);
45 }
46
47 // Should use map specialization for swap.
48 void test02()
49 {
50 bool test __attribute__((unused)) = true;
51 using namespace std;
52 map<T, int> A;
53 map<T, int> B;
54 swap_calls = 0;
55 swap(A, B);
56 VERIFY(1 == swap_calls);
57 }
58
59 // See c++/13658 for background info.
60 int main()
61 {
62 test01();
63 test02();
64 return 0;
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698