• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // <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 "filesystem_include.hpp"
20 #include <type_traits>
21 #include <cassert>
22 
23 #include "test_convertible.hpp"
24 
25 
main()26 int main() {
27  using namespace fs;
28   // Default ctor
29   {
30     static_assert(std::is_nothrow_default_constructible<file_status>::value,
31                   "The default constructor must be noexcept");
32     static_assert(test_convertible<file_status>(),
33                   "The default constructor must not be explicit");
34     const file_status f;
35     assert(f.type()  == file_type::none);
36     assert(f.permissions() == perms::unknown);
37   }
38 
39   // Unary ctor
40   {
41     static_assert(std::is_nothrow_constructible<file_status, file_type>::value,
42                   "This constructor must be noexcept");
43     static_assert(!test_convertible<file_status, file_type>(),
44                  "This constructor must be explicit");
45 
46     const file_status f(file_type::not_found);
47     assert(f.type()  == file_type::not_found);
48     assert(f.permissions() == perms::unknown);
49   }
50   // Binary ctor
51   {
52     static_assert(std::is_nothrow_constructible<file_status, file_type, perms>::value,
53                   "This constructor must be noexcept");
54     static_assert(!test_convertible<file_status, file_type, perms>(),
55                   "This constructor must b explicit");
56     const file_status f(file_type::regular, perms::owner_read);
57     assert(f.type()  == file_type::regular);
58     assert(f.permissions() == perms::owner_read);
59   }
60 }
61