]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/libstdc++-xmethods/shared_ptr.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / libstdc++-xmethods / shared_ptr.cc
CommitLineData
0376e86b
JW
1// { dg-do run { target c++11 } }
2// { dg-options "-g -O0" }
7cc9022f 3// { dg-require-effective-target hosted }
0376e86b 4
83ffe9cd 5// Copyright (C) 2016-2023 Free Software Foundation, Inc.
0376e86b
JW
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.
12
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.
17
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/>.
21
22#include <memory>
23
24struct x_struct
25{
26 int y;
27};
28
29int
30main ()
31{
32 std::shared_ptr<int> p(new int(10));
33
34 std::shared_ptr<x_struct> q(new x_struct{23});
35
36 std::shared_ptr<x_struct[]> r(new x_struct[2]{ {46}, {69} });
37
38 std::shared_ptr<x_struct[3]> s(new x_struct[2]{ {92}, {115} });
39
40// { dg-final { note-test *p 10 } }
41// { dg-final { regexp-test p.get() 0x.* } }
42
43// { dg-final { whatis-test *p int } }
44// { dg-final { whatis-test p.get() "int \*" } }
45
46// { dg-final { note-test *q {\{y = 23\}} } }
47// { dg-final { regexp-test q.get() 0x.* } }
48// { dg-final { note-test q->y 23 } }
49
50// { dg-final { whatis-test *q x_struct } }
51// { dg-final { whatis-test q.get() "x_struct \*" } }
52// { dg-final { whatis-test q->y int } }
53
54// { dg-final { note-test r\[1] {\{y = 69\}} } }
55// { dg-final { regexp-test r.get() 0x.* } }
56// { dg-final { note-test r\[1].y 69 } }
57
58// { dg-final { whatis-test r\[1] x_struct } }
59// { dg-final { whatis-test r.get() "x_struct \*" } }
60// { dg-final { whatis-test r\[1].y int } }
61
62// { dg-final { note-test s\[1] {\{y = 115\}} } }
63// { dg-final { regexp-test s.get() 0x.* } }
64// { dg-final { note-test s\[1].y 115 } }
65
66// { dg-final { whatis-test s\[1] x_struct } }
67// { dg-final { whatis-test s.get() "x_struct \*" } }
68// { dg-final { whatis-test s\[1].y int } }
69
70 return 0; // Mark SPOT
71}
72
73// { dg-final { gdb-test SPOT {} 1 } }