Fix addvdi3 and subvdi3 patterns
[official-gcc.git] / libstdc++-v3 / testsuite / libstdc++-xmethods / shared_ptr.cc
blobb1a3372b6ef142f68a7064a8763610ba193e0d99
1 // { dg-do run { target c++11 } }
2 // { dg-options "-g -O0" }
3 // { dg-require-effective-target hosted }
5 // Copyright (C) 2016-2022 Free Software Foundation, Inc.
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.
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.
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/>.
22 #include <memory>
24 struct x_struct
26 int y;
29 int
30 main ()
32 std::shared_ptr<int> p(new int(10));
34 std::shared_ptr<x_struct> q(new x_struct{23});
36 std::shared_ptr<x_struct[]> r(new x_struct[2]{ {46}, {69} });
38 std::shared_ptr<x_struct[3]> s(new x_struct[2]{ {92}, {115} });
40 // { dg-final { note-test *p 10 } }
41 // { dg-final { regexp-test p.get() 0x.* } }
43 // { dg-final { whatis-test *p int } }
44 // { dg-final { whatis-test p.get() "int \*" } }
46 // { dg-final { note-test *q {\{y = 23\}} } }
47 // { dg-final { regexp-test q.get() 0x.* } }
48 // { dg-final { note-test q->y 23 } }
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 } }
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 } }
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 } }
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 } }
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 } }
70 return 0; // Mark SPOT
73 // { dg-final { gdb-test SPOT {} 1 } }