1/*
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * https://www.boost.org/LICENSE_1_0.txt)
5 *
6 * Copyright (c) 2024 Andrey Semashev
7 */
8/*!
9 * \file unique_resource_bad_rtraits_mkdef_nonassignable.cpp
10 * \author Andrey Semashev
11 *
12 * \brief This file tests that \c unique_resource rejects resource
13 * traits where the resource cannot be assigned from the
14 * result of `make_default`.
15 */
16
17#include <boost/scope/unique_resource.hpp>
18
19struct resource
20{
21 resource(int) noexcept {}
22 resource& operator= (int) = delete;
23};
24
25struct resource_deleter
26{
27 using result_type = void;
28 result_type operator() (resource const&) const noexcept {}
29};
30
31struct bad_resource_traits
32{
33 static int make_default() noexcept { return 10; }
34 static bool is_allocated(resource const& res) noexcept { return false; }
35};
36
37int main()
38{
39 boost::scope::unique_resource< resource, resource_deleter, bad_resource_traits > ur;
40
41 return 0;
42}
43

source code of boost/libs/scope/test/compile_fail/unique_resource_bad_rtraits_mkdef_nonassignable.cpp