Add an UNSPEC_PROLOGUE_USE to prevent the link register from being considered dead.
[official-gcc.git] / libstdc++-v3 / testsuite / 23_containers / vector_bool.cc
blob17d63d1f8543a270eff7984bdb1c960af8c2ced8
1 // 2002-03-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
3 // Copyright (C) 2002 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
21 // 23.2.5 class vector<bool>
23 #include <vector>
24 #include <testsuite_hooks.h>
26 void test01()
28 std::vector<bool>::iterator i;
29 ++i;
32 // libstdc++/6886
33 void test02()
35 typedef std::vector<bool> bvec;
36 int i, num = 0;
37 bvec v;
39 v.resize(66);
41 for (i = 0 ; i < 66 ; ++i)
42 v[i] = 0;
44 v[1] = 1;
45 v[33] = 1;
46 v[49] = 1;
47 v[65] = 1;
49 for (bvec::iterator j = v.begin() ; j != v.end() ; j++)
50 if (bool(*j)) ++num;
52 VERIFY( num == 4 );
55 int main()
57 test01();
58 test02();
59 return 0;