]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/unique_ptr/assign/48635_neg.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / unique_ptr / assign / 48635_neg.cc
CommitLineData
8868286e 1// { dg-options "-std=gnu++11" }
d731f424 2// { dg-do compile }
3
f1717362 4// Copyright (C) 2011-2016 Free Software Foundation, Inc.
d731f424 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
18// along with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21#include <memory>
22
23struct D;
24
25struct B
26{
a3f807e8 27 B& operator=(D&) = delete;
d731f424 28
29 template<class T>
30 void operator()(T*) const {}
31};
32
33struct D : B { };
34
35// libstdc++/48635
36void f()
37{
38 B b;
39 D d;
40
41 std::unique_ptr<int, B&> ub(nullptr, b);
a3f807e8 42 std::unique_ptr<int, B> ub2(nullptr, b);
d731f424 43 std::unique_ptr<int, D&> ud(nullptr, d);
a3f807e8 44 ub = std::move(ud); // { dg-error "no match" }
45 ub2 = ud; // { dg-error "no match" }
46// { dg-error "no type" "" { target *-*-* } 269 }
d731f424 47
48 std::unique_ptr<int[], B&> uba(nullptr, b);
49 std::unique_ptr<int[], D&> uda(nullptr, d);
a3f807e8 50 uba = std::move(uda); // { dg-error "no match" }
51// { dg-error "no type" "" { target *-*-* } 537 }
d731f424 52}