Implement LWG2664 and update its status

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284310 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2016-10-15 21:29:44 +00:00
parent 9f39437989
commit 4ca4e5038b
3 changed files with 74 additions and 2 deletions

View File

@ -759,6 +759,8 @@ private:
public:
// appends
path& operator/=(const path& __p) {
_LIBCPP_ASSERT(!__p.has_root_name(),
"cannot append to a path with a root name");
__append_sep_if_needed(__p.empty() ? char{} : __p.__pn_[0]);
__pn_ += __p.native();
return *this;

View File

@ -0,0 +1,70 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <experimental/filesystem>
// class path
// path& operator/=(path const&)
// path operator/(path const&, path const&)
#define _LIBCPP_DEBUG 0
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
int AssertCount = 0;
#include <experimental/filesystem>
#include <type_traits>
#include <string_view>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#include "count_new.hpp"
#include "filesystem_test_helper.hpp"
namespace fs = std::experimental::filesystem;
int main()
{
using namespace fs;
{
path lhs("//foo");
path rhs("/bar");
assert(AssertCount == 0);
lhs /= rhs;
assert(AssertCount == 0);
}
{
path lhs("//foo");
path rhs("/bar");
assert(AssertCount == 0);
(void)(lhs / rhs);
assert(AssertCount == 0);
}
{
path lhs("//foo");
path rhs("//bar");
assert(AssertCount == 0);
lhs /= rhs;
assert(AssertCount == 1);
AssertCount = 0;
}
{
path lhs("//foo");
path rhs("//bar");
assert(AssertCount == 0);
(void)(lhs / rhs);
assert(AssertCount == 1);
}
// FIXME The same error is not diagnosed for the append(Source) and
// append(It, It) overloads.
}

View File

@ -88,7 +88,7 @@
<tr><td><a href="http://wg21.link/LWG2589">2589</a></td><td>match_results can't satisfy the requirements of a container</td><td>Issaquah</td><td>Nothing to do</td></tr>
<tr><td><a href="http://wg21.link/LWG2591">2591</a></td><td>std::function's member template target() should not lead to undefined behaviour</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2598">2598</a></td><td>addressof works on temporaries</td><td>Issaquah</td><td>Patch ready</td></tr>
<tr><td><a href="http://wg21.link/LWG2664">2664</a></td><td>operator/ (and other append) semantics not useful if argument has root</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2664">2664</a></td><td>operator/ (and other append) semantics not useful if argument has root</td><td>Issaquah</td><td>Nothing to do</td></tr>
<tr><td><a href="http://wg21.link/LWG2665">2665</a></td><td>remove_filename() post condition is incorrect</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2672">2672</a></td><td>Should is_empty use error_code in its specification?</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2678">2678</a></td><td>std::filesystem enum classes overspecified</td><td>Issaquah</td><td>Nothing to do</td></tr>
@ -166,7 +166,7 @@
<li>2589 - This is just wording cleanup. </li>
<li>2591 - I <b>suspect</b> that this is just better specification of the existing structure. Probably need more tests for this.</li>
<li>2598 - Patch and tests ready</li>
<li>2664 - File System; Eric?</li>
<li>2664 - No change needed. _LIBCPP_DEBUG mode tests the new requirements.</li>
<li>2665 - File System; Eric?</li>
<li>2672 - File System; Eric?</li>
<li>2678 - File System; Eric?</li>