]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/80276.cc
libstdc++: Fix pretty printers script and tests
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-prettyprinters / 80276.cc
1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
3
4 // Copyright (C) 2018-2019 Free Software Foundation, Inc.
5 //
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)
10 // any later version.
11
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.
16
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/>.
20
21 // Type printers only recognize the old std::string for now.
22 #define _GLIBCXX_USE_CXX11_ABI 0
23
24 #include <iostream>
25 #include <list>
26 #include <memory>
27 #include <set>
28 #include <string>
29 #include <vector>
30
31 template<class T>
32 void
33 placeholder(const T *s)
34 {
35 std::cout << (void *) s;
36 }
37
38 int
39 main()
40 {
41 using namespace std;
42 unique_ptr<vector<unique_ptr<vector<int>*>>> p1;
43 unique_ptr<vector<unique_ptr<set<int>*>>[]> p2;
44 unique_ptr<set<unique_ptr<vector<int>*>>[10]> p3;
45 unique_ptr<vector<unique_ptr<list<std::string>[]>>[99]> p4;
46 // { dg-final { whatis-regexp-test p1 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?vector<int>\\*>>>" } }
47 // { dg-final { whatis-regexp-test p2 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?set<int>\\*>>\\\[\\\]>" } }
48 // { dg-final { whatis-regexp-test p3 "std::unique_ptr<std::(__debug::)?set<std::unique_ptr<std::(__debug::)?vector<int>\\*>>\\\[10\\\]>" } }
49 // { dg-final { whatis-regexp-test p4 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?list<std::string>\\\[\\\]>>\\\[99\\\]>" } }
50
51 placeholder(&p1); // Mark SPOT
52 placeholder(&p2);
53 placeholder(&p3);
54 placeholder(&p4);
55
56 std::cout << "\n";
57 return 0;
58 }
59
60 // { dg-final { gdb-test SPOT } }