2017-03-14 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / simple11.cc
blobe8d11902a255485d03d85acc38d1a5a14dd451a3
1 // If you modify this, please update simple.cc and debug.cc as well.
3 // { dg-do run { target c++11 } }
4 // { dg-options "-g -O0" }
5 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PROFILE" } }
7 // Copyright (C) 2011-2017 Free Software Foundation, Inc.
8 //
9 // This file is part of the GNU ISO C++ Library. This library is free
10 // software; you can redistribute it and/or modify it under the
11 // terms of the GNU General Public License as published by the
12 // Free Software Foundation; either version 3, or (at your option)
13 // any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
20 // You should have received a copy of the GNU General Public License along
21 // with this library; see the file COPYING3. If not see
22 // <http://www.gnu.org/licenses/>.
24 // Type printers only recognize the old std::string for now.
25 #define _GLIBCXX_USE_CXX11_ABI 0
27 #include <string>
28 #include <deque>
29 #include <bitset>
30 #include <iostream>
31 #include <list>
32 #include <map>
33 #include <set>
34 #include <vector>
35 #include <ext/slist>
37 int
38 main()
40 std::string tem;
41 std::string str = "zardoz";
42 // { dg-final { note-test str "\"zardoz\"" } }
44 std::bitset<10> bs;
45 bs[0] = 1;
46 bs[5] = 1;
47 bs[7] = 1;
48 // { dg-final { note-test bs {std::bitset = {[0] = 1, [5] = 1, [7] = 1}} } }
50 std::deque<std::string> deq;
51 deq.push_back("one");
52 deq.push_back("two");
53 // { dg-final { note-test deq {std::deque with 2 elements = {"one", "two"}} } }
55 std::deque<std::string>::iterator deqiter = deq.begin();
56 // { dg-final { note-test deqiter {"one"} } }
58 std::deque<int>::iterator deqiter0;
59 // { dg-final { note-test deqiter0 {non-dereferenceable iterator for std::deque} } }
61 std::list<std::string> lst;
62 lst.push_back("one");
63 lst.push_back("two");
64 // { dg-final { note-test lst {std::list = {[0] = "one", [1] = "two"}} } }
66 std::list<std::string>::iterator lstiter = lst.begin();
67 tem = *lstiter;
68 // { dg-final { note-test lstiter {"one"}} }
70 std::list<std::string>::const_iterator lstciter = lst.begin();
71 tem = *lstciter;
72 // { dg-final { note-test lstciter {"one"}} }
74 std::list<int>::iterator lstiter0;
75 // { dg-final { note-test lstiter0 {non-dereferenceable iterator for std::list} } }
77 std::map<std::string, int> mp;
78 mp["zardoz"] = 23;
79 // { dg-final { note-test mp {std::map with 1 element = {["zardoz"] = 23}} } }
81 std::map<std::string, int>::iterator mpiter = mp.begin();
82 // { dg-final { note-test mpiter {{first = "zardoz", second = 23}} } }
84 std::map<std::string, int>::iterator mpiter0;
85 // { dg-final { note-test mpiter0 {non-dereferenceable iterator for associative container} } }
87 // PR 67440
88 const std::set<int> const_intset = {2, 3};
89 // { dg-final { note-test const_intset {std::set with 2 elements = {[0] = 2, [1] = 3}} } }
91 std::set<std::string> sp;
92 sp.insert("clownfish");
93 sp.insert("barrel");
94 // { dg-final { note-test sp {std::set with 2 elements = {[0] = "barrel", [1] = "clownfish"}} } }
96 std::set<std::string>::const_iterator spciter = sp.begin();
97 // { dg-final { note-test spciter {"barrel"} } }
99 std::set<int>::iterator spiter0;
100 // { dg-final { note-test spiter0 {non-dereferenceable iterator for associative container} } }
102 std::vector<int> v;
103 v.push_back(1);
104 v.push_back(2);
105 v.erase(v.begin());
106 // { dg-final { note-test v {std::vector of length 1, capacity 2 = {2}} } }
107 std::vector<int>::iterator viter3 = v.begin();
108 // { dg-final { note-test viter3 {2} } }
110 std::vector<int>::iterator viter0;
111 // { dg-final { note-test viter0 {non-dereferenceable iterator for std::vector} } }
113 __gnu_cxx::slist<int> sll;
114 sll.push_front(23);
115 sll.push_front(47);
116 // { dg-final { note-test sll {__gnu_cxx::slist = {[0] = 47, [1] = 23}} } }
118 __gnu_cxx::slist<int>::iterator slliter = sll.begin();
119 // { dg-final { note-test slliter {47} } }
121 __gnu_cxx::slist<int>::iterator slliter0;
122 // { dg-final { note-test slliter0 {non-dereferenceable iterator for __gnu_cxx::slist} } }
124 std::cout << "\n";
125 return 0; // Mark SPOT
128 // { dg-final { gdb-test SPOT } }