]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/libstdc++-prettyprinters/compat.cc
1 // { dg-options "-g -O0" }
2 // { dg-do run { target c++11 } }
4 // Copyright (C) 2014-2019 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 // Test that current printers still support old definitions of types.
35 template<unsigned long, typename
...> struct _Tuple_impl
;
37 template<typename T
, typename U
>
38 struct _Tuple_impl
<0, T
, U
> : _Tuple_impl
<1, U
>, _Head_base
<T
>
42 struct _Tuple_impl
<1, U
> : _Head_base
<U
>
45 template<typename T
, typename U
>
46 struct tuple
: _Tuple_impl
<0, T
, U
>
49 template<typename T
> struct default_delete
{ };
51 template<typename T
, typename D
= default_delete
<T
>>
54 unique_ptr(T
* p
) { _M_t
._M_head_impl
= p
; }
59 // Old representation of std::optional, before GCC 9
61 struct _Optional_payload
63 _Optional_payload() : _M_empty(), _M_engaged(false) { }
64 struct _Empty_byte
{ };
75 _Optional_payload
<T
> _M_payload
;
79 struct optional
: _Optional_base
<T
>
85 this->_M_payload
._M_payload
= t
;
86 this->_M_payload
._M_engaged
= true;
95 std::unique_ptr
<datum
> uptr (new datum
);
96 // { dg-final { regexp-test uptr {std::unique_ptr.datum. = {get\(\) = 0x.*}} } }
97 std::unique_ptr
<datum
> &ruptr
= uptr
;
98 // { dg-final { regexp-test ruptr {std::unique_ptr.datum. = {get\(\) = 0x.*}} } }
103 // { dg-final { note-test o {std::optional<int> [no contained value]} } }
104 optional
<bool> ob
{false};
105 // { dg-final { note-test ob {std::optional<bool> = {[contained value] = false}} } }
107 // { dg-final { note-test oi {std::optional<int> = {[contained value] = 5}} } }
108 optional
<void*> op
{nullptr};
109 // { dg-final { note-test op {std::optional<void *> = {[contained value] = 0x0}} } }
112 return 0; // Mark SPOT
115 // { dg-final { gdb-test SPOT } }