brintos

brintos / llvm-project-archived public Read only

0
0
Text · 960 B · 00288da Raw
45 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// void clear() noexcept16 17#include <filesystem>18#include <cassert>19#include <type_traits>20 21#include "assert_macros.h"22#include "count_new.h"23#include "test_iterators.h"24namespace fs = std::filesystem;25 26int main(int, char**) {27  using namespace fs;28  {29    path p;30    ASSERT_NOEXCEPT(p.clear());31    ASSERT_SAME_TYPE(void, decltype(p.clear()));32    p.clear();33    assert(p.empty());34  }35  {36    const path p("/foo/bar/baz");37    path p2(p);38    assert(p == p2);39    p2.clear();40    assert(p2.empty());41  }42 43  return 0;44}45