| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-options "-g -O0" } |
| 3 |
|
| 4 |
// Copyright (C) 2018-2025 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 |
#include <iostream> |
| 22 |
#include <list> |
| 23 |
#include <memory> |
| 24 |
#include <set> |
| 25 |
#include <string> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
template<class T> |
| 29 |
void |
| 30 |
placeholder(const T *s) |
| 31 |
{ |
| 32 |
std::cout << (void *) s; |
| 33 |
} |
| 34 |
|
| 35 |
int |
| 36 |
main() |
| 37 |
{ |
| 38 |
using namespace std; |
| 39 |
// Ensure debug info for std::string is issued in the local |
| 40 |
// translation unit, so that GDB won't pick up any alternate |
| 41 |
// std::string notion that might be present in libstdc++.so. |
| 42 |
string bah = "hi"; |
| 43 |
(void)bah; |
| 44 |
unique_ptr<vector<unique_ptr<vector<int>*>>> p1; |
| 45 |
unique_ptr<vector<unique_ptr<set<int>*>>[]> p2; |
| 46 |
unique_ptr<set<unique_ptr<vector<int>*>>[10]> p3; |
| 47 |
unique_ptr<vector<unique_ptr<list<std::string>[]>>[99]> p4; |
| 48 |
// { dg-final { whatis-regexp-test p1 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?vector<int>\\*>>>" } } |
| 49 |
// { dg-final { whatis-regexp-test p2 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?set<int>\\*>>\\\[\\\]>" } } |
| 50 |
// { dg-final { whatis-regexp-test p3 "std::unique_ptr<std::(__debug::)?set<std::unique_ptr<std::(__debug::)?vector<int>\\*>>\\\[10\\\]>" } } |
| 51 |
// { dg-final { whatis-regexp-test p4 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?list<std::string>\\\[\\\]>>\\\[99\\\]>" } } |
| 52 |
|
| 53 |
placeholder(&p1); // Mark SPOT |
| 54 |
placeholder(&p2); |
| 55 |
placeholder(&p3); |
| 56 |
placeholder(&p4); |
| 57 |
|
| 58 |
std::cout << "\n"; |
| 59 |
return 0; |
| 60 |
} |
| 61 |
|
| 62 |
// { dg-final { gdb-test SPOT } } |