49 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++1410 11// <filesystem>12 13// class path14 15// typedef ... value_type;16// typedef basic_string<value_type> string_type;17// static constexpr value_type preferred_separator = ...;18 19#include <filesystem>20#include <cassert>21#include <string>22#include <type_traits>23 24#include "test_macros.h"25namespace fs = std::filesystem;26 27int main(int, char**) {28 using namespace fs;29#ifdef _WIN3230 ASSERT_SAME_TYPE(path::value_type, wchar_t);31#else32 ASSERT_SAME_TYPE(path::value_type, char);33#endif34 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 _WIN3238 static_assert(path::preferred_separator == '\\', "");39#else40 static_assert(path::preferred_separator == '/', "");41#endif42 // 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