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_nonconstructible.cpp
10 * \author Andrey Semashev
11 *
12 * \brief This file tests that \c unique_resource rejects reduced
13 * resource traits where the resource cannot be constructed
14 * from the result of `make_default`.
15 */
16
17#include <boost/scope/unique_resource.hpp>
18
19struct resource
20{
21 resource(int) = delete;
22 resource& operator= (int) noexcept { return *this; }
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};
35
36int main()
37{
38 boost::scope::unique_resource< resource, resource_deleter, bad_resource_traits > ur;
39
40 return 0;
41}
42

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