]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635.cc
1 // { dg-options "-std=gnu++0x" }
3 // Copyright (C) 2011-2014 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 #include <testsuite_hooks.h>
26 Deleter(const Deleter
&) = default;
27 Deleter(Deleter
&&) = default;
30 operator=(const Deleter
&)
32 bool test
__attribute__((unused
)) = true;
40 bool test
__attribute__((unused
)) = true;
47 operator()(T
*) const { }
50 struct DDeleter
: Deleter
{ };
57 std::unique_ptr
<int, Deleter
&> p1(nullptr, d
), p2(nullptr, d
);
62 std::unique_ptr
<int, DDeleter
&> p1t(nullptr, dd
);
63 std::unique_ptr
<int, Deleter
&> p2t(nullptr, d
);
66 std::unique_ptr
<int[], Deleter
&> p1a(nullptr, d
), p2a(nullptr, d
);
69 std::unique_ptr
<int[], DDeleter
&> p1at(nullptr, dd
);
70 std::unique_ptr
<int[], Deleter
&> p2at(nullptr, d
);
71 p2at
= std::move(p1at
);