svn commit: r312630 - in vendor/libc++/dist: include src test/std/containers/sequences/array test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time test/std/language.support/support.rtt...

Dimitry Andric dim at FreeBSD.org
Sun Jan 22 16:52:56 UTC 2017


Author: dim
Date: Sun Jan 22 16:52:53 2017
New Revision: 312630
URL: https://svnweb.freebsd.org/changeset/base/312630

Log:
  Vendor import of libc++ release_40 branch r292732:
  https://llvm.org/svn/llvm-project/libcxx/branches/release_40@292732

Added:
  vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp   (contents, props changed)
Modified:
  vendor/libc++/dist/include/__config
  vendor/libc++/dist/include/array
  vendor/libc++/dist/include/new
  vendor/libc++/dist/include/string
  vendor/libc++/dist/include/typeinfo
  vendor/libc++/dist/src/new.cpp
  vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp
  vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp
  vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp
  vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
  vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
  vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp

Modified: vendor/libc++/dist/include/__config
==============================================================================
--- vendor/libc++/dist/include/__config	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/include/__config	Sun Jan 22 16:52:53 2017	(r312630)
@@ -835,6 +835,18 @@ template <unsigned> struct __static_asse
 #define _DECLARE_C99_LDBL_MATH 1
 #endif
 
+#if defined(__APPLE__)
+# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+     defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#   define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+# endif
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+#   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+#     define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   endif
+# endif
+#endif // defined(__APPLE__)
+
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
 #endif

Modified: vendor/libc++/dist/include/array
==============================================================================
--- vendor/libc++/dist/include/array	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/include/array	Sun Jan 22 16:52:53 2017	(r312630)
@@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array
     _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
 
     // element access:
