xref: /llvm-project/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp (revision 2df59c50688c122bbcae7467d3eaf862c3ea3088)
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++98, c++03
10 
11 // <filesystem>
12 
13 // class path;
14 // enum class format;
15 
16 #include "filesystem_include.hpp"
17 #include <type_traits>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
22 int main(int, char**) {
23   typedef fs::path::format E;
24   static_assert(std::is_enum<E>::value, "");
25 
26   // Check that E is a scoped enum by checking for conversions.
27   typedef std::underlying_type<E>::type UT;
28   static_assert(!std::is_convertible<E, UT>::value, "");
29 
30   LIBCPP_ONLY(static_assert(std::is_same<UT, unsigned char>::value, "")); // Implementation detail
31 
32   static_assert(
33           E::auto_format   != E::native_format &&
34           E::auto_format   != E::generic_format &&
35           E::native_format != E::generic_format,
36         "Expected enumeration values are not unique");
37 
38   return 0;
39 }
40