xref: /llvm-project/libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp (revision 352945dd36c64fd68b4c73fcc393ee5828da639a)
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++03
10 
11 // <filesystem>
12 
13 // class path
14 
15 // typedef ... value_type;
16 // typedef basic_string<value_type> string_type;
17 // static constexpr value_type preferred_separator = ...;
18 
19 #include "filesystem_include.h"
20 #include <cassert>
21 #include <string>
22 #include <type_traits>
23 
24 #include "test_macros.h"
25 
26 
27 int main(int, char**) {
28   using namespace fs;
29 #ifdef _WIN32
30   ASSERT_SAME_TYPE(path::value_type, wchar_t);
31 #else
32   ASSERT_SAME_TYPE(path::value_type, char);
33 #endif
34   ASSERT_SAME_TYPE(path::string_type, std::basic_string<path::value_type>);
35   {
36     ASSERT_SAME_TYPE(const path::value_type, decltype(path::preferred_separator));
37 #ifdef _WIN32
38     static_assert(path::preferred_separator == '\\', "");
39 #else
40     static_assert(path::preferred_separator == '/', "");
41 #endif
42     // Make preferred_separator ODR used by taking its address.
43     const path::value_type* dummy = &path::preferred_separator;
44     ((void)dummy);
45   }
46 
47   return 0;
48 }
49