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