]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/libfundts.cc
2 // { dg-options "-g -O0 -std=gnu++14" }
4 // Copyright (C) 2014-2015 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 // Type printers only recognize the old std::string for now.
22 #define _GLIBCXX_USE_CXX11_ABI 0
24 #include <experimental/any>
25 #include <experimental/optional>
26 #include <experimental/string_view>
30 using std::experimental::any
;
31 using std::experimental::optional
;
32 using std::experimental::string_view
;
37 string_view str
= "string";
38 // { dg-final { note-test str "\"string\"" } }
41 // { dg-final { note-test o {std::experimental::optional<int> [no contained value]} } }
42 optional
<bool> ob
{false};
43 // { dg-final { note-test ob {std::experimental::optional<bool> = {[contained value] = false}} } }
45 // { dg-final { note-test oi {std::experimental::optional<int> = {[contained value] = 5}} } }
46 optional
<void*> op
{nullptr};
47 // { dg-final { note-test op {std::experimental::optional<void *> = {[contained value] = 0x0}} } }
48 optional
<std::map
<int, double>> om
;
49 om
= std::map
<int, double>{ {1, 2.}, {3, 4.}, {5, 6.} };
50 // { dg-final { note-test om {std::experimental::optional<std::map<int, double>> containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } }
51 optional
<std::string
> os
{ "stringy" };
52 // { dg-final { note-test os {std::experimental::optional<std::string> = {[contained value] = "stringy"}} } }
55 // { dg-final { note-test a {std::experimental::any [no contained value]} } }
57 // { dg-final { note-test ab {std::experimental::any containing bool = {[contained value] = false}} } }
59 // { dg-final { note-test ai {std::experimental::any containing int = {[contained value] = 6}} } }
60 any ap
= (void*)nullptr;
61 // { dg-final { note-test ap {std::experimental::any containing void * = {[contained value] = 0x0}} } }
63 // { dg-final { note-test as {std::experimental::any containing std::string = {[contained value] = "stringy"}} } }
64 any
as2("stringiest");
65 // { dg-final { regexp-test as2 {std::experimental::any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } }
67 // { dg-final { note-test am {std::experimental::any containing std::map with 3 elements = {[1] = 2, [3] = 4, [5] = 6}} } }
69 return 0; // Mark SPOT
72 // { dg-final { gdb-test SPOT } }