-    _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n)             {return __elems_[__n];}
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
-    reference at(size_type __n);
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+    reference operator[](size_type __n)             {return __elems_[__n];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+    const_reference operator[](size_type __n) const {return __elems_[__n];}
+
+    _LIBCPP_CONSTEXPR_AFTER_CXX14       reference at(size_type __n);
     _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
 
-    _LIBCPP_INLINE_VISIBILITY reference front()             {return __elems_[0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front()             {return __elems_[0];}
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
-    _LIBCPP_INLINE_VISIBILITY reference back()              {return __elems_[_Size > 0 ? _Size-1 : 0];}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back()              {return __elems_[_Size > 0 ? _Size-1 : 0];}
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const  {return __elems_[_Size > 0 ? _Size-1 : 0];}
 
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array
 };
 
 template <class _Tp, size_t _Size>
+_LIBCPP_CONSTEXPR_AFTER_CXX14
 typename array<_Tp, _Size>::reference
 array<_Tp, _Size>::at(size_type __n)
 {

Modified: vendor/libc++/dist/include/new
==============================================================================
--- vendor/libc++/dist/include/new	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/include/new	Sun Jan 22 16:52:53 2017	(r312630)
@@ -101,8 +101,9 @@ void  operator delete[](void* ptr, void*
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
-    (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+    (!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \
+    (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
@@ -144,7 +145,7 @@ public:
 
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
 
-#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
 #else

Modified: vendor/libc++/dist/include/string
==============================================================================
--- vendor/libc++/dist/include/string	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/include/string	Sun Jan 22 16:52:53 2017	(r312630)
@@ -818,6 +818,7 @@ public:
     operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
 
     basic_string& operator=(const basic_string& __str);
+    template <class = void>
     _LIBCPP_INLINE_VISIBILITY
     basic_string& operator=(__self_view __sv)  {return assign(__sv);}
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

Modified: vendor/libc++/dist/include/typeinfo
==============================================================================
--- vendor/libc++/dist/include/typeinfo	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/include/typeinfo	Sun Jan 22 16:52:53 2017	(r312630)
@@ -95,12 +95,13 @@ protected:
     uintptr_t __type_name;
 
     _LIBCPP_INLINE_VISIBILITY
-    type_info(const char* __n) : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
+    explicit type_info(const char* __n)
+      : __type_name(reinterpret_cast<uintptr_t>(__n)) {}
 #else
     const char *__type_name;
 
     _LIBCPP_INLINE_VISIBILITY
-    type_info(const char* __n) : __type_name(__n) {}
+    explicit type_info(const char* __n) : __type_name(__n) {}
 #endif
 
 public:

Modified: vendor/libc++/dist/src/new.cpp
==============================================================================
--- vendor/libc++/dist/src/new.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/src/new.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA
 }
 
 _LIBCPP_WEAK
-void *
-operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
-{
-    if (size == 0)
-        size = 1;
-    if (static_cast<size_t>(alignment) < sizeof(void*))
-      alignment = std::align_val_t(sizeof(void*));
-    void* p;
-#if defined(_LIBCPP_MSVCRT)
-    while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
-#else
-    while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
-#endif
-    {
-        // If posix_memalign fails and there is a new_handler,
-        // call it to try free up memory.
-        std::new_handler nh = std::get_new_handler();
-        if (nh)
-            nh();
-        else {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-            throw std::bad_alloc();
-#else
-            p = nullptr; // posix_memalign doesn't initialize 'p' on failure
-            break;
-#endif
-        }
-    }
-    return p;
-}
-
-_LIBCPP_WEAK
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
@@ -116,14 +84,21 @@ operator new(size_t size, const std::not
 
 _LIBCPP_WEAK
 void*
-operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
+operator new[](size_t size) _THROW_BAD_ALLOC
+{
+    return ::operator new(size);
+}
+
+_LIBCPP_WEAK
+void*
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
     void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        p = ::operator new(size, alignment);
+        p = ::operator new[](size);
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
@@ -134,29 +109,92 @@ operator new(size_t size, std::align_val
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr) _NOEXCEPT
 {
-    return ::operator new(size);
+    if (ptr)
+        ::free(ptr);
 }
 
 _LIBCPP_WEAK
-void*
-operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+void
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
-    return ::operator new(size, alignment);
+    ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete(void* ptr, size_t) _NOEXCEPT
+{
+    ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr) _NOEXCEPT
+{
+    ::operator delete(ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
+{
+    ::operator delete[](ptr);
+}
+
+_LIBCPP_WEAK
+void
+operator delete[] (void* ptr, size_t) _NOEXCEPT
+{
+    ::operator delete[](ptr);
+}
+
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
+_LIBCPP_WEAK
+void *
+operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+    if (size == 0)
+        size = 1;
+    if (static_cast<size_t>(alignment) < sizeof(void*))
+      alignment = std::align_val_t(sizeof(void*));
+    void* p;
+#if defined(_LIBCPP_MSVCRT)
+    while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
+#else
+    while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
+#endif
+    {
+        // If posix_memalign fails and there is a new_handler,
+        // call it to try free up memory.
+        std::new_handler nh = std::get_new_handler();
+        if (nh)
+            nh();
+        else {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            throw std::bad_alloc();
+#else
+            p = nullptr; // posix_memalign doesn't initialize 'p' on failure
+            break;
+#endif
+        }
+    }
+    return p;
 }
 
 _LIBCPP_WEAK
 void*
-operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
+operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
     void* p = 0;
 #ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        p = ::operator new[](size);
+        p = ::operator new(size, alignment);
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
@@ -168,6 +206,13 @@ operator new[](size_t size, const std::n
 
 _LIBCPP_WEAK
 void*
+operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
+{
+    return ::operator new(size, alignment);
+}
+
+_LIBCPP_WEAK
+void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
     void* p = 0;
@@ -187,14 +232,6 @@ operator new[](size_t size, std::align_v
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr) _NOEXCEPT
-{
-    if (ptr)
-        ::free(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
     if (ptr)
@@ -207,13 +244,6 @@ operator delete(void* ptr, std::align_va
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
-{
-    ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
     ::operator delete(ptr, alignment);
@@ -221,13 +251,6 @@ operator delete(void* ptr, std::align_va
 
 _LIBCPP_WEAK
 void
-operator delete(void* ptr, size_t) _NOEXCEPT
-{
-    ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete(void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
 {
     ::operator delete(ptr, alignment);
@@ -235,13 +258,6 @@ operator delete(void* ptr, size_t, std::
 
 _LIBCPP_WEAK
 void
-operator delete[] (void* ptr) _NOEXCEPT
-{
-    ::operator delete(ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete[] (void* ptr, std::align_val_t alignment) _NOEXCEPT
 {
     ::operator delete(ptr, alignment);
@@ -249,13 +265,6 @@ operator delete[] (void* ptr, std::align
 
 _LIBCPP_WEAK
 void
-operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
-{
-    ::operator delete[](ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete[] (void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
     ::operator delete[](ptr, alignment);
@@ -263,18 +272,13 @@ operator delete[] (void* ptr, std::align
 
 _LIBCPP_WEAK
 void
-operator delete[] (void* ptr, size_t) _NOEXCEPT
-{
-    ::operator delete[](ptr);
-}
-
-_LIBCPP_WEAK
-void
 operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
 {
     ::operator delete[](ptr, alignment);
 }
 
+#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
+
 #endif // !__GLIBCXX__
 
 namespace std

Modified: vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -23,6 +23,14 @@
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
 
+#if TEST_STD_VER > 14
+constexpr bool check_idx( size_t idx, double val )
+{ 
+    std::array<double, 3> arr = {1, 2, 3.5};
+	return arr.at(idx) == val;
+}
+#endif
+
 int main()
 {
     {
@@ -82,4 +90,11 @@ int main()
     }
 #endif
 
+#if TEST_STD_VER > 14
+    {
+        static_assert (check_idx(0, 1), "");
+        static_assert (check_idx(1, 2), "");
+        static_assert (check_idx(2, 3.5), "");
+    }
+#endif
 }

Modified: vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -9,10 +9,10 @@
 
 // <array>
 
-// reference front();
-// reference back();
+// reference front();       // constexpr in C++17
+// reference back();        // constexpr in C++17
 // const_reference front(); // constexpr in C++14
-// const_reference back(); // constexpr in C++14
+// const_reference back();  // constexpr in C++14
 
 #include <array>
 #include <cassert>
@@ -23,6 +23,20 @@
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
 
+#if TEST_STD_VER > 14
+constexpr bool check_front( double val )
+{ 
+    std::array<double, 3> arr = {1, 2, 3.5};
+	return arr.front() == val;
+}
+
+constexpr bool check_back( double val )
+{ 
+    std::array<double, 3> arr = {1, 2, 3.5};
+	return arr.back() == val;
+}
+#endif
+
 int main()
 {
     {
@@ -65,4 +79,10 @@ int main()
     }
 #endif
 
+#if TEST_STD_VER > 14
+    {
+        static_assert (check_front(1),   "");
+        static_assert (check_back (3.5), "");
+    }
+#endif
 }

Modified: vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -23,6 +23,14 @@
 // Disable the missing braces warning for this reason.
 #include "disable_missing_braces_warning.h"
 
+#if TEST_STD_VER > 14
+constexpr bool check_idx( size_t idx, double val )
+{ 
+    std::array<double, 3> arr = {1, 2, 3.5};
+	return arr[idx] == val;
+}
+#endif
+
 int main()
 {
     {
@@ -63,4 +71,11 @@ int main()
     }
 #endif
 
+#if TEST_STD_VER > 14
+    {
+        static_assert (check_idx(0, 1), "");
+        static_assert (check_idx(1, 2), "");
+        static_assert (check_idx(2, 3.5), "");
+    }
+#endif
 }

Modified: vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -72,13 +72,60 @@ std::pair<std::time_t, std::time_t> GetS
     return {st.st_atime, st.st_mtime};
 }
 
-inline bool TimeIsRepresentableAsTimeT(file_time_type tp) {
+namespace {
+bool TestSupportsNegativeTimes() {
+    using namespace std::chrono;
+    std::error_code ec;
+    std::time_t old_write_time, new_write_time;
+    { // WARNING: Do not assert in this scope.
+        scoped_test_env env;
+        const path file = env.create_file("file", 42);
+        old_write_time = LastWriteTime(file);
+        file_time_type tp(seconds(-5));
+        fs::last_write_time(file, tp, ec);
+        new_write_time = LastWriteTime(file);
+    }
+    return !ec && new_write_time <= -5;
+}
+
+bool TestSupportsMaxTime() {
     using namespace std::chrono;
     using Lim = std::numeric_limits<std::time_t>;
-    auto sec = duration_cast<seconds>(tp.time_since_epoch()).count();
-    return (sec >= Lim::min() && sec <= Lim::max());
+    auto max_sec = duration_cast<seconds>(file_time_type::max().time_since_epoch()).count();
+    if (max_sec > Lim::max()) return false;
+    std::error_code ec;
+    std::time_t old_write_time, new_write_time;
+    { // WARNING: Do not assert in this scope.
+        scoped_test_env env;
+        const path file = env.create_file("file", 42);
+        old_write_time = LastWriteTime(file);
+        file_time_type tp = file_time_type::max();
+        fs::last_write_time(file, tp, ec);
+        new_write_time = LastWriteTime(file);
+    }
+    return !ec && new_write_time > max_sec - 1;
 }
 
+static const bool SupportsNegativeTimes = TestSupportsNegativeTimes();
+static const bool SupportsMaxTime = TestSupportsMaxTime();
+
+} // end namespace
+
+// Check if a time point is representable on a given filesystem. Check that:
+// (A) 'tp' is representable as a time_t
+// (B) 'tp' is non-negative or the filesystem supports negative times.
+// (C) 'tp' is not 'file_time_type::max()' or the filesystem supports the max
+//     value.
+inline bool TimeIsRepresentableByFilesystem(file_time_type tp) {
+    using namespace std::chrono;
+    using Lim = std::numeric_limits<std::time_t>;
+    auto sec = duration_cast<seconds>(tp.time_since_epoch()).count();
+    auto microsec = duration_cast<microseconds>(tp.time_since_epoch()).count();
+    if (sec < Lim::min() || sec > Lim::max())   return false;
+    else if (microsec < 0 && !SupportsNegativeTimes) return false;
+    else if (tp == file_time_type::max() && !SupportsMaxTime) return false;
+    return true;
+}
 
 TEST_SUITE(exists_test_suite)
 
@@ -214,15 +261,17 @@ TEST_CASE(set_last_write_time_dynamic_en
 
         file_time_type  got_time = last_write_time(TC.p);
 
-        TEST_CHECK(got_time != old_time);
-        if (TC.new_time < epoch_time) {
-            TEST_CHECK(got_time <= TC.new_time);
-            TEST_CHECK(got_time > TC.new_time - Sec(1));
-        } else {
-            TEST_CHECK(got_time <= TC.new_time + Sec(1));
-            TEST_CHECK(got_time >= TC.new_time - Sec(1));
+        if (TimeIsRepresentableByFilesystem(TC.new_time)) {
+            TEST_CHECK(got_time != old_time);
+            if (TC.new_time < epoch_time) {
+                TEST_CHECK(got_time <= TC.new_time);
+                TEST_CHECK(got_time > TC.new_time - Sec(1));
+            } else {
+                TEST_CHECK(got_time <= TC.new_time + Sec(1));
+                TEST_CHECK(got_time >= TC.new_time - Sec(1));
+            }
+            TEST_CHECK(LastAccessTime(TC.p) == old_times.first);
         }
-        TEST_CHECK(LastAccessTime(TC.p) == old_times.first);
     }
 }
 
@@ -269,17 +318,12 @@ TEST_CASE(test_write_min_time)
     const path p = env.create_file("file", 42);
 
     std::error_code ec = GetTestEC();
-    file_time_type last_time = last_write_time(p);
     file_time_type new_time = file_time_type::min();
 
     last_write_time(p, new_time, ec);
     file_time_type tt = last_write_time(p);
 
-    if (!TimeIsRepresentableAsTimeT(new_time)) {
-        TEST_CHECK(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(tt == last_time);
-    } else {
+    if (TimeIsRepresentableByFilesystem(new_time)) {
         TEST_CHECK(!ec);
         TEST_CHECK(tt >= new_time);
         TEST_CHECK(tt < new_time + Sec(1));
@@ -287,18 +331,13 @@ TEST_CASE(test_write_min_time)
 
     ec = GetTestEC();
     last_write_time(p, Clock::now());
-    last_time = last_write_time(p);
 
     new_time = file_time_type::min() + MicroSec(1);
 
     last_write_time(p, new_time, ec);
     tt = last_write_time(p);
 
-    if (!TimeIsRepresentableAsTimeT(new_time)) {
-        TEST_CHECK(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(tt == last_time);
-    } else {
+    if (TimeIsRepresentableByFilesystem(new_time)) {
         TEST_CHECK(!ec);
         TEST_CHECK(tt >= new_time);
         TEST_CHECK(tt < new_time + Sec(1));
@@ -317,18 +356,13 @@ TEST_CASE(test_write_min_max_time)
     const path p = env.create_file("file", 42);
 
     std::error_code ec = GetTestEC();
-    file_time_type last_time = last_write_time(p);
     file_time_type new_time = file_time_type::max();
 
     ec = GetTestEC();
     last_write_time(p, new_time, ec);
     file_time_type tt = last_write_time(p);
 
-    if (!TimeIsRepresentableAsTimeT(new_time)) {
-        TEST_CHECK(ec);
-        TEST_CHECK(ec != GetTestEC());
-        TEST_CHECK(tt == last_time);
-    } else {
+    if (TimeIsRepresentableByFilesystem(new_time)) {
         TEST_CHECK(!ec);
         TEST_CHECK(tt > new_time - Sec(1));
         TEST_CHECK(tt <= new_time);

Modified: vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -10,11 +10,16 @@
 // test type_info
 
 #include <typeinfo>
+#include <string>
 #include <cstring>
 #include <cassert>
 
+bool test_constructor_explicit(std::type_info const&) { return false; }
+bool test_constructor_explicit(std::string const&) { return true; }
+
 int main()
 {
+  {
     const std::type_info& t1 = typeid(int);
     const std::type_info& t2 = typeid(int);
     assert(t1 == t2);
@@ -23,4 +28,13 @@ int main()
     assert(!t1.before(t2));
     assert(strcmp(t1.name(), t2.name()) == 0);
     assert(strcmp(t1.name(), t3.name()) != 0);
+  }
+  {
+    // type_info has a protected constructor taking a string literal. This
+    // constructor is not intended for users. However it still participates
+    // in overload resolution, so we need to ensure that it is marked explicit
+    // to avoid ambiguous conversions.
+    // See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216201
+    assert(test_constructor_explicit("abc"));
+  }
 }

Added: vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// <string>
+
+// basic_string<charT,traits,Allocator>&
+//   operator=(basic_string<charT,traits,Allocator>&& str);
+
+#include <string>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main()
+{
+  // Test that assignment from {} and {ptr, len} are allowed and are not
+  // ambiguous.
+  {
+    std::string s = "hello world";
+    s = {};
+    assert(s.empty());
+  }
+  {
+    std::string s = "hello world";
+    s = {"abc", 2};
+    assert(s == "ab");
+  }
+}

Modified: vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp
==============================================================================
--- vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp	Sun Jan 22 16:52:49 2017	(r312629)
+++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp	Sun Jan 22 16:52:53 2017	(r312630)
@@ -28,12 +28,23 @@ test(std::basic_string_view<charT> sv)
     typedef std::basic_string<charT, std::char_traits<charT>, test_allocator<charT> > S;
     typedef typename S::traits_type T;
     typedef typename S::allocator_type A;
+  {
     S s2(sv);
     LIBCPP_ASSERT(s2.__invariants());
     assert(s2.size() == sv.size());
     assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
     assert(s2.get_allocator() == A());
     assert(s2.capacity() >= s2.size());
+  }
+  {
+    S s2;
+    s2 = sv;
+    LIBCPP_ASSERT(s2.__invariants());
+    assert(s2.size() == sv.size());
+    assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
+    assert(s2.get_allocator() == A());
+    assert(s2.capacity() >= s2.size());
+  }
 }
 
 template <class charT, class A>
@@ -42,12 +53,23 @@ test(std::basic_string_view<charT> sv, c
 {
     typedef std::basic_string<charT, std::char_traits<charT>, A> S;
     typedef typename S::traits_type T;
+  {
     S s2(sv, a);
     LIBCPP_ASSERT(s2.__invariants());
     assert(s2.size() == sv.size());
     assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
     assert(s2.get_allocator() == a);
     assert(s2.capacity() >= s2.size());
+  }
+  {
+    S s2(a);
+    s2 = sv;
+    LIBCPP_ASSERT(s2.__invariants());
+    assert(s2.size() == sv.size());
+    assert(T::compare(s2.data(), sv.data(), sv.size()) == 0);
+    assert(s2.get_allocator() == a);
+    assert(s2.capacity() >= s2.size());
+  }
 }
 
 int main()


More information about the svn-src-all mailing list