1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
4 // Copyright (C) 2016-2020 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 #ifndef _GLIBCXX_DEBUG
22 # define _GLIBCXX_DEBUG
25 #include <forward_list>
26 #include <unordered_map>
27 #include <unordered_set>
33 std::forward_list
<std::string
> flst
;
34 std::forward_list
<std::string
>::iterator flstiter0
;
35 // { dg-final { note-test flstiter0 {non-dereferenceable iterator for std::forward_list}} }
36 flst
.push_front("dum");
37 std::forward_list
<std::string
>::iterator flstiter1
= flst
.begin();
38 // { dg-final { note-test *flstiter1 {"dum"}} }
39 flst
.push_front("dee");
40 std::forward_list
<std::string
>::iterator flstiter2
= flst
.begin();
41 // { dg-final { note-test *flstiter2 {"dee"}} }
42 // { dg-final { note-test flst {std::__debug::forward_list = {[0] = "dee", [1] = "dum"}} } }
44 std::forward_list
<std::string
>::const_iterator flstciter
= flst
.begin();
45 // { dg-final { note-test *flstciter {"dee"}} }
47 std::unordered_map
<std::string
, int> um
{ {"zardoz", 23} };
48 // { dg-final { note-test um {std::__debug::unordered_map with 1 element = {["zardoz"] = 23}} } }
50 std::unordered_map
<std::string
, int>::iterator umiter
= um
.begin();
51 // { dg-final { note-test umiter->first {"zardoz"} } }
53 std::unordered_set
<std::string
> us
{"barrel"};
54 // { dg-final { note-test us {std::__debug::unordered_set with 1 element = {[0] = "barrel"}} } }
56 std::unordered_set
<std::string
>::const_iterator usciter
= us
.begin();
57 // { dg-final { note-test *usciter {"barrel"} } }
59 // N.B. printers.py does not define printers for the iterator types
60 // that belong to C++11 containers, so tests above dereference the
61 // iterators, and to make that work we need to ensure the operator
62 // definitions are in the debug info:
70 return 0; // Mark SPOT
73 // { dg-final { gdb-test SPOT } }