brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 2bd2a87 Raw
45 lines · cpp
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-exception7//8//===----------------------------------------------------------------------===//9 10// UNSUPPORTED: c++03, c++11, c++1411 12// <filesystem>13 14// class path15 16// const value_type* c_str() const noexcept;17 18#include <filesystem>19#include <cassert>20#include <string>21#include <type_traits>22 23#include "assert_macros.h"24#include "test_macros.h"25namespace fs = std::filesystem;26 27int main(int, char**) {28  using namespace fs;29  const char* const value = "hello world";30  const std::string str_value = value;31  const fs::path::string_type pathstr_value(str_value.begin(), str_value.end());32  { // Check signature33    path p(value);34    ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));35    ASSERT_NOEXCEPT(p.c_str());36  }37  {38    path p(value);39    assert(p.c_str() == pathstr_value);40    assert(p.native().c_str() == p.c_str());41  }42 43  return 0;44}45