[61/77] Use scalar_int_mode in the AArch64 port
[official-gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / debug_cxx11.cc
blob1413bdafaa4229380a3cf9d52e3500ef01fb10be
1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
3 // { dg-skip-if "" { *-*-* } { "-D_GLIBCXX_PROFILE" } }
5 // Copyright (C) 2016-2017 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 #define _GLIBCXX_DEBUG
24 #include <forward_list>
25 #include <unordered_map>
26 #include <unordered_set>
27 #include <iostream>
29 int
30 main()
32 std::forward_list<std::string> flst;
33 std::forward_list<std::string>::iterator flstiter0;
34 // { dg-final { note-test flstiter0 {invalid iterator}} }
35 flst.push_front("dum");
36 std::forward_list<std::string>::iterator flstiter1 = flst.begin();
37 // { dg-final { note-test *flstiter1 {"dum"}} }
38 flst.push_front("dee");
39 std::forward_list<std::string>::iterator flstiter2 = flst.begin();
40 // { dg-final { note-test *flstiter2 {"dee"}} }
41 // { dg-final { note-test flst {std::__debug::forward_list = {[0] = "dee", [1] = "dum"}} } }
43 std::forward_list<std::string>::const_iterator flstciter = flst.begin();
44 // { dg-final { note-test *flstciter {"dee"}} }
46 std::unordered_map<std::string, int> um{ {"zardoz", 23} };
47 // { dg-final { note-test um {std::__debug::unordered_map with 1 element = {["zardoz"] = 23}} } }
49 std::unordered_map<std::string, int>::iterator umiter = um.begin();
50 // { dg-final { note-test umiter->first {"zardoz"} } }
52 std::unordered_set<std::string> us{"barrel"};
53 // { dg-final { note-test us {std::__debug::unordered_set with 1 element = {[0] = "barrel"}} } }
55 std::unordered_set<std::string>::const_iterator usciter = us.begin();
56 // { dg-final { note-test *usciter {"barrel"} } }
58 // N.B. printers.py does not define printers for the iterator types
59 // that belong to C++11 containers, so tests above dereference the
60 // iterators, and to make that work we need to ensure the operator
61 // definitions are in the debug info:
62 std::string tem;
63 tem = *flstiter1;
64 tem = *flstciter;
65 tem = umiter->first;
66 tem = *usciter;
68 std::cout << "\n";
69 return 0; // Mark SPOT
72 // { dg-final { gdb-test SPOT } }