1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++98, c++03
11
12 // <experimental/filesystem>
13
14 // class file_status
15
16 // explicit file_status() noexcept;
17 // explicit file_status(file_type, perms prms = perms::unknown) noexcept;
18
19 #include <experimental/filesystem>
20 #include <type_traits>
21 #include <cassert>
22
23 #include "test_convertible.hpp"
24
25 namespace fs = std::experimental::filesystem;
26
main()27 int main() {
28 using namespace fs;
29 // Default ctor
30 {
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");
35 const file_status f;
36 assert(f.type() == file_type::none);
37 assert(f.permissions() == perms::unknown);
38 }
39
40 // Unary ctor
41 {
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");
46
47 const file_status f(file_type::not_found);
48 assert(f.type() == file_type::not_found);
49 assert(f.permissions() == perms::unknown);
50 }
51 // Binary ctor
52 {
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);
60 }
61 }
62