From: Eric Fiselier Date: Sat, 15 Oct 2016 21:29:44 +0000 (+0000) Subject: Implement LWG2664 and update its status X-Git-Tag: llvmorg-4.0.0-rc1~7089 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbcfec7edd010aeb2f86780b7491a400dbe0f5d9;p=platform%2Fupstream%2Fllvm.git Implement LWG2664 and update its status llvm-svn: 284310 --- diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem index 10590a8..45de0d1 100644 --- a/libcxx/include/experimental/filesystem +++ b/libcxx/include/experimental/filesystem @@ -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; diff --git a/libcxx/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/libcxx/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp new file mode 100644 index 0000000..c43ea07 --- /dev/null +++ b/libcxx/test/libcxx/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -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 + +// + +// 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 +#include +#include +#include + +#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. +} diff --git a/libcxx/www/upcoming_meeting.html b/libcxx/www/upcoming_meeting.html index ffbc0a9..e0d53bd 100644 --- a/libcxx/www/upcoming_meeting.html +++ b/libcxx/www/upcoming_meeting.html @@ -88,7 +88,7 @@ 2589match_results can't satisfy the requirements of a containerIssaquahNothing to do 2591std::function's member template target() should not lead to undefined behaviourIssaquah 2598addressof works on temporariesIssaquahPatch ready - 2664operator/ (and other append) semantics not useful if argument has rootIssaquah + 2664operator/ (and other append) semantics not useful if argument has rootIssaquahNothing to do 2665remove_filename() post condition is incorrectIssaquah 2672Should is_empty use error_code in its specification?Issaquah 2678std::filesystem enum classes overspecifiedIssaquahNothing to do @@ -166,7 +166,7 @@
  • 2589 - This is just wording cleanup.
  • 2591 - I suspect that this is just better specification of the existing structure. Probably need more tests for this.
  • 2598 - Patch and tests ready
  • -
  • 2664 - File System; Eric?
  • +
  • 2664 - No change needed. _LIBCPP_DEBUG mode tests the new requirements.
  • 2665 - File System; Eric?
  • 2672 - File System; Eric?
  • 2678 - File System; Eric?