1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
15 // explicit file_status() noexcept;
16 // explicit file_status(file_type, perms prms = perms::unknown) noexcept;
19 #include <type_traits>
22 #include "test_convertible.h"
24 #include "test_macros.h"
25 namespace fs
= std::filesystem
;
27 int main(int, char**) {
31 static_assert(std::is_nothrow_default_constructible
<file_status
>::value
,
32 "The default constructor must be noexcept");
33 static_assert(test_convertible
<file_status
>(),
34 "The default constructor must not be explicit");
36 assert(f
.type() == file_type::none
);
37 assert(f
.permissions() == perms::unknown
);
42 static_assert(std::is_nothrow_constructible
<file_status
, file_type
>::value
,
43 "This constructor must be noexcept");
44 static_assert(!test_convertible
<file_status
, file_type
>(),
45 "This constructor must be explicit");
47 const file_status
f(file_type::not_found
);
48 assert(f
.type() == file_type::not_found
);
49 assert(f
.permissions() == perms::unknown
);
53 static_assert(std::is_nothrow_constructible
<file_status
, file_type
, perms
>::value
,
54 "This constructor must be noexcept");
55 static_assert(!test_convertible
<file_status
, file_type
, perms
>(),
56 "This constructor must b explicit");
57 const file_status
f(file_type::regular
, perms::owner_read
);
58 assert(f
.type() == file_type::regular
);
59 assert(f
.permissions() == perms::owner_read
);