43 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// const string_type& native() const noexcept;16 17#include <filesystem>18#include <cassert>19#include <string>20#include <type_traits>21 22#include "assert_macros.h"23#include "test_macros.h"24namespace fs = std::filesystem;25 26int main(int, char**) {27 using namespace fs;28 const char* const value = "hello world";29 std::string value_str(value);30 fs::path::string_type pathstr_value(value_str.begin(), value_str.end());31 { // Check signature32 path p(value);33 ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native()));34 ASSERT_NOEXCEPT(p.native());35 }36 { // native() is tested elsewhere37 path p(value);38 assert(p.native() == pathstr_value);39 }40 41 return 0;42}43