| 1 | |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // UNSUPPORTED: c++03, c++11, c++14 |
| 11 | // UNSUPPORTED: availability-filesystem-missing |
| 12 | |
| 13 | // <filesystem> |
| 14 | |
| 15 | // class path |
| 16 | |
| 17 | // const value_type* c_str() const noexcept; |
| 18 | |
| 19 | #include <filesystem> |
| 20 | #include <cassert> |
| 21 | #include <string> |
| 22 | #include <type_traits> |
| 23 | |
| 24 | #include "assert_macros.h" |
| 25 | #include "test_macros.h" |
| 26 | namespace fs = std::filesystem; |
| 27 | |
| 28 | int main(int, char**) { |
| 29 | using namespace fs; |
| 30 | const char* const value = "hello world" ; |
| 31 | const std::string str_value = value; |
| 32 | const fs::path::string_type pathstr_value(str_value.begin(), str_value.end()); |
| 33 | { // Check signature |
| 34 | path p(value); |
| 35 | ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str())); |
| 36 | ASSERT_NOEXCEPT(p.c_str()); |
| 37 | } |
| 38 | { |
| 39 | path p(value); |
| 40 | assert(p.c_str() == pathstr_value); |
| 41 | assert(p.native().c_str() == p.c_str()); |
| 42 | } |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |