Merge f7d5bd26c for LLVM update to 344140

Change-Id: Ifb065c5cfb9e9a8353c26bbdc3803a444dea62b3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a39b4b..89c3536 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,9 +50,14 @@
  "${PROJECT_NAME} requires an out of source build. Please create a separate
  build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
  )
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+  message(STATUS "Configuring for clang-cl")
+  set(LIBCXX_TARGETING_CLANG_CL ON)
+endif()
 
 if (MSVC)
   set(LIBCXX_TARGETING_MSVC ON)
+  message(STATUS "Configuring for MSVC")
 else()
   set(LIBCXX_TARGETING_MSVC OFF)
 endif()
@@ -77,7 +82,7 @@
 option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
 
 # Benchmark options -----------------------------------------------------------
-option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependancies" ON)
+option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependencies" ON)
 set(LIBCXX_BENCHMARK_NATIVE_STDLIB "" CACHE STRING
         "Build the benchmarks against the specified native STL.
          The value must be one of libc++/libstdc++")
@@ -111,15 +116,11 @@
         "Install libc++fs.a" ON
         "LIBCXX_ENABLE_FILESYSTEM;LIBCXX_INSTALL_LIBRARY" OFF)
 
-if (FUCHSIA)
-  set(DEFAULT_ABI_VERSION 2)
-else()
-  set(DEFAULT_ABI_VERSION 1)
-endif()
-set(LIBCXX_ABI_VERSION ${DEFAULT_ABI_VERSION} CACHE STRING "ABI version of libc++.")
+set(LIBCXX_ABI_VERSION "1" CACHE STRING "ABI version of libc++. Can be either 1 or 2, where 2 is currently not stable. Defaults to 1.")
 option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF)
 option(LIBCXX_ABI_FORCE_ITANIUM "Ignore auto-detection and force use of the Itanium ABI.")
 option(LIBCXX_ABI_FORCE_MICROSOFT "Ignore auto-detection and force use of the Microsoft ABI.")
+option(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT "Enable per TU ABI insulation by default. To be used by vendors." OFF)
 set(LIBCXX_ABI_DEFINES "" CACHE STRING "A semicolon separated list of ABI macros to define in the site config header.")
 option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)
 
@@ -175,7 +176,7 @@
 
 cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   "Statically link the ABI library to shared library" ON
-  "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
+  "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF)
 
 # Generate and install a linker script inplace of libc++.so. The linker script
 # will link libc++ to the correct ABI library. This option is on by default
@@ -502,14 +503,16 @@
 
 # Required flags ==============================================================
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
-if (LIBCXX_HAS_MUSL_LIBC)
+if (LIBCXX_HAS_MUSL_LIBC OR LIBCXX_TARGETING_CLANG_CL)
   # musl's pthread implementations uses volatile types in their structs which is
   # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
   set(LIBCXX_STANDARD_VER c++14 CACHE INTERNAL "internal option to change build dialect")
 endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
+add_compile_flags_if_supported("/std:${LIBCXX_STANDARD_VER}")
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
-if(NOT ${SUPPORTS_DIALECT_NAME})
+mangle_name("LIBCXX_SUPPORTS_STD_COLON_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME_MSVC)
+if(NOT ${SUPPORTS_DIALECT_NAME} AND NOT ${SUPPORTS_DIALECT_NAME_MSVC})
   if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
     message(FATAL_ERROR "C++11 or greater is required but the compiler does not support ${LIBCXX_STANDARD_VER}")
   endif()
@@ -544,11 +547,29 @@
 add_compile_flags_if_supported(
     -Wall -Wextra -W -Wwrite-strings
     -Wno-unused-parameter -Wno-long-long
-    -Werror=return-type)
+    -Werror=return-type -Wextra-semi)
 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     add_compile_flags_if_supported(
         -Wno-user-defined-literals
         -Wno-covered-switch-default)
+    if (LIBCXX_TARGETING_CLANG_CL)
+      add_compile_flags_if_supported(
+        -Wno-c++98-compat
+        -Wno-c++98-compat-pedantic
+        -Wno-c++11-compat
+        -Wno-undef
+        -Wno-reserved-id-macro
+        -Wno-gnu-include-next
+        -Wno-gcc-compat # For ignoring "'diagnose_if' is a clang extension" warnings
+        -Wno-zero-as-null-pointer-constant # FIXME: Remove this and fix all occurrences.
+        -Wno-deprecated-dynamic-exception-spec # For auto_ptr
+        -Wno-sign-conversion
+        -Wno-old-style-cast
+        -Wno-deprecated # FIXME: Remove this and fix all occurrences.
+        -Wno-shift-sign-overflow # FIXME: Why do we need this with clang-cl but not clang?
+        -Wno-double-promotion # FIXME: remove me
+      )
+    endif()
 elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
     add_compile_flags_if_supported(
         -Wno-literal-suffix
@@ -656,12 +677,13 @@
 endif()
 
 # Configuration file flags =====================================================
-if (NOT LIBCXX_ABI_VERSION EQUAL DEFAULT_ABI_VERSION)
+if (NOT LIBCXX_ABI_VERSION EQUAL 1)
   config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION)
 endif()
 config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
 config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
 config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
+config_define_if(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT)
 
 config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
 config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
index ef3b4f5..1c19d7e 100644
--- a/cmake/Modules/HandleLibCXXABI.cmake
+++ b/cmake/Modules/HandleLibCXXABI.cmake
@@ -41,7 +41,7 @@
         get_filename_component(ifile ${fpath} NAME)
         set(src ${incpath}/${fpath})
 
-        set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath})
+        set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${ifile})
         add_custom_command(OUTPUT ${dst}
             DEPENDS ${src}
             COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
diff --git a/cmake/Modules/HandleLibcxxFlags.cmake b/cmake/Modules/HandleLibcxxFlags.cmake
index 65f7d18..24fe0c5 100644
--- a/cmake/Modules/HandleLibcxxFlags.cmake
+++ b/cmake/Modules/HandleLibcxxFlags.cmake
@@ -16,6 +16,7 @@
   string(REGEX REPLACE "^-+" "" strippedStr "${strippedStr}")
   string(REGEX REPLACE "-+$" "" strippedStr "${strippedStr}")
   string(REPLACE "-" "_" strippedStr "${strippedStr}")
+  string(REPLACE ":" "_COLON_" strippedStr "${strippedStr}")
   string(REPLACE "=" "_EQ_" strippedStr "${strippedStr}")
   string(REPLACE "+" "X" strippedStr "${strippedStr}")
   string(TOUPPER "${strippedStr}" ${output})
diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst
index d0b03c6..daf9229 100644
--- a/docs/BuildingLibcxx.rst
+++ b/docs/BuildingLibcxx.rst
@@ -332,6 +332,15 @@
   Use the specified GCC toolchain and standard library when building the native
   stdlib benchmark tests.
 
+.. option:: LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT:BOOL
+
+  **Default**: ``OFF``
+
+  Pick the default for whether to constrain ABI-unstable symbols to
+  each individual translation unit. This setting controls whether
+  `_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined by default --
+  see the documentation of that macro for details.
+
 
 libc++ ABI Feature Options
 --------------------------
diff --git a/docs/DesignDocs/CapturingConfigInfo.rst b/docs/DesignDocs/CapturingConfigInfo.rst
index 8810225..29156bf 100644
--- a/docs/DesignDocs/CapturingConfigInfo.rst
+++ b/docs/DesignDocs/CapturingConfigInfo.rst
@@ -28,7 +28,7 @@
   It makes developers lives harder if they have to regenerate the libc++ headers
   every time they are modified.
 
-* The solution should not make any of the libc++ headers dependant on
+* The solution should not make any of the libc++ headers dependent on
   files generated by the build system. The headers should be able to compile
   out of the box without any modification.
 
diff --git a/docs/DesignDocs/VisibilityMacros.rst b/docs/DesignDocs/VisibilityMacros.rst
index 493b445..08debbc 100644
--- a/docs/DesignDocs/VisibilityMacros.rst
+++ b/docs/DesignDocs/VisibilityMacros.rst
@@ -42,9 +42,7 @@
 
 **_LIBCPP_HIDE_FROM_ABI**
   Mark a function as not being part of the ABI of any final linked image that
-  uses it, and also as being internal to each TU that uses that function. In
-  other words, the address of a function marked with this attribute is not
-  guaranteed to be the same across translation units.
+  uses it.
 
 **_LIBCPP_HIDE_FROM_ABI_AFTER_V1**
   Mark a function as being hidden from the ABI (per `_LIBCPP_HIDE_FROM_ABI`)
@@ -61,6 +59,41 @@
   ABI, we should create a new _LIBCPP_HIDE_FROM_ABI_AFTER_XXX macro, and we can
   use it to start removing symbols from the ABI after that stable version.
 
+**_LIBCPP_HIDE_FROM_ABI_PER_TU**
+  This macro controls whether symbols hidden from the ABI with `_LIBCPP_HIDE_FROM_ABI`
+  are local to each translation unit in addition to being local to each final
+  linked image. This macro is defined to either 0 or 1. When it is defined to
+  1, translation units compiled with different versions of libc++ can be linked
+  together, since all non ABI-facing functions are local to each translation unit.
+  This allows static archives built with different versions of libc++ to be linked
+  together. This also means that functions marked with `_LIBCPP_HIDE_FROM_ABI`
+  are not guaranteed to have the same address across translation unit boundaries.
+
+  When the macro is defined to 0, there is no guarantee that translation units
+  compiled with different versions of libc++ can interoperate. However, this
+  leads to code size improvements, since non ABI-facing functions can be
+  deduplicated across translation unit boundaries.
+
+  This macro can be defined by users to control the behavior they want from
+  libc++. The default value of this macro (0 or 1) is controlled by whether
+  `_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT` is defined, which is intended to
+  be used by vendors only (see below).
+
+**_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT**
+  This macro controls the default value for `_LIBCPP_HIDE_FROM_ABI_PER_TU`.
+  When the macro is defined, per TU ABI insulation is enabled by default, and
+  `_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 1 unless overridden by users.
+  Otherwise, per TU ABI insulation is disabled by default, and
+  `_LIBCPP_HIDE_FROM_ABI_PER_TU` is defined to 0 unless overridden by users.
+
+  This macro is intended for vendors to control whether they want to ship
+  libc++ with per TU ABI insulation enabled by default. Users can always
+  control the behavior they want by defining `_LIBCPP_HIDE_FROM_ABI_PER_TU`
+  appropriately.
+
+  By default, this macro is not defined, which means that per TU ABI insulation
+  is not provided unless explicitly overridden by users.
+
 **_LIBCPP_TYPE_VIS**
   Mark a type's typeinfo, vtable and members as having default visibility.
   This attribute cannot be used on class templates.
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
new file mode 100644
index 0000000..7e8e307
--- /dev/null
+++ b/docs/ReleaseNotes.rst
@@ -0,0 +1,43 @@
+========================================
+Libc++ 8.0.0 (In-Progress) Release Notes
+========================================
+
+.. contents::
+   :local:
+   :depth: 2
+
+Written by the `Libc++ Team <https://libcxx.llvm.org>`_
+
+.. warning::
+
+   These are in-progress notes for the upcoming libc++ 8 release.
+   Release notes for previous releases can be found on
+   `the Download Page <https://releases.llvm.org/download.html>`_.
+
+Introduction
+============
+
+This document contains the release notes for the libc++ C++ Standard Library,
+part of the LLVM Compiler Infrastructure, release 8.0.0. Here we describe the
+status of libc++ in some detail, including major improvements from the previous
+release and new feature work. For the general LLVM release notes, see `the LLVM
+documentation <https://llvm.org/docs/ReleaseNotes.html>`_. All LLVM releases may
+be downloaded from the `LLVM releases web site <https://llvm.org/releases/>`_.
+
+For more information about libc++, please see the `Libc++ Web Site
+<https://libcxx.llvm.org>`_ or the `LLVM Web Site <https://llvm.org>`_.
+
+Note that if you are reading this file from a Subversion checkout or the
+main Libc++ web page, this document applies to the *next* release, not
+the current one. To see the release notes for a specific release, please
+see the `releases page <https://llvm.org/releases/>`_.
+
+What's New in Libc++ 8.0.0?
+===========================
+
+New Features
+------------
+
+API Changes
+-----------
+
diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst
index e10a27c..41f4106 100644
--- a/docs/UsingLibcxx.rst
+++ b/docs/UsingLibcxx.rst
@@ -226,6 +226,26 @@
   replacement scenarios from working, e.g. replacing `operator new` and
   expecting a non-replaced `operator new[]` to call the replaced `operator new`.
 
+**_LIBCPP_ENABLE_NODISCARD**:
+  Allow the library to add ``[[nodiscard]]`` attributes to entities not specified
+  as ``[[nodiscard]]`` by the current language dialect. This includes
+  backporting applications of ``[[nodiscard]]`` from newer dialects and
+  additional extended applications at the discretion of the library. All
+  additional applications of ``[[nodiscard]]`` are disabled by default.
+  See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>` for
+  more information.
+
+**_LIBCPP_DISABLE_NODISCARD_EXT**:
+  This macro prevents the library from applying ``[[nodiscard]]`` to entities
+  purely as an extension. See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>`
+  for more information.
+
+**_LIBCPP_ENABLE_DEPRECATION_WARNINGS**:
+  This macro enables warnings when using deprecated components. For example,
+  when compiling in C++11 mode, using `std::auto_ptr` with the macro defined
+  will trigger a warning saying that `std::auto_ptr` is deprecated. By default,
+  this macro is not defined.
+
 C++17 Specific Configuration Macros
 -----------------------------------
 **_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES**:
@@ -238,3 +258,58 @@
 
 **_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR**:
   This macro is used to re-enable `std::auto_ptr` in C++17.
+
+C++2a Specific Configuration Macros:
+------------------------------------
+**_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17**:
+  This macro can be used to disable diagnostics emitted from functions marked
+  ``[[nodiscard]]`` in dialects after C++17.  See :ref:`Extended Applications of [[nodiscard]] <nodiscard extension>`
+  for more information.
+
+
+Libc++ Extensions
+=================
+
+This section documents various extensions provided by libc++, how they're
+provided, and any information regarding how to use them.
+
+.. _nodiscard extension:
+
+Extended applications of ``[[nodiscard]]``
+------------------------------------------
+
+The ``[[nodiscard]]`` attribute is intended to help users find bugs where
+function return values are ignored when they shouldn't be. After C++17 the
+C++ standard has started to declared such library functions as ``[[nodiscard]]``.
+However, this application is limited and applies only to dialects after C++17.
+Users who want help diagnosing misuses of STL functions may desire a more
+liberal application of ``[[nodiscard]]``.
+
+For this reason libc++ provides an extension that does just that! The
+extension must be enabled by defining ``_LIBCPP_ENABLE_NODISCARD``. The extended
+applications of ``[[nodiscard]]`` takes two forms:
+
+1. Backporting ``[[nodiscard]]`` to entities declared as such by the
+   standard in newer dialects, but not in the present one.
+
+2. Extended applications of ``[[nodiscard]]``, at the libraries discretion,
+   applied to entities never declared as such by the standard.
+
+Users may also opt-out of additional applications ``[[nodiscard]]`` using
+additional macros.
+
+Applications of the first form, which backport ``[[nodiscard]]`` from a newer
+dialect may be disabled using macros specific to the dialect it was added. For
+example ``_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17``.
+
+Applications of the second form, which are pure extensions, may be disabled
+by defining ``_LIBCPP_DISABLE_NODISCARD_EXT``.
+
+
+Entities declared with ``_LIBCPP_NODISCARD_EXT``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This section lists all extended applications of ``[[nodiscard]]`` to entities
+which no dialect declares as such (See the second form described above).
+
+* ``get_temporary_buffer``
diff --git a/docs/conf.py b/docs/conf.py
index f532e30..50b372c 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -241,7 +241,7 @@
 #texinfo_show_urls = 'footnote'
 
 
-# FIXME: Define intersphinx configration.
+# FIXME: Define intersphinx configuration.
 intersphinx_mapping = {}
 
 
diff --git a/docs/index.rst b/docs/index.rst
index e4b3a87..bb56f2d 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -34,6 +34,7 @@
 .. toctree::
    :maxdepth: 2
 
+   ReleaseNotes
    UsingLibcxx
    BuildingLibcxx
    TestingLibcxx
@@ -79,8 +80,8 @@
 Platform and Compiler Support
 -----------------------------
 
-libc++ is known to work on the following platforms, using gcc-4.2 and
-clang  (lack of C++11 language support disables some functionality).
+libc++ is known to work on the following platforms, using gcc and
+clang.
 Note that functionality provided by ``<atomic>`` is only functional with clang
 and GCC.
 
@@ -104,7 +105,7 @@
 
 * C++11 - Complete
 * `C++14 - Complete <http://libcxx.llvm.org/cxx1y_status.html>`__
-* `C++1z - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
+* `C++17 - In Progress <http://libcxx.llvm.org/cxx1z_status.html>`__
 * `Post C++14 Technical Specifications - In Progress <http://libcxx.llvm.org/ts1z_status.html>`__
 
 Notes and Known Issues
@@ -160,21 +161,18 @@
 
 If you think you've found a bug in libc++, please report it using
 the `LLVM Bugzilla`_. If you're not sure, you
-can post a message to the `cfe-dev mailing list`_ or on IRC.
-Please include "libc++" in your subject.
+can post a message to the `libcxx-dev mailing list`_ or on IRC.
 
 **Patches**
 
 If you want to contribute a patch to libc++, the best place for that is
-`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please include [libcxx] in the subject and
-add `cfe-commits` as a subscriber. Also make sure you are subscribed to the
-`cfe-commits mailing list <http://lists.llvm.org/mailman/listinfo/cfe-commits>`_.
+`Phabricator <http://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber.
+Also make sure you are subscribed to the `libcxx-commits mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_.
 
 **Discussion and Questions**
 
 Send discussions and questions to the
-`cfe-dev mailing list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.
-Please include [libcxx] in the subject.
+`libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_.
 
 
 
@@ -183,7 +181,7 @@
 * `LLVM Homepage <http://llvm.org/>`_
 * `libc++abi Homepage <http://libcxxabi.llvm.org/>`_
 * `LLVM Bugzilla <https://bugs.llvm.org/>`_
-* `cfe-commits Mailing List`_
-* `cfe-dev Mailing List`_
+* `libcxx-commits Mailing List`_
+* `libcxx-dev Mailing List`_
 * `Browse libc++ -- SVN <http://llvm.org/svn/llvm-project/libcxx/trunk/>`_
 * `Browse libc++ -- ViewVC <http://llvm.org/viewvc/llvm-project/libcxx/trunk/>`_
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index d9def18..0ccf977 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -25,6 +25,7 @@
   any
   array
   atomic
+  bit
   bitset
   cassert
   ccomplex
diff --git a/include/__bit_reference b/include/__bit_reference
index 3e4a21d..c208af2 100644
--- a/include/__bit_reference
+++ b/include/__bit_reference
@@ -12,6 +12,7 @@
 #define _LIBCPP___BIT_REFERENCE
 
 #include <__config>
+#include <bit>
 #include <algorithm>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -254,18 +255,18 @@
         __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
         __storage_type __dn = _VSTD::min(__clz_f, __n);
         __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
-        __r = _VSTD::__pop_count(*__first.__seg_ & __m);
+        __r = _VSTD::__popcount(*__first.__seg_ & __m);
         __n -= __dn;
         ++__first.__seg_;
     }
     // do middle whole words
     for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
-        __r += _VSTD::__pop_count(*__first.__seg_);
+        __r += _VSTD::__popcount(*__first.__seg_);
     // do last partial word
     if (__n > 0)
     {
         __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
-        __r += _VSTD::__pop_count(*__first.__seg_ & __m);
+        __r += _VSTD::__popcount(*__first.__seg_ & __m);
     }
     return __r;
 }
@@ -285,18 +286,18 @@
         __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
         __storage_type __dn = _VSTD::min(__clz_f, __n);
         __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
-        __r = _VSTD::__pop_count(~*__first.__seg_ & __m);
+        __r = _VSTD::__popcount(~*__first.__seg_ & __m);
         __n -= __dn;
         ++__first.__seg_;
     }
     // do middle whole words
     for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
-        __r += _VSTD::__pop_count(~*__first.__seg_);
+        __r += _VSTD::__popcount(~*__first.__seg_);
     // do last partial word
     if (__n > 0)
     {
         __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
-        __r += _VSTD::__pop_count(~*__first.__seg_ & __m);
+        __r += _VSTD::__popcount(~*__first.__seg_ & __m);
     }
     return __r;
 }
diff --git a/include/__config b/include/__config
index 0f8f5a8..bababbc 100644
--- a/include/__config
+++ b/include/__config
@@ -36,11 +36,7 @@
 #define _LIBCPP_VERSION 8000
 
 #ifndef _LIBCPP_ABI_VERSION
-#  ifdef __Fuchsia__
-#    define _LIBCPP_ABI_VERSION 2
-#  else
-#    define _LIBCPP_ABI_VERSION 1
-#  endif
+#  define _LIBCPP_ABI_VERSION 1
 #endif
 
 #ifndef _LIBCPP_STD_VER
@@ -328,6 +324,31 @@
 #  define _LIBCPP_NO_CFI
 #endif
 
+#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
+#  if defined(__FreeBSD__)
+#    define _LIBCPP_HAS_QUICK_EXIT
+#    define _LIBCPP_HAS_C11_FEATURES
+#  elif defined(__Fuchsia__)
+#    define _LIBCPP_HAS_QUICK_EXIT
+#    define _LIBCPP_HAS_TIMESPEC_GET
+#    define _LIBCPP_HAS_C11_FEATURES
+#  elif defined(__linux__)
+#    if !defined(_LIBCPP_HAS_MUSL_LIBC)
+#      if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
+#        define _LIBCPP_HAS_QUICK_EXIT
+#      endif
+#      if _LIBCPP_GLIBC_PREREQ(2, 17)
+#        define _LIBCPP_HAS_C11_FEATURES
+#        define _LIBCPP_HAS_TIMESPEC_GET
+#      endif
+#    else // defined(_LIBCPP_HAS_MUSL_LIBC)
+#      define _LIBCPP_HAS_QUICK_EXIT
+#      define _LIBCPP_HAS_TIMESPEC_GET
+#      define _LIBCPP_HAS_C11_FEATURES
+#    endif
+#  endif // __linux__
+#endif
+
 #if defined(_LIBCPP_COMPILER_CLANG)
 
 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
@@ -430,28 +451,6 @@
 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
 #endif
 
-#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
-#  if defined(__FreeBSD__)
-#    define _LIBCPP_HAS_QUICK_EXIT
-#    define _LIBCPP_HAS_C11_FEATURES
-#  elif defined(__Fuchsia__)
-#    define _LIBCPP_HAS_QUICK_EXIT
-#    define _LIBCPP_HAS_C11_FEATURES
-#  elif defined(__linux__)
-#    if !defined(_LIBCPP_HAS_MUSL_LIBC)
-#      if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
-#        define _LIBCPP_HAS_QUICK_EXIT
-#      endif
-#      if _LIBCPP_GLIBC_PREREQ(2, 17)
-#        define _LIBCPP_HAS_C11_FEATURES
-#      endif
-#    else // defined(_LIBCPP_HAS_MUSL_LIBC)
-#      define _LIBCPP_HAS_QUICK_EXIT
-#      define _LIBCPP_HAS_C11_FEATURES
-#    endif
-#  endif // __linux__
-#endif
-
 #if !(__has_feature(cxx_noexcept))
 #define _LIBCPP_HAS_NO_NOEXCEPT
 #endif
@@ -795,8 +794,20 @@
 #  define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE
 #endif
 
+#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU
+#  ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
+#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 0
+#  else
+#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 1
+#  endif
+#endif
+
 #ifndef _LIBCPP_HIDE_FROM_ABI
-#  define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
+#  if _LIBCPP_HIDE_FROM_ABI_PER_TU
+#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
+#  else
+#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE
+#  endif
 #endif
 
 #ifdef _LIBCPP_BUILDING_LIBRARY
@@ -988,6 +999,11 @@
 #  endif
 #endif // defined(__APPLE__)
 
+#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
+    !defined(_LIBCPP_BUILDING_LIBRARY) && \
+    (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
+#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#endif
 
 #if defined(__APPLE__) || defined(__FreeBSD__)
 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
@@ -997,18 +1013,42 @@
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
-#if _LIBCPP_STD_VER > 11
-#  define _LIBCPP_DEPRECATED [[deprecated]]
+// Deprecation macros.
+// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.
+#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)
+#  if __has_attribute(deprecated)
+#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
+#  elif _LIBCPP_STD_VER > 11
+#    define _LIBCPP_DEPRECATED [[deprecated]]
+#  else
+#    define _LIBCPP_DEPRECATED
+#  endif
 #else
 #  define _LIBCPP_DEPRECATED
 #endif
 
+#if !defined(_LIBCPP_CXX03_LANG)
+#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
+#else
+#  define _LIBCPP_DEPRECATED_IN_CXX11
+#endif
+
+#if _LIBCPP_STD_VER >= 14
+#  define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
+#else
+#  define _LIBCPP_DEPRECATED_IN_CXX14
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
+#else
+#  define _LIBCPP_DEPRECATED_IN_CXX17
+#endif
+
 #if _LIBCPP_STD_VER <= 11
 #  define _LIBCPP_EXPLICIT_AFTER_CXX11
-#  define _LIBCPP_DEPRECATED_AFTER_CXX11
 #else
 #  define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
-#  define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
 #endif
 
 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
@@ -1029,8 +1069,30 @@
 #  define _LIBCPP_CONSTEXPR_AFTER_CXX17
 #endif
 
-#if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
-#  define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
+// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
+// NODISCARD macros to the correct attribute.
+#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
+#  define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]]
+#elif defined(_LIBCPP_COMPILER_CLANG) && !defined(_LIBCPP_CXX03_LANG)
+#  define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]]
+#else
+// We can't use GCC's [[gnu::warn_unused_result]] and
+// __attribute__((warn_unused_result)), because GCC does not silence them via
+// (void) cast.
+#  define _LIBCPP_NODISCARD_ATTRIBUTE
+#endif
+
+// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
+// specified as such as an extension.
+#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
+#  define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE
+#else
+#  define _LIBCPP_NODISCARD_EXT
+#endif
+
+#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \
+    (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD))
+#  define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE
 #else
 #  define _LIBCPP_NODISCARD_AFTER_CXX17
 #endif
diff --git a/include/__config_site.in b/include/__config_site.in
index 8d980ff..7c7c226 100644
--- a/include/__config_site.in
+++ b/include/__config_site.in
@@ -14,6 +14,7 @@
 #cmakedefine _LIBCPP_ABI_UNSTABLE
 #cmakedefine _LIBCPP_ABI_FORCE_ITANIUM
 #cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
+#cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
 #cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
 #cmakedefine _LIBCPP_HAS_NO_STDIN
 #cmakedefine _LIBCPP_HAS_NO_STDOUT
diff --git a/include/__functional_base b/include/__functional_base
index 57fdf2b..1887974 100644
--- a/include/__functional_base
+++ b/include/__functional_base
@@ -50,7 +50,7 @@
 #endif
 struct _LIBCPP_TEMPLATE_VIS less : binary_function<_Tp, _Tp, bool>
 {
-    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     bool operator()(const _Tp& __x, const _Tp& __y) const
         {return __x < __y;}
 };
@@ -59,7 +59,7 @@
 template <>
 struct _LIBCPP_TEMPLATE_VIS less<void>
 {
-    template <class _T1, class _T2> 
+    template <class _T1, class _T2>
     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
     auto operator()(_T1&& __t, _T2&& __u) const
     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
@@ -552,7 +552,7 @@
 struct __is_transparent : false_type {};
 
 template <class _Tp, class _Up>
-struct __is_transparent<_Tp, _Up,  
+struct __is_transparent<_Tp, _Up,
                         typename __void_t<typename _Tp::is_transparent>::type>
    : true_type {};
 #endif
diff --git a/include/__node_handle b/include/__node_handle
index fe09f3c..567f8b0 100644
--- a/include/__node_handle
+++ b/include/__node_handle
@@ -26,7 +26,8 @@
 
 #if _LIBCPP_STD_VER > 14
 
-#define __cpp_lib_node_extract 201606L
+// FIXME: Uncomment this when we support the 'merge' functionality.
+// #define __cpp_lib_node_extract 201606L
 
 // Specialized in __tree & __hash_table for their _NodeType.
 template <class _NodeType, class _Alloc>
diff --git a/include/__threading_support b/include/__threading_support
index 3c1eff2..2024900 100644
--- a/include/__threading_support
+++ b/include/__threading_support
@@ -70,7 +70,7 @@
 
 typedef pthread_t __libcpp_thread_t;
 
-// Thrad Local Storage
+// Thread Local Storage
 typedef pthread_key_t __libcpp_tls_key;
 
 #define _LIBCPP_TLS_DESTRUCTOR_CC
diff --git a/include/algorithm b/include/algorithm
index 90f1d24..9ce6aa0 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -645,13 +645,8 @@
 #include <functional>
 #include <iterator>
 #include <cstddef>
-
-#if defined(__IBMCPP__)
-#include "support/ibm/support.h"
-#endif
-#if defined(_LIBCPP_COMPILER_MSVC)
-#include <intrin.h>
-#endif
+#include <bit>
+#include <version>
 
 #include <__debug>
 
@@ -788,135 +783,6 @@
 
 #endif  // _LIBCPP_DEBUG
 
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __ctz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned>(__builtin_ctz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanForward(&where, __x))
-    return where;
-  return 32;
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __ctz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned long>(__builtin_ctzl(__x));
-#else
-    static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
-    return __ctz(static_cast<unsigned>(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __ctz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned long long>(__builtin_ctzll(__x));
-#else
-    unsigned long where;
-// Search from LSB to MSB for first set bit.
-// Returns zero if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-    (defined(_M_AMD64) || defined(__x86_64__))
-  if (_BitScanForward64(&where, __x))
-    return static_cast<int>(where);
-#else
-  // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
-  // Scan the Low Word.
-  if (_BitScanForward(&where, static_cast<unsigned long>(__x)))
-    return where;
-  // Scan the High Word.
-  if (_BitScanForward(&where, static_cast<unsigned long>(__x >> 32)))
-    return where + 32; // Create a bit offset from the LSB.
-#endif
-  return 64;
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-// Precondition:  __x != 0
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned __clz(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned>(__builtin_clz(__x));
-#else
-  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-  static_assert(sizeof(unsigned long) == 4, "");
-  unsigned long where;
-  // Search from LSB to MSB for first set bit.
-  // Returns zero if no set bit is found.
-  if (_BitScanReverse(&where, __x))
-    return 31 - where;
-  return 32; // Undefined Behavior.
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long __clz(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned long>(__builtin_clzl (__x));
-#else
-    static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
-    return __clz(static_cast<unsigned>(__x));
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long __clz(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-    return static_cast<unsigned long long>(__builtin_clzll(__x));
-#else
-  unsigned long where;
-// BitScanReverse scans from MSB to LSB for first set bit.
-// Returns 0 if no set bit is found.
-#if defined(_LIBCPP_HAS_BITSCAN64)
-  if (_BitScanReverse64(&where, __x))
-    return static_cast<int>(63 - where);
-#else
-  // Scan the high 32 bits.
-  if (_BitScanReverse(&where, static_cast<unsigned long>(__x >> 32)))
-    return 63 - (where + 32); // Create a bit offset from the MSB.
-  // Scan the low 32 bits.
-  if (_BitScanReverse(&where, static_cast<unsigned long>(__x)))
-    return 63 - where;
-#endif
-  return 64; // Undefined Behavior.
-#endif // _LIBCPP_COMPILER_MSVC
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcount  (__x);
-#else
-  static_assert(sizeof(unsigned) == 4, "");
-  return __popcnt(__x);
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcountl (__x);
-#else
-  static_assert(sizeof(unsigned long) == 4, "");
-  return __popcnt(__x);
-#endif
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {
-#ifndef _LIBCPP_COMPILER_MSVC
-  return __builtin_popcountll(__x);
-#else
-  static_assert(sizeof(unsigned long long) == 8, "");
-  return __popcnt64(__x);
-#endif
-}
-
 // all_of
 
 template <class _InputIterator, class _Predicate>
@@ -2533,6 +2399,8 @@
 _ForwardIterator
 min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
+    static_assert(__is_forward_iterator<_ForwardIterator>::value,
+        "std::min_element requires a ForwardIterator");
     if (__first != __last)
     {
         _ForwardIterator __i = __first;
@@ -2597,6 +2465,8 @@
 _ForwardIterator
 max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
+    static_assert(__is_forward_iterator<_ForwardIterator>::value,
+        "std::max_element requires a ForwardIterator");
     if (__first != __last)
     {
         _ForwardIterator __i = __first;
@@ -2683,6 +2553,8 @@
 std::pair<_ForwardIterator, _ForwardIterator>
 minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
 {
+  static_assert(__is_forward_iterator<_ForwardIterator>::value,
+        "std::minmax_element requires a ForwardIterator");
   std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first);
   if (__first != __last)
   {
@@ -3027,10 +2899,11 @@
 template<class _URNG>
 typename uniform_int_distribution<_IntType>::result_type
 uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p)
+_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
 {
     typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t),
                                             uint32_t, uint64_t>::type _UIntType;
-    const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1);
+    const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1);
     if (_Rp == 1)
         return __p.a();
     const size_t _Dt = numeric_limits<_UIntType>::digits;
@@ -3080,7 +2953,7 @@
 _LIBCPP_FUNC_VIS __rs_default __rs_get();
 
 template <class _RandomAccessIterator>
-void
+_LIBCPP_DEPRECATED_IN_CXX14 void
 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
 {
     typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
@@ -3101,7 +2974,7 @@
 }
 
 template <class _RandomAccessIterator, class _RandomNumberGenerator>
-void
+_LIBCPP_DEPRECATED_IN_CXX14 void
 random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
 #ifndef _LIBCPP_CXX03_LANG
                _RandomNumberGenerator&& __rand)
@@ -3116,7 +2989,8 @@
         for (--__last; __first < __last; ++__first, --__d)
         {
             difference_type __i = __rand(__d);
-            swap(*__first, *(__first + __i));
+            if (__i != difference_type(0))
+              swap(*__first, *(__first + __i));
         }
     }
 }
diff --git a/include/any b/include/any
index e6e0b6e..e2945bd 100644
--- a/include/any
+++ b/include/any
@@ -87,6 +87,7 @@
 #include <typeinfo>
 #include <type_traits>
 #include <cstdlib>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/array b/include/array
index ba4ff42..8f4e111 100644
--- a/include/array
+++ b/include/array
@@ -112,6 +112,7 @@
 #include <algorithm>
 #include <stdexcept>
 #include <cstdlib> // for _LIBCPP_UNREACHABLE
+#include <version>
 #include <__debug>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/include/atomic b/include/atomic
index 809f78a..d37e7b4 100644
--- a/include/atomic
+++ b/include/atomic
@@ -544,6 +544,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <type_traits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -559,10 +560,6 @@
 #error C++ standard library is incompatible with <stdatomic.h>
 #endif
 
-#if _LIBCPP_STD_VER > 14
-# define __cpp_lib_atomic_is_always_lock_free 201603L
-#endif
-
 #define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
   _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
                            __m == memory_order_acquire || \
diff --git a/include/bit b/include/bit
new file mode 100644
index 0000000..db3812e
--- /dev/null
+++ b/include/bit
@@ -0,0 +1,158 @@
+// -*- C++ -*-
+//===------------------------------ bit ----------------------------------===//
+//
+//                     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.
+//
+//===---------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_BIT
+#define _LIBCPP_BIT
+
+/*
+    bit synopsis
+
+namespace std {
+
+} // namespace std
+
+*/
+
+#include <__config>
+#include <version>
+
+#if defined(__IBMCPP__)
+#include "support/ibm/support.h"
+#endif
+#if defined(_LIBCPP_COMPILER_MSVC)
+#include <intrin.h>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifndef _LIBCPP_COMPILER_MSVC
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned __x)           { return __builtin_ctz(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long __x)      { return __builtin_ctzl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long long __x) { return __builtin_ctzll(__x); }
+
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned __x)           { return __builtin_clz(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long __x)      { return __builtin_clzl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long long __x) { return __builtin_clzll(__x); }
+
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned __x)           { return __builtin_popcount(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned long __x)      { return __builtin_popcountl(__x); }
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __popcount(unsigned long long __x) { return __builtin_popcountll(__x); }
+
+#else  // _LIBCPP_COMPILER_MSVC
+
+// Precondition:  __x != 0
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned __x) {
+  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+  static_assert(sizeof(unsigned long) == 4, "");
+  unsigned long __where;
+  if (_BitScanForward(&__where, __x))
+    return static_cast<int>(__where);
+  return 32;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long __x) {
+    static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
+    return __ctz(static_cast<unsigned>(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __ctz(unsigned long long __x) {
+    unsigned long __where;
+#if defined(_LIBCPP_HAS_BITSCAN64)
+    (defined(_M_AMD64) || defined(__x86_64__))
+  if (_BitScanForward64(&__where, __x))
+    return static_cast<int>(__where);
+#else
+  // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
+  if (_BitScanForward(&__where, static_cast<unsigned long>(__x)))
+    return static_cast<int>(__where);
+  if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32)))
+    return static_cast<int>(__where + 32);
+#endif
+  return 64;
+}
+
+// Precondition:  __x != 0
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned __x) {
+  static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+  static_assert(sizeof(unsigned long) == 4, "");
+  unsigned long __where;
+  if (_BitScanReverse(&__where, __x))
+    return static_cast<int>(31 - __where);
+  return 32; // Undefined Behavior.
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long __x) {
+    static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+    return __clz(static_cast<unsigned>(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+int __clz(unsigned long long __x) {
+  unsigned long __where;
+#if defined(_LIBCPP_HAS_BITSCAN64)
+  if (_BitScanReverse64(&__where, __x))
+    return static_cast<int>(63 - __where);
+#else
+  // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls.
+  if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32)))
+    return static_cast<int>(63 - (__where + 32));
+  if (_BitScanReverse(&__where, static_cast<unsigned long>(__x)))
+    return static_cast<int>(63 - __where);
+#endif
+  return 64; // Undefined Behavior.
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned __x) {
+  static_assert(sizeof(unsigned) == 4, "");
+  return __popcnt(__x);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long __x) {
+  static_assert(sizeof(unsigned long) == 4, "");
+  return __popcnt(__x);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __popcount(unsigned long long __x) {
+  static_assert(sizeof(unsigned long long) == 8, "");
+  return __popcnt64(__x);
+}
+
+#endif // _LIBCPP_COMPILER_MSVC
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_BIT
diff --git a/include/chrono b/include/chrono
index f0bd6af..0691101 100644
--- a/include/chrono
+++ b/include/chrono
@@ -77,16 +77,18 @@
 
     constexpr common_type<duration>::type  operator+() const;
     constexpr common_type<duration>::type  operator-() const;
-    constexpr duration& operator++();
-    constexpr duration  operator++(int);
-    constexpr duration& operator--();
-    constexpr duration  operator--(int);
+    constexpr duration& operator++();    // constexpr in C++17
+    constexpr duration  operator++(int); // constexpr in C++17
+    constexpr duration& operator--();    // constexpr in C++17
+    constexpr duration  operator--(int); // constexpr in C++17
 
-    constexpr duration& operator+=(const duration& d);
-    constexpr duration& operator-=(const duration& d);
+    constexpr duration& operator+=(const duration& d);  // constexpr in C++17
+    constexpr duration& operator-=(const duration& d);  // constexpr in C++17
 
-    duration& operator*=(const rep& rhs);
-    duration& operator/=(const rep& rhs);
+    duration& operator*=(const rep& rhs);       // constexpr in C++17
+    duration& operator/=(const rep& rhs);       // constexpr in C++17
+    duration& operator%=(const rep& rhs);       // constexpr in C++17
+    duration& operator%=(const duration& rhs);  // constexpr in C++17
 
     // special values
 
@@ -127,8 +129,8 @@
 
     // arithmetic
 
-    time_point& operator+=(const duration& d);
-    time_point& operator-=(const duration& d);
+    time_point& operator+=(const duration& d); // constexpr in C++17
+    time_point& operator-=(const duration& d); // constexpr in C++17
 
     // special values
 
@@ -796,6 +798,7 @@
 #include <type_traits>
 #include <ratio>
 #include <limits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1355,8 +1358,8 @@
 
     // arithmetic
 
-    _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
-    _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
 
     // special values
 
diff --git a/include/cmath b/include/cmath
index ffb1c46..f5f62ad 100644
--- a/include/cmath
+++ b/include/cmath
@@ -303,6 +303,7 @@
 
 #include <__config>
 #include <math.h>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/complex b/include/complex
index d692ee3..8cf6a94 100644
--- a/include/complex
+++ b/include/complex
@@ -245,6 +245,7 @@
 #include <stdexcept>
 #include <cmath>
 #include <sstream>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/cstddef b/include/cstddef
index 1dc5d39..b4c42b1 100644
--- a/include/cstddef
+++ b/include/cstddef
@@ -35,6 +35,7 @@
 */
 
 #include <__config>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -50,7 +51,7 @@
 using ::size_t;
 
 #if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
-    defined(__DEFINED_max_align_t)
+    defined(__DEFINED_max_align_t) || defined(__NetBSD__)
 // Re-use the compiler's <stddef.h> max_align_t where possible.
 using ::max_align_t;
 #else
diff --git a/include/cstdlib b/include/cstdlib
index 78c4284..00c604e 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -151,11 +151,11 @@
 using ::wctomb;
 using ::mbstowcs;
 using ::wcstombs;
-#ifdef _LIBCPP_HAS_QUICK_EXIT
+#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
 using ::at_quick_exit;
 using ::quick_exit;
 #endif
-#ifdef _LIBCPP_HAS_C11_FEATURES
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
 using ::aligned_alloc;
 #endif
 
diff --git a/include/ctime b/include/ctime
index 81cf11a..8264fe3 100644
--- a/include/ctime
+++ b/include/ctime
@@ -73,7 +73,7 @@
 using ::localtime;
 #endif
 using ::strftime;
-#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES)
+#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
 using ::timespec_get;
 #endif
 
diff --git a/include/deque b/include/deque
index bfbd3a5..414c7a8 100644
--- a/include/deque
+++ b/include/deque
@@ -161,6 +161,7 @@
 #include <iterator>
 #include <algorithm>
 #include <stdexcept>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/exception b/include/exception
index b517486..7fd9279 100644
--- a/include/exception
+++ b/include/exception
@@ -81,6 +81,7 @@
 #include <cstddef>
 #include <cstdlib>
 #include <type_traits>
+#include <version>
 
 #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
 #include <vcruntime_exception.h>
diff --git a/include/filesystem b/include/filesystem
index aa1d718..339bb25 100644
--- a/include/filesystem
+++ b/include/filesystem
@@ -244,6 +244,7 @@
 #include <utility>
 #include <iomanip> // for quoted
 #include <string_view>
+#include <version>
 
 #include <__debug>
 
@@ -256,10 +257,6 @@
 
 #ifndef _LIBCPP_CXX03_LANG
 
-#if _LIBCPP_STD_VER >= 17
-#define __cpp_lib_filesystem 201703
-#endif
-
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
 struct _FilesystemClock {
@@ -590,7 +587,7 @@
 typename enable_if<__can_convert_char<_ECharT>::value, bool>::type
 __is_separator(_ECharT __e) {
   return __e == _ECharT('/');
-};
+}
 
 struct _NullSentinal {};
 
diff --git a/include/forward_list b/include/forward_list
index 571afdc..f9a71f0 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -177,6 +177,7 @@
 #include <limits>
 #include <iterator>
 #include <algorithm>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/functional b/include/functional
index b91fd75..61c87b0 100644
--- a/include/functional
+++ b/include/functional
@@ -183,7 +183,7 @@
 };
 
 template <class Predicate>
-class unary_negate
+class unary_negate // deprecated in C++17
     : public unary_function<typename Predicate::argument_type, bool>
 {
 public:
@@ -191,10 +191,11 @@
     bool operator()(const typename Predicate::argument_type& x) const;
 };
 
-template <class Predicate> unary_negate<Predicate> not1(const Predicate& pred);
+template <class Predicate> // deprecated in C++17
+unary_negate<Predicate> not1(const Predicate& pred);
 
 template <class Predicate>
-class binary_negate
+class binary_negate // deprecated in C++17
     : public binary_function<typename Predicate::first_argument_type,
                              typename Predicate::second_argument_type,
                              bool>
@@ -205,7 +206,8 @@
                     const typename Predicate::second_argument_type& y) const;
 };
 
-template <class Predicate> binary_negate<Predicate> not2(const Predicate& pred);
+template <class Predicate> // deprecated in C++17
+binary_negate<Predicate> not2(const Predicate& pred);
 
 template <class F> unspecified not_fn(F&& f); // C++17
 
@@ -487,6 +489,7 @@
 #include <memory>
 #include <tuple>
 #include <utility>
+#include <version>
 
 #include <__functional_base>
 
@@ -980,7 +983,7 @@
 #endif
 
 template <class _Predicate>
-class _LIBCPP_TEMPLATE_VIS unary_negate
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate
     : public unary_function<typename _Predicate::argument_type, bool>
 {
     _Predicate __pred_;
@@ -994,12 +997,12 @@
 };
 
 template <class _Predicate>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
 unary_negate<_Predicate>
 not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
 
 template <class _Predicate>
-class _LIBCPP_TEMPLATE_VIS binary_negate
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 binary_negate
     : public binary_function<typename _Predicate::first_argument_type,
                              typename _Predicate::second_argument_type,
                              bool>
@@ -1016,13 +1019,13 @@
 };
 
 template <class _Predicate>
-inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
 binary_negate<_Predicate>
 not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
 
 #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
 template <class __Operation>
-class _LIBCPP_TEMPLATE_VIS binder1st
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st
     : public unary_function<typename __Operation::second_argument_type,
                             typename __Operation::result_type>
 {
@@ -1042,13 +1045,13 @@
 };
 
 template <class __Operation, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 binder1st<__Operation>
 bind1st(const __Operation& __op, const _Tp& __x)
     {return binder1st<__Operation>(__op, __x);}
 
 template <class __Operation>
-class _LIBCPP_TEMPLATE_VIS binder2nd
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder2nd
     : public unary_function<typename __Operation::first_argument_type,
                             typename __Operation::result_type>
 {
@@ -1068,13 +1071,13 @@
 };
 
 template <class __Operation, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 binder2nd<__Operation>
 bind2nd(const __Operation& __op, const _Tp& __x)
     {return binder2nd<__Operation>(__op, __x);}
 
 template <class _Arg, class _Result>
-class _LIBCPP_TEMPLATE_VIS pointer_to_unary_function
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function
     : public unary_function<_Arg, _Result>
 {
     _Result (*__f_)(_Arg);
@@ -1086,13 +1089,13 @@
 };
 
 template <class _Arg, class _Result>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 pointer_to_unary_function<_Arg,_Result>
 ptr_fun(_Result (*__f)(_Arg))
     {return pointer_to_unary_function<_Arg,_Result>(__f);}
 
 template <class _Arg1, class _Arg2, class _Result>
-class _LIBCPP_TEMPLATE_VIS pointer_to_binary_function
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function
     : public binary_function<_Arg1, _Arg2, _Result>
 {
     _Result (*__f_)(_Arg1, _Arg2);
@@ -1104,13 +1107,14 @@
 };
 
 template <class _Arg1, class _Arg2, class _Result>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 pointer_to_binary_function<_Arg1,_Arg2,_Result>
 ptr_fun(_Result (*__f)(_Arg1,_Arg2))
     {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
 
 template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS mem_fun_t : public unary_function<_Tp*, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_t
+    : public unary_function<_Tp*, _Sp>
 {
     _Sp (_Tp::*__p_)();
 public:
@@ -1121,7 +1125,8 @@
 };
 
 template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_t
+    : public binary_function<_Tp*, _Ap, _Sp>
 {
     _Sp (_Tp::*__p_)(_Ap);
 public:
@@ -1132,19 +1137,20 @@
 };
 
 template<class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 mem_fun_t<_Sp,_Tp>
 mem_fun(_Sp (_Tp::*__f)())
     {return mem_fun_t<_Sp,_Tp>(__f);}
 
 template<class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 mem_fun1_t<_Sp,_Tp,_Ap>
 mem_fun(_Sp (_Tp::*__f)(_Ap))
     {return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
 
 template<class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS mem_fun_ref_t : public unary_function<_Tp, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun_ref_t
+    : public unary_function<_Tp, _Sp>
 {
     _Sp (_Tp::*__p_)();
 public:
@@ -1155,7 +1161,8 @@
 };
 
 template<class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 mem_fun1_ref_t
+    : public binary_function<_Tp, _Ap, _Sp>
 {
     _Sp (_Tp::*__p_)(_Ap);
 public:
@@ -1166,19 +1173,20 @@
 };
 
 template<class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 mem_fun_ref_t<_Sp,_Tp>
 mem_fun_ref(_Sp (_Tp::*__f)())
     {return mem_fun_ref_t<_Sp,_Tp>(__f);}
 
 template<class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 mem_fun1_ref_t<_Sp,_Tp,_Ap>
 mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
     {return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
 
 template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun_t : public unary_function<const _Tp*, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_t
+    : public unary_function<const _Tp*, _Sp>
 {
     _Sp (_Tp::*__p_)() const;
 public:
@@ -1189,7 +1197,8 @@
 };
 
 template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_t
+    : public binary_function<const _Tp*, _Ap, _Sp>
 {
     _Sp (_Tp::*__p_)(_Ap) const;
 public:
@@ -1200,19 +1209,20 @@
 };
 
 template <class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 const_mem_fun_t<_Sp,_Tp>
 mem_fun(_Sp (_Tp::*__f)() const)
     {return const_mem_fun_t<_Sp,_Tp>(__f);}
 
 template <class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 const_mem_fun1_t<_Sp,_Tp,_Ap>
 mem_fun(_Sp (_Tp::*__f)(_Ap) const)
     {return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
 
 template <class _Sp, class _Tp>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun_ref_t : public unary_function<_Tp, _Sp>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun_ref_t
+    : public unary_function<_Tp, _Sp>
 {
     _Sp (_Tp::*__p_)() const;
 public:
@@ -1223,7 +1233,7 @@
 };
 
 template <class _Sp, class _Tp, class _Ap>
-class _LIBCPP_TEMPLATE_VIS const_mem_fun1_ref_t
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 const_mem_fun1_ref_t
     : public binary_function<_Tp, _Ap, _Sp>
 {
     _Sp (_Tp::*__p_)(_Ap) const;
@@ -1235,13 +1245,13 @@
 };
 
 template <class _Sp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 const_mem_fun_ref_t<_Sp,_Tp>
 mem_fun_ref(_Sp (_Tp::*__f)() const)
     {return const_mem_fun_ref_t<_Sp,_Tp>(__f);}
 
 template <class _Sp, class _Tp, class _Ap>
-inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_INLINE_VISIBILITY
 const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
 mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
     {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
@@ -2105,53 +2115,53 @@
 
 template <class _Ti, bool IsReferenceWrapper, bool IsBindEx, bool IsPh,
           class _TupleUj>
-struct ____mu_return;
+struct __mu_return_impl;
 
 template <bool _Invokable, class _Ti, class ..._Uj>
-struct ____mu_return_invokable  // false
+struct __mu_return_invokable  // false
 {
     typedef __nat type;
 };
 
 template <class _Ti, class ..._Uj>
-struct ____mu_return_invokable<true, _Ti, _Uj...>
+struct __mu_return_invokable<true, _Ti, _Uj...>
 {
     typedef typename __invoke_of<_Ti&, _Uj...>::type type;
 };
 
 template <class _Ti, class ..._Uj>
-struct ____mu_return<_Ti, false, true, false, tuple<_Uj...> >
-    : public ____mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
+struct __mu_return_impl<_Ti, false, true, false, tuple<_Uj...> >
+    : public __mu_return_invokable<__invokable<_Ti&, _Uj...>::value, _Ti, _Uj...>
 {
 };
 
 template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, false, true, _TupleUj>
+struct __mu_return_impl<_Ti, false, false, true, _TupleUj>
 {
     typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
                                    _TupleUj>::type&& type;
 };
 
 template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, true, false, false, _TupleUj>
+struct __mu_return_impl<_Ti, true, false, false, _TupleUj>
 {
     typedef typename _Ti::type& type;
 };
 
 template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, false, false, _TupleUj>
+struct __mu_return_impl<_Ti, false, false, false, _TupleUj>
 {
     typedef _Ti& type;
 };
 
 template <class _Ti, class _TupleUj>
 struct __mu_return
-    : public ____mu_return<_Ti,
-                           __is_reference_wrapper<_Ti>::value,
-                           is_bind_expression<_Ti>::value,
-                           0 < is_placeholder<_Ti>::value &&
-                           is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
-                           _TupleUj>
+    : public __mu_return_impl<_Ti,
+                              __is_reference_wrapper<_Ti>::value,
+                              is_bind_expression<_Ti>::value,
+                              0 < is_placeholder<_Ti>::value &&
+                              is_placeholder<_Ti>::value <= tuple_size<_TupleUj>::value,
+                              _TupleUj>
 {
 };
 
@@ -2340,8 +2350,6 @@
 
 #if _LIBCPP_STD_VER > 14
 
-#define __cpp_lib_invoke 201411
-
 template <class _Fn, class ..._Args>
 result_of_t<_Fn&&(_Args&&...)>
 invoke(_Fn&& __f, _Args&&... __args)
diff --git a/include/future b/include/future
index 0f6d426..b3ffc7e 100644
--- a/include/future
+++ b/include/future
@@ -556,13 +556,14 @@
         {return (__state_ & __constructed) || (__exception_ != nullptr);}
 
     _LIBCPP_INLINE_VISIBILITY
-    void __set_future_attached()
-    {
+    void __attach_future() {
         lock_guard<mutex> __lk(__mut_);
+        bool __has_future_attached = (__state_ & __future_attached) != 0;
+        if (__has_future_attached)
+            __throw_future_error(future_errc::future_already_retrieved);
+        this->__add_shared();
         __state_ |= __future_attached;
     }
-    _LIBCPP_INLINE_VISIBILITY
-    bool __has_future_attached() const {return (__state_ & __future_attached) != 0;}
 
     _LIBCPP_INLINE_VISIBILITY
     void __set_deferred() {__state_ |= deferred;}
@@ -1154,10 +1155,7 @@
 future<_Rp>::future(__assoc_state<_Rp>* __state)
     : __state_(__state)
 {
-    if (__state_->__has_future_attached())
-        __throw_future_error(future_errc::future_already_retrieved);
-    __state_->__add_shared();
-    __state_->__set_future_attached();
+    __state_->__attach_future();
 }
 
 struct __release_shared_count
@@ -1257,10 +1255,7 @@
 future<_Rp&>::future(__assoc_state<_Rp&>* __state)
     : __state_(__state)
 {
-    if (__state_->__has_future_attached())
-        __throw_future_error(future_errc::future_already_retrieved);
-    __state_->__add_shared();
-    __state_->__set_future_attached();
+    __state_->__attach_future();
 }
 
 template <class _Rp>
diff --git a/include/iomanip b/include/iomanip
index a6bee73..36c1116 100644
--- a/include/iomanip
+++ b/include/iomanip
@@ -46,6 +46,7 @@
 #include <__config>
 #include <__string>
 #include <istream>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/iterator b/include/iterator
index 9415e0b..aed0525 100644
--- a/include/iterator
+++ b/include/iterator
@@ -418,6 +418,7 @@
 #include <type_traits>
 #include <cstddef>
 #include <initializer_list>
+#include <version>
 #ifdef __APPLE__
 #include <Availability.h>
 #endif
diff --git a/include/list b/include/list
index d2e78cd..8f0e1db 100644
--- a/include/list
+++ b/include/list
@@ -181,6 +181,7 @@
 #include <iterator>
 #include <algorithm>
 #include <type_traits>
+#include <version>
 
 #include <__debug>
 
@@ -2208,7 +2209,7 @@
 void
 list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
 {
-    if (this != &__c)
+    if (this != _VSTD::addressof(__c))
     {
         iterator __f1 = begin();
         iterator __e1 = end();
diff --git a/include/map b/include/map
index 559ec48..cfd8280 100644
--- a/include/map
+++ b/include/map
@@ -460,6 +460,7 @@
 #include <functional>
 #include <initializer_list>
 #include <type_traits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1884,7 +1885,7 @@
 #endif
 
     _LIBCPP_INLINE_VISIBILITY
-    void clear() {__tree_.clear();}
+    void clear() _NOEXCEPT {__tree_.clear();}
 
     _LIBCPP_INLINE_VISIBILITY
     void swap(multimap& __m)
diff --git a/include/memory b/include/memory
index a4bf89b..6e292a5 100644
--- a/include/memory
+++ b/include/memory
@@ -212,10 +212,10 @@
 template <class ForwardIterator, class Size>
  ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n);
 
-template <class Y> struct auto_ptr_ref {};      // removed in C++17
+template <class Y> struct auto_ptr_ref {};      // deprecated in C++11, removed in C++17
 
 template<class X>
-class auto_ptr                                  // removed in C++17
+class auto_ptr                                  // deprecated in C++11, removed in C++17
 {
 public:
     typedef X element_type;
@@ -667,6 +667,7 @@
 #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
 #  include <atomic>
 #endif
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1782,7 +1783,7 @@
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator() _NOEXCEPT {}
 
-    template <class _Up> 
+    template <class _Up>
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator(const allocator<_Up>&) _NOEXCEPT {}
 
@@ -1790,7 +1791,7 @@
         {return _VSTD::addressof(__x);}
     _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
         {return _VSTD::addressof(__x);}
-    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 
+    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
     pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
         {
         if (__n > max_size())
@@ -1887,7 +1888,7 @@
     allocator() _NOEXCEPT {}
 
     template <class _Up>
-    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator(const allocator<_Up>&) _NOEXCEPT {}
 
     _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
@@ -1989,10 +1990,10 @@
     _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
-        {::new(&*__x_) _Tp(__element); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
 #if _LIBCPP_STD_VER >= 14
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
-        {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;}
 #endif
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
@@ -2003,7 +2004,7 @@
 };
 
 template <class _Tp>
-_LIBCPP_NO_CFI
+_LIBCPP_NODISCARD_EXT _LIBCPP_NO_CFI
 pair<_Tp*, ptrdiff_t>
 get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT
 {
@@ -2056,13 +2057,13 @@
 
 #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
 template <class _Tp>
-struct auto_ptr_ref
+struct _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr_ref
 {
     _Tp* __ptr_;
 };
 
 template<class _Tp>
-class _LIBCPP_TEMPLATE_VIS auto_ptr
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr
 {
 private:
     _Tp* __ptr_;
@@ -2106,7 +2107,7 @@
 };
 
 template <>
-class _LIBCPP_TEMPLATE_VIS auto_ptr<void>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 auto_ptr<void>
 {
 public:
     typedef void element_type;
@@ -2130,7 +2131,9 @@
   _LIBCPP_INLINE_VISIBILITY
   constexpr explicit
   __compressed_pair_elem(_Up&& __u)
-      : __value_(_VSTD::forward<_Up>(__u)){};
+      : __value_(_VSTD::forward<_Up>(__u))
+    {
+    }
 
   template <class... _Args, size_t... _Indexes>
   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -2167,7 +2170,8 @@
   _LIBCPP_INLINE_VISIBILITY
   constexpr explicit
   __compressed_pair_elem(_Up&& __u)
-      : __value_type(_VSTD::forward<_Up>(__u)){};
+      : __value_type(_VSTD::forward<_Up>(__u))
+  {}
 
   template <class... _Args, size_t... _Indexes>
   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
@@ -3682,7 +3686,7 @@
     virtual void __on_zero_shared_weak() _NOEXCEPT;
 public:
     _LIBCPP_INLINE_VISIBILITY
-    _Tp* get() _NOEXCEPT {return &__data_.second();}
+    _Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());}
 };
 
 template <class _Tp, class _Alloc>
@@ -5631,8 +5635,11 @@
     _Tp &   get() { return *__addr(); }
 
     template<class... _Args>
-    __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc)
-    { _Traits::construct(__a, __addr(), _VSTD::forward<_Args>(__args)...); }
+    _LIBCPP_NO_CFI
+    __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
+      _Traits::construct(__a, reinterpret_cast<_Tp*>(addressof(__v)),
+                         _VSTD::forward<_Args>(__args)...);
+    }
 
     ~__temp_value() { _Traits::destroy(__a, __addr()); }
     };
diff --git a/include/module.modulemap b/include/module.modulemap
index 0895055..681c80b 100644
--- a/include/module.modulemap
+++ b/include/module.modulemap
@@ -228,6 +228,10 @@
     header "atomic"
     export *
   }
+  module bit {
+    header "bit"
+    export *
+  }
   module bitset {
     header "bitset"
     export string
diff --git a/include/mutex b/include/mutex
index 52e39b0..6d2de2b 100644
--- a/include/mutex
+++ b/include/mutex
@@ -194,6 +194,7 @@
 #ifndef _LIBCPP_CXX03_LANG
 #include <tuple>
 #endif
+#include <version>
 #include <__threading_support>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -488,7 +489,7 @@
 };
 
 template <class _Mutex>
-class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> {
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) scoped_lock<_Mutex> {
 public:
     typedef _Mutex  mutex_type;
 private:
diff --git a/include/new b/include/new
index d33f691..7c3076c 100644
--- a/include/new
+++ b/include/new
@@ -91,6 +91,7 @@
 #include <exception>
 #include <type_traits>
 #include <cstddef>
+#include <version>
 #ifdef _LIBCPP_NO_EXCEPTIONS
 #include <cstdlib>
 #endif
@@ -108,13 +109,6 @@
 # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
-    (!(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER > 14 || \
-    (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)))
-# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
-#endif
-
-
 #if !__has_builtin(__builtin_operator_new) || \
    __has_builtin(__builtin_operator_new) < 201802L || \
    defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \
@@ -177,6 +171,10 @@
 enum align_val_t { __zero = 0, __max = (size_t)-1 };
 #endif
 #endif
+#elif !defined(__cpp_aligned_new)
+// We're defering to Microsoft's STL to provide aligned new et al. We don't
+// have it unless the language feature test macro is defined.
+#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
 }  // std
diff --git a/include/numeric b/include/numeric
index 70ef173..4e68239 100644
--- a/include/numeric
+++ b/include/numeric
@@ -142,6 +142,7 @@
 #include <iterator>
 #include <limits> // for numeric_limits
 #include <functional>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/optional b/include/optional
index a76f8d1..9ef0aac 100644
--- a/include/optional
+++ b/include/optional
@@ -156,6 +156,7 @@
 #include <stdexcept>
 #include <type_traits>
 #include <utility>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/random b/include/random
index 89664a6..724bd0f 100644
--- a/include/random
+++ b/include/random
@@ -2337,7 +2337,7 @@
         for (size_t __i = 1; __i < __n; ++__i)
             if (__x_[__i] != 0)
                 return;
-        __x_[0] = _Max;
+        __x_[0] = result_type(1) << (__w - 1);
     }
 }
 
@@ -2363,7 +2363,7 @@
         for (size_t __i = 1; __i < __n; ++__i)
             if (__x_[__i] != 0)
                 return;
-        __x_[0] = _Max;
+        __x_[0] = result_type(1) << (__w - 1);
     }
 }
 
diff --git a/include/regex b/include/regex
index 84aacc0..1858500 100644
--- a/include/regex
+++ b/include/regex
@@ -769,6 +769,7 @@
 #include <memory>
 #include <vector>
 #include <deque>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1351,9 +1352,9 @@
     virtual ~__node() {}
 
     _LIBCPP_INLINE_VISIBILITY
-    virtual void __exec(__state&) const {};
+    virtual void __exec(__state&) const {}
     _LIBCPP_INLINE_VISIBILITY
-    virtual void __exec_split(bool, __state&) const {};
+    virtual void __exec_split(bool, __state&) const {}
 };
 
 // __end_state
@@ -2414,20 +2415,17 @@
                 goto __exit;
             }
         }
-        // set of "__found" chars =
+        // When there's at least one of __neg_chars_ and __neg_mask_, the set
+        // of "__found" chars is
         //   union(complement(union(__neg_chars_, __neg_mask_)),
         //         other cases...)
         //
-        // __neg_chars_ and __neg_mask_'d better be handled together, as there
-        // are no short circuit opportunities.
-        //
-        // In addition, when __neg_mask_/__neg_chars_ is empty, they should be
-        // treated as all ones/all chars.
+        // It doesn't make sense to check this when there are no __neg_chars_
+        // and no __neg_mask_.
+        if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
         {
-          const bool __in_neg_mask = (__neg_mask_ == 0) ||
-              __traits_.isctype(__ch, __neg_mask_);
+            const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
           const bool __in_neg_chars =
-              __neg_chars_.empty() ||
               std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
               __neg_chars_.end();
           if (!(__in_neg_mask || __in_neg_chars))
diff --git a/include/scoped_allocator b/include/scoped_allocator
index 4760d94..bdbb013 100644
--- a/include/scoped_allocator
+++ b/include/scoped_allocator
@@ -108,6 +108,7 @@
 
 #include <__config>
 #include <memory>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/set b/include/set
index 108a9e9..f2ce6ea 100644
--- a/include/set
+++ b/include/set
@@ -402,6 +402,7 @@
 #include <__tree>
 #include <__node_handle>
 #include <functional>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/shared_mutex b/include/shared_mutex
index a7735d6..fbde0cf 100644
--- a/include/shared_mutex
+++ b/include/shared_mutex
@@ -124,6 +124,7 @@
 */
 
 #include <__config>
+#include <version>
 
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
diff --git a/include/span b/include/span
index 5a77ff8..ea7aecb 100644
--- a/include/span
+++ b/include/span
@@ -242,7 +242,7 @@
         constexpr span(      _Container& __c,
             enable_if_t<__is_span_compatible_container<_Container, _Tp>::value, nullptr_t> = nullptr)
         : __data{_VSTD::data(__c)}
-        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container))"); }
+        { _LIBCPP_ASSERT(_Extent == _VSTD::size(__c), "size mismatch in span's constructor (container)"); }
 
     template <class _Container>
     inline _LIBCPP_INLINE_VISIBILITY
@@ -440,7 +440,7 @@
     inline _LIBCPP_INLINE_VISIBILITY
         constexpr span<element_type, _Count> first() const noexcept
     {
-        static_assert(_Count >= 0);
+        static_assert(_Count >= 0, "Count must be >= 0 in span::first()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::first()");
         return {data(), _Count};
     }
@@ -449,7 +449,7 @@
     inline _LIBCPP_INLINE_VISIBILITY
         constexpr span<element_type, _Count> last() const noexcept
     {
-        static_assert(_Count >= 0);
+        static_assert(_Count >= 0, "Count must be >= 0 in span::last()");
         _LIBCPP_ASSERT(_Count <= size(), "Count out of range in span::last()");
         return {data() + size() - _Count, _Count};
     }
diff --git a/include/stddef.h b/include/stddef.h
index faf8552..f65065d 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -54,7 +54,7 @@
 
 // Re-use the compiler's <stddef.h> max_align_t where possible.
 #if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
-    !defined(__DEFINED_max_align_t)
+    !defined(__DEFINED_max_align_t) && !defined(__NetBSD__)
 typedef long double max_align_t;
 #endif
 
diff --git a/include/string b/include/string
index 162e540..c79164c 100644
--- a/include/string
+++ b/include/string
@@ -510,6 +510,7 @@
 #include <type_traits>
 #include <initializer_list>
 #include <__functional_base>
+#include <version>
 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
 #include <cstdint>
 #endif
diff --git a/include/string_view b/include/string_view
index 6377aeb..55dce72 100644
--- a/include/string_view
+++ b/include/string_view
@@ -178,6 +178,7 @@
 #include <iterator>
 #include <limits>
 #include <stdexcept>
+#include <version>
 #include <__debug>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h
index 68682c9..c7c6d78 100644
--- a/include/support/win32/locale_win32.h
+++ b/include/support/win32/locale_win32.h
@@ -35,8 +35,8 @@
         : __locale(nullptr), __locale_str(nullptr) {}
     locale_t(std::nullptr_t)
         : __locale(nullptr), __locale_str(nullptr) {}
-    locale_t(_locale_t __locale, const char* __locale_str)
-        : __locale(__locale), __locale_str(__locale_str) {}
+    locale_t(_locale_t __xlocale, const char* __xlocale_str)
+        : __locale(__xlocale), __locale_str(__xlocale_str) {}
 
     friend bool operator==(const locale_t& __left, const locale_t& __right) {
         return __left.__locale == __right.__locale;
diff --git a/include/tuple b/include/tuple
index b3a17e7..fb5428e 100644
--- a/include/tuple
+++ b/include/tuple
@@ -141,6 +141,7 @@
 #include <type_traits>
 #include <__functional_base>
 #include <utility>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
diff --git a/include/type_traits b/include/type_traits
index e413d26..7ff67bf 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -404,6 +404,7 @@
 */
 #include <__config>
 #include <cstddef>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -4758,7 +4759,6 @@
 
 #if _LIBCPP_STD_VER > 14
 
-#define __cpp_lib_void_t 201411
 template <class...> using void_t = void;
 
 # ifndef _LIBCPP_HAS_NO_VARIADICS
diff --git a/include/unordered_map b/include/unordered_map
index 348f579..fc3cfb6 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -386,6 +386,7 @@
 #include <functional>
 #include <stdexcept>
 #include <tuple>
+#include <version>
 
 #include <__debug>
 
diff --git a/include/unordered_set b/include/unordered_set
index 9b8560d..a219fa6 100644
--- a/include/unordered_set
+++ b/include/unordered_set
@@ -338,6 +338,7 @@
 #include <__hash_table>
 #include <__node_handle>
 #include <functional>
+#include <version>
 
 #include <__debug>
 
diff --git a/include/utility b/include/utility
index ed9bf03..5388585 100644
--- a/include/utility
+++ b/include/utility
@@ -203,6 +203,7 @@
 #include <cstddef>
 #include <cstring>
 #include <cstdint>
+#include <version>
 #include <__debug>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -1453,7 +1454,7 @@
     size_t operator()(float __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-       if (__v == 0)
+       if (__v == 0.0)
            return 0;
         return __scalar_hash<float>::operator()(__v);
     }
@@ -1467,7 +1468,7 @@
     size_t operator()(double __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-       if (__v == 0)
+       if (__v == 0.0)
            return 0;
         return __scalar_hash<double>::operator()(__v);
     }
@@ -1481,7 +1482,7 @@
     size_t operator()(long double __v) const _NOEXCEPT
     {
         // -0.0 and 0.0 should return same hash
-        if (__v == 0)
+        if (__v == 0.0)
             return 0;
 #if defined(__i386__)
         // Zero out padding bits
diff --git a/include/variant b/include/variant
index f9098f4..f9505bf 100644
--- a/include/variant
+++ b/include/variant
@@ -208,6 +208,7 @@
 #include <type_traits>
 #include <utility>
 #include <limits>
+#include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1320,7 +1321,7 @@
 
 template <size_t _Ip, class _Vp>
 inline _LIBCPP_INLINE_VISIBILITY
-static constexpr auto&& __generic_get(_Vp&& __v) {
+constexpr auto&& __generic_get(_Vp&& __v) {
   using __variant_detail::__access::__variant;
   if (!__holds_alternative<_Ip>(__v)) {
     __throw_bad_variant_access();
@@ -1437,6 +1438,16 @@
   return _VSTD::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
 }
 
+template <class _Operator>
+struct __convert_to_bool {
+  template <class _T1, class _T2>
+  _LIBCPP_INLINE_VISIBILITY constexpr bool operator()(_T1 && __t1, _T2&& __t2) const {
+    static_assert(std::is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value,
+        "the relational operator does not return a type which is implicitly convertible to bool");
+    return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
+  }
+};
+
 template <class... _Types>
 inline _LIBCPP_INLINE_VISIBILITY
 constexpr bool operator==(const variant<_Types...>& __lhs,
@@ -1444,7 +1455,7 @@
   using __variant_detail::__visitation::__variant;
   if (__lhs.index() != __rhs.index()) return false;
   if (__lhs.valueless_by_exception()) return true;
-  return __variant::__visit_value_at(__lhs.index(), equal_to<>{}, __lhs, __rhs);
+  return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs);
 }
 
 template <class... _Types>
@@ -1455,7 +1466,7 @@
   if (__lhs.index() != __rhs.index()) return true;
   if (__lhs.valueless_by_exception()) return false;
   return __variant::__visit_value_at(
-      __lhs.index(), not_equal_to<>{}, __lhs, __rhs);
+      __lhs.index(), __convert_to_bool<not_equal_to<>>{}, __lhs, __rhs);
 }
 
 template <class... _Types>
@@ -1467,7 +1478,7 @@
   if (__lhs.valueless_by_exception()) return true;
   if (__lhs.index() < __rhs.index()) return true;
   if (__lhs.index() > __rhs.index()) return false;
-  return __variant::__visit_value_at(__lhs.index(), less<>{}, __lhs, __rhs);
+  return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<less<>>{}, __lhs, __rhs);
 }
 
 template <class... _Types>
@@ -1479,7 +1490,7 @@
   if (__rhs.valueless_by_exception()) return true;
   if (__lhs.index() > __rhs.index()) return true;
   if (__lhs.index() < __rhs.index()) return false;
-  return __variant::__visit_value_at(__lhs.index(), greater<>{}, __lhs, __rhs);
+  return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<greater<>>{}, __lhs, __rhs);
 }
 
 template <class... _Types>
@@ -1492,7 +1503,7 @@
   if (__lhs.index() < __rhs.index()) return true;
   if (__lhs.index() > __rhs.index()) return false;
   return __variant::__visit_value_at(
-      __lhs.index(), less_equal<>{}, __lhs, __rhs);
+      __lhs.index(), __convert_to_bool<less_equal<>>{}, __lhs, __rhs);
 }
 
 template <class... _Types>
@@ -1505,7 +1516,7 @@
   if (__lhs.index() > __rhs.index()) return true;
   if (__lhs.index() < __rhs.index()) return false;
   return __variant::__visit_value_at(
-      __lhs.index(), greater_equal<>{}, __lhs, __rhs);
+      __lhs.index(), __convert_to_bool<greater_equal<>>{}, __lhs, __rhs);
 }
 
 template <class _Visitor, class... _Vs>
diff --git a/include/vector b/include/vector
index 0f5006f..de7de09 100644
--- a/include/vector
+++ b/include/vector
@@ -276,6 +276,7 @@
 #include <stdexcept>
 #include <algorithm>
 #include <cstring>
+#include <version>
 #include <__split_buffer>
 #include <__functional_base>
 
@@ -540,13 +541,14 @@
                                     value_type,
                                     typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
 
-#if _LIBCPP_DEBUG_LEVEL >= 2
     _LIBCPP_INLINE_VISIBILITY
     ~vector()
     {
+        __annotate_delete();
+#if _LIBCPP_DEBUG_LEVEL >= 2
         __get_db()->__erase_c(this);
-    }
 #endif
+    }
 
     vector(const vector& __x);
     vector(const vector& __x, const allocator_type& __a);
@@ -2453,7 +2455,7 @@
     void __vdeallocate() _NOEXCEPT;
     _LIBCPP_INLINE_VISIBILITY
     static size_type __align_it(size_type __new_size) _NOEXCEPT
-        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);};
+        {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);}
     _LIBCPP_INLINE_VISIBILITY  size_type __recommend(size_type __new_size) const;
     _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
     template <class _ForwardIterator>
diff --git a/include/version b/include/version
index 23a872e..80c2797 100644
--- a/include/version
+++ b/include/version
@@ -14,6 +14,85 @@
 /*
     version synopsis
 
+    Table 35 — Standard library feature-test macros
+Macro name                                  Value   Headers
+__cpp_lib_addressof_constexpr               201603L <memory>
+__cpp_lib_allocator_traits_is_always_equal  201411L <memory> <scoped_allocator> <string> 
+                                                    <deque> <forward_list> <list> <vector>
+                                                    <map> <set> <unordered_map> <unordered_set>
+__cpp_lib_any                               201606L <any>
+__cpp_lib_apply                             201603L <tuple>
+__cpp_lib_array_constexpr                   201603L <iterator> <array>
+__cpp_lib_as_const                          201510L <utility>
+__cpp_lib_atomic_is_always_lock_free        201603L <atomic>
+__cpp_lib_atomic_ref                        201806L <atomic>
+__cpp_lib_bit_cast                          201806L <bit>
+__cpp_lib_bool_constant                     201505L <type_traits>
+__cpp_lib_boyer_moore_searcher              201603L <functional>
+__cpp_lib_byte                              201603L <cstddef>
+__cpp_lib_chrono                            201611L <chrono>
+__cpp_lib_clamp                             201603L <algorithm>
+__cpp_lib_complex_udls                      201309L <complex>
+__cpp_lib_concepts                          201806L <concepts>
+__cpp_lib_constexpr_swap_algorithms         201806L <algorithm>
+__cpp_lib_enable_shared_from_this           201603L <memory>
+__cpp_lib_exchange_function                 201304L <utility>
+__cpp_lib_execution                         201603L <execution>
+__cpp_lib_filesystem                        201703L <filesystem>
+__cpp_lib_gcd_lcm                           201606L <numeric>
+__cpp_lib_generic_associative_lookup        201304L <map> <set>
+__cpp_lib_hardware_interference_size        201703L <new>
+__cpp_lib_has_unique_object_representations 201606L <type_traits>
+__cpp_lib_hypot                             201603L <cmath>
+__cpp_lib_incomplete_container_elements     201505L <forward_list> <list> <vector>
+__cpp_lib_integer_sequence                  201304L <utility>
+__cpp_lib_integral_constant_callable        201304L <type_traits>
+__cpp_lib_invoke                            201411L <functional>
+__cpp_lib_is_aggregate                      201703L <type_traits>
+__cpp_lib_is_final                          201402L <type_traits>
+__cpp_lib_is_invocable                      201703L <type_traits>
+__cpp_lib_is_null_pointer                   201309L <type_traits>
+__cpp_lib_is_swappable                      201603L <type_traits>
+__cpp_lib_launder                           201606L <new>
+__cpp_lib_list_remove_return_type           201806L <forward_list> <list>
+__cpp_lib_logical_traits                    201510L <type_traits>
+__cpp_lib_make_from_tuple                   201606L <tuple>
+__cpp_lib_make_reverse_iterator             201402L <iterator>
+__cpp_lib_make_unique                       201304L <memory>
+__cpp_lib_map_try_emplace                   201411L <map>
+__cpp_lib_math_special_functions            201603L <cmath>
+__cpp_lib_memory_resource                   201603L <memory_resource>
+__cpp_lib_node_extract                      201606L <map> <set> <unordered_map> <unordered_set>
+__cpp_lib_nonmember_container_access        201411L <iterator> <array> <deque> <forward_list>
+                                                    <list> <map> <regex> <set> <string>
+                                                    <unordered_map> <unordered_set> <vector>
+__cpp_lib_not_fn                            201603L <functional>
+__cpp_lib_null_iterators                    201304L <iterator>
+__cpp_lib_optional                          201606L <optional>
+__cpp_lib_parallel_algorithm                201603L <algorithm> <numeric>
+__cpp_lib_quoted_string_io                  201304L <iomanip>
+__cpp_lib_raw_memory_algorithms             201606L <memory>
+__cpp_lib_result_of_sfinae                  201210L <functional> <type_traits>
+__cpp_lib_robust_nonmodifying_seq_ops       201304L <algorithm>
+__cpp_lib_sample                            201603L <algorithm>
+__cpp_lib_scoped_lock                       201703L <mutex>
+__cpp_lib_shared_mutex                      201505L <shared_mutex>
+__cpp_lib_shared_ptr_arrays                 201611L <memory>
+__cpp_lib_shared_ptr_weak_type              201606L <memory>
+__cpp_lib_shared_timed_mutex                201402L <shared_mutex>
+__cpp_lib_string_udls                       201304L <string>
+__cpp_lib_string_view                       201606L <string> <string_view>
+__cpp_lib_to_chars                          201611L <utility>
+__cpp_lib_transformation_trait_aliases      201304L <type_traits>
+__cpp_lib_transparent_operators             201510L <memory> <functional>
+__cpp_lib_tuple_element_t                   201402L <tuple>
+__cpp_lib_tuples_by_type                    201304L <utility> <tuple>
+__cpp_lib_type_trait_variable_templates     201510L <type_traits>
+__cpp_lib_uncaught_exceptions               201411L <exception>
+__cpp_lib_unordered_map_try_emplace         201411L <unordered_map>
+__cpp_lib_variant                           201606L <variant>
+__cpp_lib_void_t                            201411L <type_traits>
+
 */
 
 #include <__config>
@@ -22,4 +101,17 @@
 #pragma GCC system_header
 #endif
 
+#if _LIBCPP_STD_VER > 11
+#endif
+
+#if _LIBCPP_STD_VER > 14
+# define __cpp_lib_atomic_is_always_lock_free           201603L
+# define __cpp_lib_filesystem                           201703L
+# define __cpp_lib_invoke                               201411L
+# define __cpp_lib_void_t                               201411L
+#endif
+
+#if _LIBCPP_STD_VER > 17
+#endif
+
 #endif  // _LIBCPP_VERSIONH
diff --git a/lib/abi/CHANGELOG.TXT b/lib/abi/CHANGELOG.TXT
index c123733..4c9a597 100644
--- a/lib/abi/CHANGELOG.TXT
+++ b/lib/abi/CHANGELOG.TXT
@@ -16,6 +16,21 @@
 Version 7.0
 -----------
 
+* r338479 - Elementary string conversions for integral types
+
+  The change emits __u64toa and __u32toa under std::__1::__itoa.
+
+  x86_64-linux-gnu
+  ----------------
+  Symbol added: _ZNSt3__16__itoa8__u64toaEmPc
+  Symbol added: _ZNSt3__16__itoa8__u32toaEjPc
+
+  x86_64-apple-darwin16.0
+  -----------------------
+  Symbol added: __ZNSt3__16__itoa8__u64toaEyPc
+  Symbol added: __ZNSt3__16__itoa8__u32toaEjPc
+
+
 * r333467 - Fix embarrasing typo in uncaught_exceptions.
 
   This bug caused __uncaught_exception to be ODR used instead of
diff --git a/lib/abi/CMakeLists.txt b/lib/abi/CMakeLists.txt
index e42e961..bb9217f 100644
--- a/lib/abi/CMakeLists.txt
+++ b/lib/abi/CMakeLists.txt
@@ -1,9 +1,16 @@
 
 if (DEFINED TARGET_TRIPLE)
-    # Ignore the major, minor, and patchlevel versions of the darwin
-    # target.
-    string(REGEX REPLACE "darwin([0-9]+)\\.([0-9]+)\\.([0-9]+)" "darwin"
-      GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
+    if (TARGET_TRIPLE MATCHES "darwin")
+        # Ignore the major, minor, and patchlevel versions of darwin targets.
+        string(REGEX REPLACE "darwin[0-9]+\\.[0-9]+\\.[0-9]+" "darwin"
+               GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
+    elseif(TARGET_TRIPLE MATCHES "freebsd")
+        # Ignore the major and minor versions of freebsd targets.
+        string(REGEX REPLACE "freebsd[0-9]+\\.[0-9]+" "freebsd"
+               GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
+    else()
+        set(GENERIC_TARGET_TRIPLE "${TARGET_TRIPLE}")
+    endif()
 endif()
 
 # Detect if we are building in the same configuration used to generate
diff --git a/lib/abi/x86_64-apple-darwin.v1.abilist b/lib/abi/x86_64-apple-darwin.v1.abilist
index 1be950f..6d01161 100644
--- a/lib/abi/x86_64-apple-darwin.v1.abilist
+++ b/lib/abi/x86_64-apple-darwin.v1.abilist
@@ -1282,6 +1282,8 @@
 {'type': 'OBJECT', 'is_defined': True, 'name': '__ZNSt3__15wcerrE', 'size': 0}
 {'type': 'OBJECT', 'is_defined': True, 'name': '__ZNSt3__15wclogE', 'size': 0}
 {'type': 'OBJECT', 'is_defined': True, 'name': '__ZNSt3__15wcoutE', 'size': 0}
+{'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__16__itoa8__u32toaEjPc'}
+{'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__16__itoa8__u64toaEyPc'}
 {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__16__sortIRNS_6__lessIaaEEPaEEvT0_S5_T_'}
 {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__16__sortIRNS_6__lessIccEEPcEEvT0_S5_T_'}
 {'type': 'FUNC', 'is_defined': True, 'name': '__ZNSt3__16__sortIRNS_6__lessIddEEPdEEvT0_S5_T_'}
diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp
index 65a4b31..c9396b5 100644
--- a/src/filesystem/operations.cpp
+++ b/src/filesystem/operations.cpp
@@ -352,7 +352,6 @@
 
   ~FileDescriptor() { close(); }
 
-  FileDescriptor() = default;
   FileDescriptor(FileDescriptor const&) = delete;
   FileDescriptor& operator=(FileDescriptor const&) = delete;
 
diff --git a/src/future.cpp b/src/future.cpp
index 07e4602..cbcd2e7 100644
--- a/src/future.cpp
+++ b/src/future.cpp
@@ -179,10 +179,7 @@
 future<void>::future(__assoc_sub_state* __state)
     : __state_(__state)
 {
-    if (__state_->__has_future_attached())
-        __throw_future_error(future_errc::future_already_retrieved);
-    __state_->__add_shared();
-    __state_->__set_future_attached();
+    __state_->__attach_future();
 }
 
 future<void>::~future()
diff --git a/src/new.cpp b/src/new.cpp
index 8013d89..35f481d 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -135,8 +135,7 @@
 void
 operator delete(void* ptr) _NOEXCEPT
 {
-    if (ptr)
-        ::free(ptr);
+    ::free(ptr);
 }
 
 _LIBCPP_WEAK
@@ -257,11 +256,10 @@
 void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
-    if (ptr)
 #if defined(_LIBCPP_MSVCRT_LIKE)
-        ::_aligned_free(ptr);
+    ::_aligned_free(ptr);
 #else
-        ::free(ptr);
+    ::free(ptr);
 #endif
 }
 
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index 28a9281..58ce689 100644
--- a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// <memory>
+// <algorithm>
 
 // template <class RandomAccessIterator>
 //     void
@@ -23,6 +23,8 @@
 //  However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
 //  is defined before including <algorithm>, then random_shuffle will be restored.
 
+// REQUIRES: verify-support
+
 // MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
 #define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
 
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
new file mode 100644
index 0000000..608f4f8
--- /dev/null
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.depr_in_cxx14.fail.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template <class RandomAccessIterator>
+//     void
+//     random_shuffle(RandomAccessIterator first, RandomAccessIterator last);
+//
+// template <class RandomAccessIterator, class RandomNumberGenerator>
+//     void
+//     random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
+//                    RandomNumberGenerator& rand);
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+
+#include <algorithm>
+#include <cstddef>
+
+#include "test_macros.h"
+
+struct gen
+{
+    std::ptrdiff_t operator()(std::ptrdiff_t n)
+    {
+        return n-1;
+    }
+};
+
+
+int main()
+{
+    int v[1] = {1};
+    std::random_shuffle(&v[0], &v[1]); // expected-error{{'random_shuffle<int *>' is deprecated}}
+    gen r;
+    std::random_shuffle(&v[0], &v[1], r); // expected-error{{'random_shuffle<int *, gen &>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..3ad9ae8
--- /dev/null
+++ b/test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.depr_in_cxx11.fail.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+//
+// template <class X>
+// class auto_ptr;
+//
+// class auto_ptr<void>;
+//
+// template <class X>
+// class auto_ptr_ref;
+//
+// Deprecated in C++11
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+
+#include <memory>
+#include "test_macros.h"
+
+int main()
+{
+    typedef std::auto_ptr<int> AP; // expected-error{{'auto_ptr<int>' is deprecated}}
+    typedef std::auto_ptr<void> APV; // expected-error{{'auto_ptr<void>' is deprecated}}
+    typedef std::auto_ptr_ref<int> APR; // expected-error{{'auto_ptr_ref<int>' is deprecated}}
+}
diff --git a/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..88c1e21
--- /dev/null
+++ b/test/libcxx/depr/depr.function.objects/adaptors.depr_in_cxx11.fail.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+#include <cassert>
+#include "test_macros.h"
+
+int identity(int v) { return v; }
+int sum(int a, int b) { return a + b; }
+
+struct Foo {
+    int const_zero() const { return 0; }
+    int const_identity(int v) const { return v; }
+    int zero() { return 0; }
+    int identity(int v) { return v; }
+};
+
+int main()
+{
+    typedef std::pointer_to_unary_function<int, int> PUF; // expected-error{{'pointer_to_unary_function<int, int>' is deprecated}}
+    typedef std::pointer_to_binary_function<int, int, int> PBF; // expected-error{{'pointer_to_binary_function<int, int, int>' is deprecated}}
+    std::ptr_fun<int, int>(identity); // expected-error{{'ptr_fun<int, int>' is deprecated}}
+    std::ptr_fun<int, int, int>(sum); // expected-error{{'ptr_fun<int, int, int>' is deprecated}}
+
+    typedef std::mem_fun_t<int, Foo> MFT0; // expected-error{{'mem_fun_t<int, Foo>' is deprecated}}
+    typedef std::mem_fun1_t<int, Foo, int> MFT1; // expected-error{{'mem_fun1_t<int, Foo, int>' is deprecated}}
+    typedef std::const_mem_fun_t<int, Foo> CMFT0; // expected-error{{'const_mem_fun_t<int, Foo>' is deprecated}}
+    typedef std::const_mem_fun1_t<int, Foo, int> CMFT1; // expected-error{{'const_mem_fun1_t<int, Foo, int>' is deprecated}}
+    std::mem_fun<int, Foo>(&Foo::zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+    std::mem_fun<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+    std::mem_fun<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun<int, Foo>' is deprecated}}
+    std::mem_fun<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun<int, Foo, int>' is deprecated}}
+
+    typedef std::mem_fun_ref_t<int, Foo> MFR0; // expected-error{{'mem_fun_ref_t<int, Foo>' is deprecated}}
+    typedef std::mem_fun1_ref_t<int, Foo, int> MFR1; // expected-error{{'mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+    typedef std::const_mem_fun_ref_t<int, Foo> CMFR0; // expected-error{{'const_mem_fun_ref_t<int, Foo>' is deprecated}}
+    typedef std::const_mem_fun1_ref_t<int, Foo, int> CMFR1; // expected-error{{'const_mem_fun1_ref_t<int, Foo, int>' is deprecated}}
+    std::mem_fun_ref<int, Foo>(&Foo::zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+    std::mem_fun_ref<int, Foo, int>(&Foo::identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+    std::mem_fun_ref<int, Foo>(&Foo::const_zero); // expected-error{{'mem_fun_ref<int, Foo>' is deprecated}}
+    std::mem_fun_ref<int, Foo, int>(&Foo::const_identity); // expected-error{{'mem_fun_ref<int, Foo, int>' is deprecated}}
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
new file mode 100644
index 0000000..e1ef176
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_NODISCARD_EXT and _LIBCPP_NODISCARD_AFTER_CXX17 are defined
+// to the appropriate warning-generating attribute when _LIBCPP_ENABLE_NODISCARD
+// is explicitly provided.
+
+// UNSUPPORTED: c++98, c++03
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <__config>
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+  foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+  bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+  (void)foo(); // OK. void casts disable the diagnostic.
+  (void)bar();
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
new file mode 100644
index 0000000..2c7d899
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+// Test that _LIBCPP_DISABLE_NODISCARD_EXT only disables _LIBCPP_NODISCARD_EXT
+// and not _LIBCPP_NODISCARD_AFTER_CXX17.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+  foo(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+  bar(); // OK.
+  (void)foo(); // OK.
+}
diff --git a/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
new file mode 100644
index 0000000..c7d080d
--- /dev/null
+++ b/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.fail.cpp
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// GCC 7 is the first version to introduce [[nodiscard]]
+// UNSUPPORTED: gcc-4.9, gcc-5, gcc-6
+
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_EXT
+#define _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_DISABLE_NODISCARD_EXT
+#include <__config>
+
+
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
+_LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; }
+
+int main() {
+  bar(); // expected-error-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+  foo(); // OK.
+  (void)bar(); // OK.
+}
diff --git a/test/libcxx/diagnostics/nodiscard.pass.cpp b/test/libcxx/diagnostics/nodiscard.pass.cpp
index d308248..de920d4 100644
--- a/test/libcxx/diagnostics/nodiscard.pass.cpp
+++ b/test/libcxx/diagnostics/nodiscard.pass.cpp
@@ -8,18 +8,13 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Test that _LIBCPP_NODISCARD_AFTER_CXX17 works
-//	#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
+// Test that _LIBCPP_NODISCARD_EXT is not defined to [[nodiscard]] unless
+// explicitly enabled by _LIBCPP_ENABLE_NODISCARD
 
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-
-// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
-#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
 #include <__config>
 
-_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
+_LIBCPP_NODISCARD_EXT int foo() { return 42; }
 
-int main ()
-{
-	foo();	// no error here!
+int main() {
+  foo(); // OK.
 }
diff --git a/test/libcxx/diagnostics/nodiscard.fail.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
similarity index 89%
rename from test/libcxx/diagnostics/nodiscard.fail.cpp
rename to test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
index 903a24a..47e560f 100644
--- a/test/libcxx/diagnostics/nodiscard.fail.cpp
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.fail.cpp
@@ -12,7 +12,6 @@
 //	#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
 #include <__config>
 
diff --git a/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
new file mode 100644
index 0000000..4db8181
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_aftercxx17.pass.cpp
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that _LIBCPP_NODISCARD_AFTER_CXX17 is disabled whenever
+// _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17 is defined by the user.
+
+// MODULES_DEFINES: _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#define _LIBCPP_DISABLE_NODISCARD_AFTER_CXX17
+#include <__config>
+
+_LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
+
+int main ()
+{
+	foo();	// no error here!
+}
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
new file mode 100644
index 0000000..d1e0a8a
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.fail.cpp
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// GCC versions prior to 7.0 don't provide the required [[nodiscard]] attribute.
+// UNSUPPORTED: gcc-4, gcc-5, gcc-6
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.pass.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
+#define _LIBCPP_ENABLE_NODISCARD
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+  {
+    // expected-error-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}}
+    std::get_temporary_buffer<int>(1);
+  }
+}
diff --git a/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
new file mode 100644
index 0000000..9a09a43
--- /dev/null
+++ b/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that entities declared [[nodiscard]] as at extension by libc++, are
+// only actually declared such when _LIBCPP_ENABLE_NODISCARD is specified.
+
+// This test intentionally leaks memory, so it is unsupported under ASAN.
+// UNSUPPORTED: asan
+
+// All entities to which libc++ applies [[nodiscard]] as an extension should
+// be tested here and in nodiscard_extensions.fail.cpp. They should also
+// be listed in `UsingLibcxx.rst` in the documentation for the extension.
+
+#include <memory>
+
+#include "test_macros.h"
+
+int main() {
+  {
+    std::get_temporary_buffer<int>(1); // intentional memory leak.
+  }
+}
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index 8d08db4..9ad8df4 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/test/libcxx/double_include.sh.cpp
@@ -27,6 +27,7 @@
 #ifndef _LIBCPP_HAS_NO_THREADS
 #include <atomic>
 #endif
+#include <bit>
 #include <bitset>
 #include <cassert>
 #include <ccomplex>
diff --git a/test/libcxx/language.support/has_c11_features.pass.cpp b/test/libcxx/language.support/has_c11_features.pass.cpp
index cdccc00..4edec53 100644
--- a/test/libcxx/language.support/has_c11_features.pass.cpp
+++ b/test/libcxx/language.support/has_c11_features.pass.cpp
@@ -14,6 +14,9 @@
 //		_LIBCPP_HAS_C11_FEATURES - which is defined in <__config>
 //	They should always be the same
 
+#include <__config>
+#include "test_macros.h"
+
 #ifdef TEST_HAS_C11_FEATURES
 # ifndef _LIBCPP_HAS_C11_FEATURES
 #  error "TEST_HAS_C11_FEATURES is defined, but _LIBCPP_HAS_C11_FEATURES is not"
diff --git a/test/libcxx/memory/aligned_allocation_macro.pass.cpp b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
new file mode 100644
index 0000000..0e13b15
--- /dev/null
+++ b/test/libcxx/memory/aligned_allocation_macro.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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, c++11, c++14
+
+// aligned allocation functions are not provided prior to macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
+
+#include <new>
+
+
+#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#   error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it"
+#endif
+
+int main() { }
diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
index 6024d99..bd015fe 100644
--- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -24,7 +24,13 @@
 std::mutex m;
 int foo __attribute__((guarded_by(m)));
 
+static void scoped() {
+  std::scoped_lock<std::mutex> lock(m);
+  foo++;
+}
+
 int main() {
+  scoped();
   std::lock_guard<std::mutex> lock(m);
   foo++;
 }
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp b/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp
new file mode 100644
index 0000000..a1069de
--- /dev/null
+++ b/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <algorithm>
+
+// template<ForwardIterator Iter>
+//   max_element(Iter first, Iter last);
+
+#include <algorithm>
+#include <cassert>
+
+#include "test_iterators.h"
+
+int main() {
+  int arr[] = {1, 2, 3};
+  const int *b = std::begin(arr), *e = std::end(arr);
+  typedef input_iterator<const int*> Iter;
+  {
+    // expected-error@algorithm:* {{"std::min_element requires a ForwardIterator"}}
+    std::min_element(Iter(b), Iter(e));
+  }
+  {
+    // expected-error@algorithm:* {{"std::max_element requires a ForwardIterator"}}
+    std::max_element(Iter(b), Iter(e));
+  }
+  {
+    // expected-error@algorithm:* {{"std::minmax_element requires a ForwardIterator"}}
+    std::minmax_element(Iter(b), Iter(e));
+  }
+
+}
diff --git a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
index 1f36a6f..ab4642f 100644
--- a/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/map/map.modifiers/clear.pass.cpp
@@ -11,11 +11,12 @@
 
 // class map
 
-// void clear();
+// void clear() noexcept;
 
 #include <map>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
@@ -56,6 +58,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
diff --git a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index 321f4d0..546a406 100644
--- a/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -11,11 +11,12 @@
 
 // class multimap
 
-// void clear();
+// void clear() noexcept;
 
 #include <map>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
@@ -56,6 +58,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
diff --git a/test/std/containers/associative/multiset/clear.pass.cpp b/test/std/containers/associative/multiset/clear.pass.cpp
index f762ef7..59ee02e 100644
--- a/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/test/std/containers/associative/multiset/clear.pass.cpp
@@ -11,11 +11,12 @@
 
 // class multiset
 
-// void clear();
+// void clear() noexcept;
 
 #include <set>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
@@ -56,6 +58,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
diff --git a/test/std/containers/associative/set/clear.pass.cpp b/test/std/containers/associative/set/clear.pass.cpp
index 7a5bf4b..1be3ed2 100644
--- a/test/std/containers/associative/set/clear.pass.cpp
+++ b/test/std/containers/associative/set/clear.pass.cpp
@@ -11,11 +11,12 @@
 
 // class set
 
-// void clear();
+// void clear() noexcept;
 
 #include <set>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
@@ -56,6 +58,7 @@
         };
         M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
         assert(m.size() == 8);
+        ASSERT_NOEXCEPT(m.clear());
         m.clear();
         assert(m.size() == 0);
     }
diff --git a/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
new file mode 100644
index 0000000..943b6e8
--- /dev/null
+++ b/test/std/containers/sequences/deque/deque.modifiers/clear.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// void clear() noexcept;
+
+#include <deque>
+#include <cassert>
+
+#include "test_macros.h"
+#include "../../../NotConstructible.h"
+#include "min_allocator.h"
+
+int main()
+{
+    {
+        typedef NotConstructible T;
+        typedef std::deque<T> C;
+        C c;
+        ASSERT_NOEXCEPT(c.clear());
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::deque<T> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        ASSERT_NOEXCEPT(c.clear());
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#if TEST_STD_VER >= 11
+    {
+        typedef NotConstructible T;
+        typedef std::deque<T, min_allocator<T>> C;
+        C c;
+        ASSERT_NOEXCEPT(c.clear());
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+    {
+        typedef int T;
+        typedef std::deque<T, min_allocator<T>> C;
+        const T t[] = {0, 1, 2, 3, 4};
+        C c(std::begin(t), std::end(t));
+
+        ASSERT_NOEXCEPT(c.clear());
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+
+        c.clear();
+        assert(distance(c.begin(), c.end()) == 0);
+    }
+#endif
+}
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
index def032c..f323ca4 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter.pass.cpp
@@ -18,6 +18,23 @@
 #include <cstddef>
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+    Throws() : v_(0) {}
+    Throws(int v) : v_(v) {}
+    Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws(      Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+    Throws& operator=(      Throws &&rhs) { v_ = rhs.v_; return *this; }
+    int v_;
+
+    static bool sThrows;
+    };
+         
+bool Throws::sThrows = false;
+#endif
 
 template <class C>
 C
@@ -90,4 +107,19 @@
             testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
     }
 #endif
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of T.
+// (which includes move assignment)
+    {
+    Throws arr[] = {1, 2, 3};
+    std::deque<Throws> v(arr, arr+3);
+    Throws::sThrows = true;
+    v.erase(v.begin());
+    v.erase(--v.end());
+    v.erase(v.begin());
+    assert(v.size() == 0);
+    }
+#endif
 }
diff --git a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
index 338c66d..391a0f7 100644
--- a/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
+++ b/test/std/containers/sequences/deque/deque.modifiers/erase_iter_iter.pass.cpp
@@ -20,6 +20,24 @@
 #include <cstddef>
 
 #include "min_allocator.h"
+#include "test_macros.h"
+
+#ifndef TEST_HAS_NO_EXCEPTIONS
+struct Throws {
+    Throws() : v_(0) {}
+    Throws(int v) : v_(v) {}
+    Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws(      Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+    Throws& operator=(      Throws &&rhs) { v_ = rhs.v_; return *this; }
+    int v_;
+
+    static bool sThrows;
+    };
+         
+bool Throws::sThrows = false;
+#endif
+
 
 template <class C>
 C
@@ -96,4 +114,18 @@
             testN<std::deque<int, min_allocator<int>> >(rng[i], rng[j]);
     }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
+// Test for LWG2953:
+// Throws: Nothing unless an exception is thrown by the assignment operator of T.
+// (which includes move assignment)
+    {
+    Throws arr[] = {1, 2, 3};
+    std::deque<Throws> v(arr, arr+3);
+    Throws::sThrows = true;
+    v.erase(v.begin(), --v.end());
+    assert(v.size() == 1);
+    v.erase(v.begin(), v.end());
+    assert(v.size() == 0);
+    }
+#endif
 }
diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
index 0e625ac..6cdf8d5 100644
--- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
 
 // <forward_list>
 
-// void clear();
+// void clear() noexcept;
 
 #include <forward_list>
 #include <cassert>
 
+#include "test_macros.h"
 #include "../../../NotConstructible.h"
 #include "min_allocator.h"
 
@@ -23,6 +24,7 @@
         typedef NotConstructible T;
         typedef std::forward_list<T> C;
         C c;
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(distance(c.begin(), c.end()) == 0);
     }
@@ -32,6 +34,7 @@
         const T t[] = {0, 1, 2, 3, 4};
         C c(std::begin(t), std::end(t));
 
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(distance(c.begin(), c.end()) == 0);
 
@@ -43,6 +46,7 @@
         typedef NotConstructible T;
         typedef std::forward_list<T, min_allocator<T>> C;
         C c;
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(distance(c.begin(), c.end()) == 0);
     }
@@ -52,6 +56,7 @@
         const T t[] = {0, 1, 2, 3, 4};
         C c(std::begin(t), std::end(t));
 
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(distance(c.begin(), c.end()) == 0);
 
diff --git a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
index 5d8c41f..1d7cb80 100644
--- a/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/list/list.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
 
 // <list>
 
-// void clear();
+// void clear() noexcept;
 
 #include <list>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -21,6 +22,7 @@
     {
     int a[] = {1, 2, 3};
     std::list<int> c(a, a+3);
+    ASSERT_NOEXCEPT(c.clear());
     c.clear();
     assert(c.empty());
     }
@@ -28,6 +30,7 @@
     {
     int a[] = {1, 2, 3};
     std::list<int, min_allocator<int>> c(a, a+3);
+    ASSERT_NOEXCEPT(c.clear());
     c.clear();
     assert(c.empty());
     }
diff --git a/test/std/containers/sequences/list/list.ops/merge.pass.cpp b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
index 7c12877..af4b02c 100644
--- a/test/std/containers/sequences/list/list.ops/merge.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge.pass.cpp
@@ -10,6 +10,7 @@
 // <list>
 
 // void merge(list& x);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include <list>
 #include <cassert>
@@ -26,7 +27,16 @@
     std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2);
     assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    assert(c2.empty());
     }
+
+    {
+    int a1[] = {1, 3, 7, 9, 10};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.merge(c1);
+    assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+    }
+
 #if TEST_STD_VER >= 11
     {
     int a1[] = {1, 3, 7, 9, 10};
@@ -36,6 +46,7 @@
     std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2);
     assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    assert(c2.empty());
     }
 #endif
 }
diff --git a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
index 838ff22..20ddbef 100644
--- a/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
+++ b/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
@@ -10,6 +10,7 @@
 // <list>
 
 // template <class Compare> void merge(list& x, Compare comp);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include <list>
 #include <functional>
@@ -27,7 +28,15 @@
     std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2, std::greater<int>());
     assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    assert(c2.empty());
     }
+    {
+    int a1[] = {10, 9, 7, 3, 1};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.merge(c1, std::greater<int>());
+    assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+    }
+
 #if TEST_STD_VER >= 11
     {
     int a1[] = {10, 9, 7, 3, 1};
@@ -37,6 +46,7 @@
     std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2, std::greater<int>());
     assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    assert(c2.empty());
     }
 #endif
 }
diff --git a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
index 6938aa6..330bcda 100644
--- a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp
@@ -21,7 +21,6 @@
 #include "test_allocator.h"
 #include "min_allocator.h"
 #include "asan_testing.h"
-#include "verbose_assert.h"
 
 int main()
 {
diff --git a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
index 5f053eb..5357ba4 100644
--- a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
+++ b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp
@@ -9,11 +9,12 @@
 
 // <vector>
 
-// void clear();
+// void clear() noexcept;
 
 #include <vector>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 #include "asan_testing.h"
 
@@ -22,6 +23,7 @@
     {
     int a[] = {1, 2, 3};
     std::vector<int> c(a, a+3);
+    ASSERT_NOEXCEPT(c.clear());
     c.clear();
     assert(c.empty());
     LIBCPP_ASSERT(c.__invariants());
@@ -31,6 +33,7 @@
     {
     int a[] = {1, 2, 3};
     std::vector<int, min_allocator<int>> c(a, a+3);
+    ASSERT_NOEXCEPT(c.clear());
     c.clear();
     assert(c.empty());
     LIBCPP_ASSERT(c.__invariants());
diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
index 106423e..9212a5e 100644
--- a/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.map/unord.map.modifiers/clear.pass.cpp
@@ -13,12 +13,13 @@
 //           class Alloc = allocator<pair<const Key, T>>>
 // class unordered_map
 
-// void clear()
+// void clear() noexcept;
 
 #include <unordered_map>
 #include <string>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
             P(2, "four"),
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
@@ -54,6 +56,7 @@
             P(2, "four"),
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
index 891d449..15c7820 100644
--- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/clear.pass.cpp
@@ -13,12 +13,13 @@
 //           class Alloc = allocator<pair<const Key, T>>>
 // class unordered_multimap
 
-// void clear()
+// void clear() noexcept;
 
 #include <unordered_map>
 #include <string>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -36,6 +37,7 @@
             P(2, "four"),
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
@@ -54,6 +56,7 @@
             P(2, "four"),
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
diff --git a/test/std/containers/unord/unord.multiset/clear.pass.cpp b/test/std/containers/unord/unord.multiset/clear.pass.cpp
index 57dbb8b..b699d06 100644
--- a/test/std/containers/unord/unord.multiset/clear.pass.cpp
+++ b/test/std/containers/unord/unord.multiset/clear.pass.cpp
@@ -13,11 +13,12 @@
 //           class Alloc = allocator<Value>>
 // class unordered_multiset
 
-// void clear()
+// void clear() noexcept;
 
 #include <unordered_set>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -35,6 +36,7 @@
             P(2)
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
@@ -53,6 +55,7 @@
             P(2)
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
diff --git a/test/std/containers/unord/unord.set/clear.pass.cpp b/test/std/containers/unord/unord.set/clear.pass.cpp
index 8ebf748..2f22391 100644
--- a/test/std/containers/unord/unord.set/clear.pass.cpp
+++ b/test/std/containers/unord/unord.set/clear.pass.cpp
@@ -13,11 +13,12 @@
 //           class Alloc = allocator<Value>>
 // class unordered_set
 
-// void clear()
+// void clear() noexcept;
 
 #include <unordered_set>
 #include <cassert>
 
+#include "test_macros.h"
 #include "min_allocator.h"
 
 int main()
@@ -35,6 +36,7 @@
             P(2)
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
@@ -52,6 +54,7 @@
             P(2)
         };
         C c(a, a + sizeof(a)/sizeof(a[0]));
+        ASSERT_NOEXCEPT(c.clear());
         c.clear();
         assert(c.size() == 0);
     }
diff --git a/test/std/containers/views/span.iterators/end.pass.cpp b/test/std/containers/views/span.iterators/end.pass.cpp
index 2b64b0f..7b54555 100644
--- a/test/std/containers/views/span.iterators/end.pass.cpp
+++ b/test/std/containers/views/span.iterators/end.pass.cpp
@@ -32,8 +32,11 @@
     }
     else
     {
+    	typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
         ret = ret &&  ( e !=  s.begin());
         ret = ret &&  (ce != s.cbegin());
+        ret = ret &&  (&*( e-1) == last);
+        ret = ret &&  (&*(ce-1) == last);
     }
 
     ret = ret &&  (( e -  s.begin()) == s.size());
@@ -55,8 +58,11 @@
     }
     else
     {
+    	typename Span::const_pointer last = &*(s.cbegin() + s.size() - 1);
         assert( e !=  s.begin());
         assert(ce != s.cbegin());
+        assert( &*( e-1) == last);
+        assert( &*(ce-1) == last);
     }
 
     assert(( e -  s.begin()) == s.size());
diff --git a/test/std/depr/depr.c.headers/float_h.pass.cpp b/test/std/depr/depr.c.headers/float_h.pass.cpp
index 3001c21..84e89c4 100644
--- a/test/std/depr/depr.c.headers/float_h.pass.cpp
+++ b/test/std/depr/depr.c.headers/float_h.pass.cpp
@@ -11,6 +11,8 @@
 
 #include <float.h>
 
+#include "test_macros.h"
+
 #ifndef FLT_ROUNDS
 #error FLT_ROUNDS not defined
 #endif
@@ -23,7 +25,7 @@
 #error FLT_RADIX not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_HAS_SUBNORM
 #error FLT_HAS_SUBNORM not defined
 #endif
@@ -53,7 +55,7 @@
 #error DECIMAL_DIG not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_DECIMAL_DIG
 #error FLT_DECIMAL_DIG not defined
 #endif
@@ -163,7 +165,7 @@
 #error LDBL_MIN not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_TRUE_MIN
 #error FLT_TRUE_MIN not defined
 #endif
diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..652f531
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind1st
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+    std::bind1st(test_func(1), 5); // expected-error{{'bind1st<test_func, int>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..95cf150
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// bind2nd
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+    std::bind2nd(test_func(1), 5); // expected-error{{'bind2nd<test_func, int>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..8f57eba
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder1st
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+    typedef std::binder1st<test_func> B1ST; // expected-error{{'binder1st<test_func>' is deprecated}}
+}
diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
new file mode 100644
index 0000000..c49334f
--- /dev/null
+++ b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.depr_in_cxx11.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+//
+// binder2nd
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+
+#include <functional>
+
+#include "../test_func.h"
+#include "test_macros.h"
+
+int main()
+{
+    typedef std::binder2nd<test_func> B2ND; // expected-error{{'binder2nd<test_func>' is deprecated}}
+}
diff --git a/test/std/experimental/simd/simd.access/default.pass.cpp b/test/std/experimental/simd/simd.access/default.pass.cpp
index 6ce32ca..d799675 100644
--- a/test/std/experimental/simd/simd.access/default.pass.cpp
+++ b/test/std/experimental/simd/simd.access/default.pass.cpp
@@ -165,7 +165,7 @@
     }
     {
       auto c = a;
-      (void)(a[0] + (c[0] <<= a[0]));
+      (void)(a[0] + (c[0] <<= b[0]));
     }
     {
       auto c = a;
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
index 2175e29..52aeea3 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
@@ -12,17 +12,27 @@
 // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
 
 // Older Clang versions do not support this
-// XFAIL: clang-3, apple-clang-7, apple-clang-8
+// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
 
 // None of the current GCC compilers support this.
-// XFAIL: gcc-5, gcc-6
+// UNSUPPORTED: gcc-5, gcc-6
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // On Windows libc++ doesn't provide its own definitions for new/delete
 // but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
index 942f5e7..1d20b33 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
@@ -15,13 +15,22 @@
 // FIXME change this to XFAIL.
 // UNSUPPORTED: no-aligned-allocation && !gcc
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
 
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // On Windows libc++ doesn't provide its own definitions for new/delete
 // but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
index f55ad5b..60ebdd8 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
@@ -15,12 +15,22 @@
 // FIXME turn this into an XFAIL
 // UNSUPPORTED: no-aligned-allocation && !gcc
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // On Windows libc++ doesn't provide its own definitions for new/delete
 // but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
index e1ebf86..b093164 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
@@ -10,12 +10,24 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // UNSUPPORTED: sanitizer-new-delete
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so our
+// custom aligned allocation functions are not called and the test fails
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Our custom aligned allocation functions are not called when deploying to
+// platforms older than macosx10.13, since those platforms don't support
+// aligned allocation.
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // XFAIL: no-aligned-allocation && !gcc
 
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
similarity index 74%
rename from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp
rename to test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
index 0dfef2e..40632a1 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size.sh.cpp
@@ -15,11 +15,12 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new[](4);  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new[](4);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
similarity index 73%
copy from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
copy to test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
index ea041ae..f7921d2 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.sh.cpp
@@ -15,11 +15,12 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new[](4, std::align_val_t{4});  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new[](4, std::align_val_t{4});  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
similarity index 79%
rename from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp
rename to test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
index 99e4f76..1301487 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align_nothrow.sh.cpp
@@ -15,11 +15,12 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new[](4, std::align_val_t{4}, std::nothrow);  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new[](4, std::align_val_t{4}, std::nothrow);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
similarity index 73%
rename from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp
rename to test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
index 8aae54e..43295a7 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_nothrow.sh.cpp
@@ -15,11 +15,12 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new[](4, std::nothrow);  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new[](4, std::nothrow);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
index 6f1c751..5885218 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
@@ -11,17 +11,27 @@
 
 // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14
 // Older Clang versions do not support this
-// XFAIL: clang-3, apple-clang-7, apple-clang-8
+// UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8
 
 // None of the current GCC compilers support this.
-// XFAIL: gcc-5, gcc-6
+// UNSUPPORTED: gcc-5, gcc-6
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // On Windows libc++ doesn't provide its own definitions for new/delete
 // but instead depends on the ones in VCRuntime. However VCRuntime does not
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
index fae5d36..52db4c5 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
@@ -9,12 +9,22 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // asan and msan will not call the new handler.
 // UNSUPPORTED: sanitizer-new-delete
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
index f22c489..a5e40a0 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -9,12 +9,22 @@
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so that's a link error
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Using aligned allocation functions is a compiler error when deploying to
+// platforms older than macosx10.13
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // asan and msan will not call the new handler.
 // UNSUPPORTED: sanitizer-new-delete
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
index 565ba9b..de1bd8d 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -10,12 +10,24 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14
 // UNSUPPORTED: sanitizer-new-delete
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// dylibs shipped before macosx10.13 do not provide aligned allocation, so our
+// custom aligned allocation functions are not called and the test fails
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+// UNSUPPORTED: with_system_cxx_lib=macosx10.8
+// UNSUPPORTED: with_system_cxx_lib=macosx10.7
+
+// Our custom aligned allocation functions are not called when deploying to
+// platforms older than macosx10.13, since those platforms don't support
+// aligned allocation.
+// UNSUPPORTED: macosx10.12
+// UNSUPPORTED: macosx10.11
+// UNSUPPORTED: macosx10.10
+// UNSUPPORTED: macosx10.9
+// UNSUPPORTED: macosx10.8
+// UNSUPPORTED: macosx10.7
 
 // NOTE: gcc doesn't provide -faligned-allocation flag to test for
 // XFAIL: no-aligned-allocation && !gcc
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp
deleted file mode 100644
index c3cabbd..0000000
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.fail.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-//                     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.
-//
-//===----------------------------------------------------------------------===//
-
-// <new>
-
-// void* operator new(std::size_t, std::align_val_t);
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
-
-#include <new>
-
-#include "test_macros.h"
-
-int main ()
-{
-    ::operator new(4, std::align_val_t{4});  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
-}
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
similarity index 75%
rename from test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
rename to test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
index ea041ae..410c6d7 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_size_align.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align.sh.cpp
@@ -10,16 +10,17 @@
 
 // <new>
 
-// void* operator new[](std::size_t, std::align_val_t);
+// void* operator new(std::size_t, std::align_val_t);
 
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new[](4, std::align_val_t{4});  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new(4, std::align_val_t{4});  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
similarity index 79%
rename from test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp
rename to test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
index e987a53..1fe1045 100644
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.fail.cpp
+++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_size_align_nothrow.sh.cpp
@@ -15,11 +15,12 @@
 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
 // UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
 
-#include <new>
+// REQUIRES: -faligned-allocation
+// RUN: %compile %verify -faligned-allocation
 
-#include "test_macros.h"
+#include <new>
 
 int main ()
 {
-    ::operator new(4, std::align_val_t{4}, std::nothrow);  // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+    ::operator new(4, std::align_val_t{4}, std::nothrow);  // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
 }
diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
index d030d12..859d831 100644
--- a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
+++ b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
@@ -10,11 +10,11 @@
 // UNSUPPORTED: libcpp-no-exceptions
 // XFAIL: libcpp-no-exceptions
 
-// XFAIL: availability=macosx10.7
-// XFAIL: availability=macosx10.8
-// XFAIL: availability=macosx10.9
-// XFAIL: availability=macosx10.10
-// XFAIL: availability=macosx10.11
+// XFAIL: macosx10.7
+// XFAIL: macosx10.8
+// XFAIL: macosx10.9
+// XFAIL: macosx10.10
+// XFAIL: macosx10.11
 // XFAIL: with_system_cxx_lib=macosx10.12
 // XFAIL: with_system_cxx_lib=macosx10.13
 
diff --git a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
index 6e399d0..c1e5be9 100644
--- a/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
+++ b/test/std/language.support/support.limits/c.limits/cfloat.pass.cpp
@@ -11,6 +11,8 @@
 
 #include <cfloat>
 
+#include "test_macros.h"
+
 #ifndef FLT_ROUNDS
 #error FLT_ROUNDS not defined
 #endif
@@ -23,7 +25,7 @@
 #error FLT_RADIX not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_HAS_SUBNORM
 #error FLT_HAS_SUBNORM not defined
 #endif
@@ -53,7 +55,7 @@
 #error DECIMAL_DIG not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_DECIMAL_DIG
 #error FLT_DECIMAL_DIG not defined
 #endif
@@ -163,7 +165,7 @@
 #error LDBL_MIN not defined
 #endif
 
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) && 0
 #ifndef FLT_TRUE_MIN
 #error FLT_TRUE_MIN not defined
 #endif
diff --git a/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
new file mode 100644
index 0000000..37a636f
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/algorithm.version.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <algorithm> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_clamp                             201603L
+    __cpp_lib_constexpr_swap_algorithms         201806L
+    __cpp_lib_parallel_algorithm                201603L
+    __cpp_lib_robust_nonmodifying_seq_ops       201304L
+    __cpp_lib_sample                            201603L
+
+*/
+
+#include <algorithm>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <algorithm> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
new file mode 100644
index 0000000..951afbc
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/any.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <any> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_any                               201606L
+
+*/
+
+#include <any>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <any> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
new file mode 100644
index 0000000..548abe6
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/array.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <array> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_array_constexpr                   201603L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <array>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <array> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
new file mode 100644
index 0000000..0c15dc5
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/atomic.version.pass.cpp
@@ -0,0 +1,43 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <atomic> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_atomic_is_always_lock_free        201603L
+    __cpp_lib_atomic_ref                        201806L
+
+*/
+
+// UNSUPPORTED: libcpp-has-no-threads
+
+#include <atomic>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <atomic> are defined.
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_atomic_is_always_lock_free)
+#  error "__cpp_lib_atomic_is_always_lock_free is not defined"
+# elif __cpp_lib_atomic_is_always_lock_free < 201603L
+#  error "__cpp_lib_atomic_is_always_lock_free has an invalid value"
+# endif
+#endif
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
new file mode 100644
index 0000000..2dfe4a8
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <bit> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_bit_cast                          201806L
+
+*/
+
+#include <bit>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <bit> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
new file mode 100644
index 0000000..5d1755b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/chrono.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <chrono> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_chrono                            201611L
+
+*/
+
+#include <chrono>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <chrono> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
new file mode 100644
index 0000000..e8479d1
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/cmath.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <cmath> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_hypot                             201603L
+    __cpp_lib_math_special_functions            201603L
+
+*/
+
+#include <cmath>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <cmath> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
new file mode 100644
index 0000000..dd64efb
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/complex.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <complex> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_complex_udls                      201309L
+
+*/
+
+#include <complex>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <complex> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
new file mode 100644
index 0000000..06f2448
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <concepts> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_concepts                          201806L
+
+*/
+
+// XFAIL
+// #include <concepts>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <concepts> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
new file mode 100644
index 0000000..ac8dfbb
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/cstddef.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <cstddef> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_byte                              201603L
+
+*/
+
+#include <cstddef>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <cstddef> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
new file mode 100644
index 0000000..faa9063
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/deque.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <deque> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <deque>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <deque> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
new file mode 100644
index 0000000..a77ce5f
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/exception.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <exception> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_uncaught_exceptions               201411L
+
+*/
+
+#include <exception>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <exception> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp
new file mode 100644
index 0000000..4cc6307
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/execution.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+// 
+// <execution> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_execution                         201603L
+
+*/
+
+// XFAIL
+// #include <execution>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <execution> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
new file mode 100644
index 0000000..46ad17d
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
@@ -0,0 +1,40 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <filesystem> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_filesystem                        201703L
+
+*/
+
+#include <filesystem>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <filesystem> are defined.
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_filesystem)
+#  error "__cpp_lib_filesystem is not defined"
+# elif __cpp_lib_filesystem < 201703L
+#  error "__cpp_lib_filesystem has an invalid value"
+# endif
+#endif
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
new file mode 100644
index 0000000..b262d70
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/forward_list.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <forward_list> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_incomplete_container_elements     201505L
+    __cpp_lib_list_remove_return_type           201806L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <forward_list>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <forward_list> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
new file mode 100644
index 0000000..a24de49
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/functional.version.pass.cpp
@@ -0,0 +1,44 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <functional> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_boyer_moore_searcher              201603L
+    __cpp_lib_invoke                            201411L
+    __cpp_lib_not_fn                            201603L
+    __cpp_lib_result_of_sfinae                  201210L
+    __cpp_lib_transparent_operators             201510L
+
+*/
+
+#include <functional>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <functional> are defined.
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_invoke)
+#  error "__cpp_lib_invoke is not defined"
+# elif __cpp_lib_invoke < 201411L
+#  error "__cpp_lib_invoke has an invalid value"
+# endif
+#endif
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
new file mode 100644
index 0000000..35ed34b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/iomanip.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <iomanip> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_quoted_string_io                  201304L
+
+*/
+
+#include <iomanip>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <iomanip> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
new file mode 100644
index 0000000..02e0286
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/iterator.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <iterator> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_array_constexpr                   201603L
+    __cpp_lib_make_reverse_iterator             201402L
+    __cpp_lib_nonmember_container_access        201411L
+    __cpp_lib_null_iterators                    201304L
+
+*/
+
+#include <iterator>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <iterator> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
new file mode 100644
index 0000000..ad666d1
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/list.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <list> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_incomplete_container_elements     201505L
+    __cpp_lib_list_remove_return_type           201806L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <list>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <list> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
new file mode 100644
index 0000000..933449c
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/map.version.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <map> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_generic_associative_lookup        201304L
+    __cpp_lib_map_try_emplace                   201411L
+    __cpp_lib_node_extract                      201606L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <map>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <map> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
new file mode 100644
index 0000000..5dbd6ab
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/memory.version.pass.cpp
@@ -0,0 +1,39 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <memory> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_addressof_constexpr               201603L
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_enable_shared_from_this           201603L
+    __cpp_lib_make_unique                       201304L
+    __cpp_lib_raw_memory_algorithms             201606L
+    __cpp_lib_shared_ptr_arrays                 201611L
+    __cpp_lib_shared_ptr_weak_type              201606L
+    __cpp_lib_transparent_operators             201510L
+
+*/
+
+#include <memory>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <memory> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp
new file mode 100644
index 0000000..30c2723
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/memory_resource.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <memory_resource> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_memory_resource                   201603L
+
+*/
+
+// XFAIL
+// #include <memory_resource>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <memory_resource> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
new file mode 100644
index 0000000..1909b31
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/mutex.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <mutex> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_scoped_lock                       201703L
+
+*/
+
+#include <mutex>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <mutex> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
new file mode 100644
index 0000000..6daca34
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/new.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <new> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_hardware_interference_size        201703L
+    __cpp_lib_launder                           201606L
+
+*/
+
+#include <new>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <new> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
new file mode 100644
index 0000000..fbe100b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/numeric.version.pass.cpp
@@ -0,0 +1,33 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <numeric> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_gcd_lcm                           201606L
+    __cpp_lib_parallel_algorithm                201603L
+
+*/
+
+#include <numeric>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <numeric> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
new file mode 100644
index 0000000..b78eda6
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/optional.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <optional> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_optional                          201606L
+
+*/
+
+#include <optional>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <optional> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
new file mode 100644
index 0000000..91222ce
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/regex.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <regex> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <regex>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <regex> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
new file mode 100644
index 0000000..c430691
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/scoped_allocator.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <scoped_allocator> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+
+*/
+
+#include <scoped_allocator>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <scoped_allocator> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
new file mode 100644
index 0000000..dc414f0
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/set.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <set> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_generic_associative_lookup        201304L
+    __cpp_lib_node_extract                      201606L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <set>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <set> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
new file mode 100644
index 0000000..d432e8b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/shared_mutex.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <shared_mutex> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_shared_mutex                      201505L
+    __cpp_lib_shared_timed_mutex                201402L
+
+*/
+
+// UNSUPPORTED: libcpp-has-no-threads
+
+#include <shared_mutex>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <shared_mutex> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
new file mode 100644
index 0000000..2b755b6
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/string.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <string> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_nonmember_container_access        201411L
+    __cpp_lib_string_udls                       201304L
+    __cpp_lib_string_view                       201606L
+
+*/
+
+#include <string>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <string> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
new file mode 100644
index 0000000..53e7682
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/string_view.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <string_view> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_string_view                       201606L
+
+*/
+
+#include <string_view>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <string_view> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
new file mode 100644
index 0000000..921b8ae
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/tuple.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <tuple> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_apply                             201603L
+    __cpp_lib_make_from_tuple                   201606L
+    __cpp_lib_tuple_element_t                   201402L
+    __cpp_lib_tuples_by_type                    201304L
+
+*/
+
+#include <tuple>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <tuple> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
new file mode 100644
index 0000000..9f7eced
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
@@ -0,0 +1,53 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <type_traits> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_bool_constant                     201505L
+    __cpp_lib_has_unique_object_representations 201606L
+    __cpp_lib_integral_constant_callable        201304L
+    __cpp_lib_is_aggregate                      201703L
+    __cpp_lib_is_final                          201402L
+    __cpp_lib_is_invocable                      201703L
+    __cpp_lib_is_null_pointer                   201309L
+    __cpp_lib_is_swappable                      201603L
+    __cpp_lib_logical_traits                    201510L
+    __cpp_lib_result_of_sfinae                  201210L
+    __cpp_lib_transformation_trait_aliases      201304L
+    __cpp_lib_type_trait_variable_templates     201510L
+    __cpp_lib_void_t                            201411L
+
+*/
+
+#include <type_traits>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <type_traits> are defined.
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_void_t)
+#  error "__cpp_lib_void_t is not defined"
+# elif __cpp_lib_void_t < 201411L
+#  error "__cpp_lib_void_t has an invalid value"
+# endif
+#endif
+
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
new file mode 100644
index 0000000..cf01b4a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp
@@ -0,0 +1,35 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <unordered_map> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_node_extract                      201606L
+    __cpp_lib_nonmember_container_access        201411L
+    __cpp_lib_unordered_map_try_emplace         201411L
+
+*/
+
+#include <unordered_map>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <unordered_map> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
new file mode 100644
index 0000000..b8e7063
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp
@@ -0,0 +1,34 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <unordered_set> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_node_extract                      201606L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <unordered_set>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <unordered_set> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
new file mode 100644
index 0000000..e67cb94
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/utility.version.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <utility> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_as_const                          201510L
+    __cpp_lib_exchange_function                 201304L
+    __cpp_lib_integer_sequence                  201304L
+    __cpp_lib_to_chars                          201611L
+    __cpp_lib_tuples_by_type                    201304L
+
+*/
+
+#include <utility>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <utility> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
new file mode 100644
index 0000000..75f228b
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/variant.version.pass.cpp
@@ -0,0 +1,32 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <variant> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_variant                           201606L
+
+*/
+
+#include <variant>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <variant> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
new file mode 100644
index 0000000..f033d44
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/vector.version.pass.cpp
@@ -0,0 +1,34 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <vector> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_incomplete_container_elements     201505L
+    __cpp_lib_nonmember_container_access        201411L
+
+*/
+
+#include <vector>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <vector> are defined.
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
new file mode 100644
index 0000000..5bc7f9a
--- /dev/null
+++ b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -0,0 +1,135 @@
+
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+//
+// <version> feature macros
+
+/*  Constant                                    Value
+    __cpp_lib_addressof_constexpr               201603L
+    __cpp_lib_allocator_traits_is_always_equal  201411L
+    __cpp_lib_any                               201606L
+    __cpp_lib_apply                             201603L
+    __cpp_lib_array_constexpr                   201603L
+    __cpp_lib_as_const                          201510L
+    __cpp_lib_atomic_is_always_lock_free        201603L
+    __cpp_lib_atomic_ref                        201806L
+    __cpp_lib_bit_cast                          201806L
+    __cpp_lib_bool_constant                     201505L
+    __cpp_lib_boyer_moore_searcher              201603L
+    __cpp_lib_byte                              201603L
+    __cpp_lib_chrono                            201611L
+    __cpp_lib_clamp                             201603L
+    __cpp_lib_complex_udls                      201309L
+    __cpp_lib_concepts                          201806L
+    __cpp_lib_constexpr_swap_algorithms         201806L
+    __cpp_lib_enable_shared_from_this           201603L
+    __cpp_lib_exchange_function                 201304L
+    __cpp_lib_execution                         201603L
+    __cpp_lib_filesystem                        201703L
+    __cpp_lib_gcd_lcm                           201606L
+    __cpp_lib_generic_associative_lookup        201304L
+    __cpp_lib_hardware_interference_size        201703L
+    __cpp_lib_has_unique_object_representations 201606L
+    __cpp_lib_hypot                             201603L
+    __cpp_lib_incomplete_container_elements     201505L
+    __cpp_lib_integer_sequence                  201304L
+    __cpp_lib_integral_constant_callable        201304L
+    __cpp_lib_invoke                            201411L
+    __cpp_lib_is_aggregate                      201703L
+    __cpp_lib_is_final                          201402L
+    __cpp_lib_is_invocable                      201703L
+    __cpp_lib_is_null_pointer                   201309L
+    __cpp_lib_is_swappable                      201603L
+    __cpp_lib_launder                           201606L
+    __cpp_lib_list_remove_return_type           201806L
+    __cpp_lib_logical_traits                    201510L
+    __cpp_lib_make_from_tuple                   201606L
+    __cpp_lib_make_reverse_iterator             201402L
+    __cpp_lib_make_unique                       201304L
+    __cpp_lib_map_try_emplace                   201411L
+    __cpp_lib_math_special_functions            201603L
+    __cpp_lib_memory_resource                   201603L
+    __cpp_lib_node_extract                      201606L
+    __cpp_lib_nonmember_container_access        201411L
+    __cpp_lib_not_fn                            201603L
+    __cpp_lib_null_iterators                    201304L
+    __cpp_lib_optional                          201606L
+    __cpp_lib_parallel_algorithm                201603L
+    __cpp_lib_quoted_string_io                  201304L
+    __cpp_lib_raw_memory_algorithms             201606L
+    __cpp_lib_result_of_sfinae                  201210L
+    __cpp_lib_robust_nonmodifying_seq_ops       201304L
+    __cpp_lib_sample                            201603L
+    __cpp_lib_scoped_lock                       201703L
+    __cpp_lib_shared_mutex                      201505L
+    __cpp_lib_shared_ptr_arrays                 201611L
+    __cpp_lib_shared_ptr_weak_type              201606L
+    __cpp_lib_shared_timed_mutex                201402L
+    __cpp_lib_string_udls                       201304L
+    __cpp_lib_string_view                       201606L
+    __cpp_lib_to_chars                          201611L
+    __cpp_lib_transformation_trait_aliases      201304L
+    __cpp_lib_transparent_operators             201510L
+    __cpp_lib_tuple_element_t                   201402L
+    __cpp_lib_tuples_by_type                    201304L
+    __cpp_lib_type_trait_variable_templates     201510L
+    __cpp_lib_uncaught_exceptions               201411L
+    __cpp_lib_unordered_map_try_emplace         201411L
+    __cpp_lib_variant                           201606L
+    __cpp_lib_void_t                            201411L
+
+*/
+
+#include <version>
+#include "test_macros.h"
+
+int main()
+{
+//  ensure that the macros that are supposed to be defined in <version> are defined.
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_atomic_is_always_lock_free)
+#  error "__cpp_lib_atomic_is_always_lock_free is not defined"
+# elif __cpp_lib_atomic_is_always_lock_free < 201603L
+#  error "__cpp_lib_atomic_is_always_lock_free has an invalid value"
+# endif
+#endif
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_filesystem)
+#  error "__cpp_lib_filesystem is not defined"
+# elif __cpp_lib_filesystem < 201703L
+#  error "__cpp_lib_filesystem has an invalid value"
+# endif
+#endif
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_invoke)
+#  error "__cpp_lib_invoke is not defined"
+# elif __cpp_lib_invoke < 201411L
+#  error "__cpp_lib_invoke has an invalid value"
+# endif
+#endif
+
+#if _TEST_STD_VER > 14
+# if !defined(__cpp_lib_void_t)
+#  error "__cpp_lib_void_t is not defined"
+# elif __cpp_lib_void_t < 201411L
+#  error "__cpp_lib_void_t has an invalid value"
+# endif
+#endif
+
+/*
+#if !defined(__cpp_lib_fooby)
+# error "__cpp_lib_fooby is not defined"
+#elif __cpp_lib_fooby < 201606L
+# error "__cpp_lib_fooby has an invalid value"
+#endif
+*/
+}
diff --git a/test/std/language.support/support.runtime/ctime.pass.cpp b/test/std/language.support/support.runtime/ctime.pass.cpp
index 908dc48..d80bc19 100644
--- a/test/std/language.support/support.runtime/ctime.pass.cpp
+++ b/test/std/language.support/support.runtime/ctime.pass.cpp
@@ -45,7 +45,7 @@
     static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
     static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
     static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
     static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
 #endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
diff --git a/test/std/language.support/support.start.term/quick_exit.pass.cpp b/test/std/language.support/support.start.term/quick_exit.pass.cpp
index bcfdbb7..2bf2ea7 100644
--- a/test/std/language.support/support.start.term/quick_exit.pass.cpp
+++ b/test/std/language.support/support.start.term/quick_exit.pass.cpp
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test quick_exit and at_quick_exit
 
diff --git a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
index 8b97293..f42498e 100644
--- a/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
+++ b/test/std/language.support/support.start.term/quick_exit_check1.fail.cpp
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
 // results in a compile error.
diff --git a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
index 3959141..c49704f 100644
--- a/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
+++ b/test/std/language.support/support.start.term/quick_exit_check2.fail.cpp
@@ -6,7 +6,7 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
+// UNSUPPORTED: c++98, c++03
 
 // test that referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
 // results in a compile error.
diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
new file mode 100644
index 0000000..4599348
--- /dev/null
+++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq_all_zero.pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <random>
+
+// template <class UIntType, size_t w, size_t n, size_t m, size_t r,
+//           UIntType a, size_t u, UIntType d, size_t s,
+//           UIntType b, size_t t,
+//           UIntType c, size_t l, UIntType f>
+// class mersenne_twister_engine;
+
+// template <class Sseq> explicit mersenne_twister_engine(Sseq &q);
+//
+//     [ ... ] Finally, if the most significant $w-r$ bits of $X_{-n}$ are zero,
+//     and if each of the other resulting $X_i$ is $0$, changes $X_{-n}$ to
+//     $ 2^{w-1} $.
+
+#include <random>
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#if TEST_STD_VER >= 11
+#include <initializer_list>
+#endif
+
+struct all_zero_seed_seq {
+  typedef unsigned int result_type;
+
+  all_zero_seed_seq() {}
+
+  template <typename InputIterator>
+  all_zero_seed_seq(InputIterator, InputIterator) {}
+#if TEST_STD_VER >= 11
+  all_zero_seed_seq(std::initializer_list<result_type>) {}
+#endif
+
+  template <typename RandomAccessIterator>
+  void generate(RandomAccessIterator rb, RandomAccessIterator re) {
+    std::fill(rb, re, 0u);
+  }
+
+  std::size_t size() const { return 0u; }
+  template <typename OutputIterator> void param(OutputIterator) const {}
+};
+
+template <typename result_type, std::size_t word_size>
+void test(void) {
+  const std::size_t state_size = 1u;
+  const std::size_t shift_size = 1u;
+  const std::size_t tempering_l = word_size;
+
+  all_zero_seed_seq q;
+  std::mersenne_twister_engine<result_type, word_size, state_size,
+                               shift_size,
+                               0u,
+                               0x0,
+                               0u, 0x0, 0u, 0x0, 0u, 0x0,
+                               tempering_l,
+                               0u>
+      e(q);
+
+  const result_type Xneg1 = result_type(1) << (word_size - 1);
+  const result_type Y = Xneg1;
+  const result_type X0 = Xneg1 ^ (Y >> 1);
+  assert(e() == X0);
+}
+
+int main() {
+  // Test for k == 1: word_size <= 32.
+  test<unsigned short, 3u>();
+
+  // Test for k == 2: (32 < word_size <= 64).
+  test<unsigned long long, 33u>();
+}
diff --git a/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
new file mode 100644
index 0000000..5a19edc
--- /dev/null
+++ b/test/std/re/re.alg/re.alg.match/inverted_character_classes.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+// UNSUPPORTED: c++98, c++03
+
+// Make sure that we correctly match inverted character classes.
+
+#include <cassert>
+#include <regex>
+
+
+int main() {
+    assert(std::regex_match("X", std::regex("[X]")));
+    assert(std::regex_match("X", std::regex("[XY]")));
+    assert(!std::regex_match("X", std::regex("[^X]")));
+    assert(!std::regex_match("X", std::regex("[^XY]")));
+
+    assert(std::regex_match("X", std::regex("[\\S]")));
+    assert(!std::regex_match("X", std::regex("[^\\S]")));
+
+    assert(!std::regex_match("X", std::regex("[\\s]")));
+    assert(std::regex_match("X", std::regex("[^\\s]")));
+
+    assert(std::regex_match("X", std::regex("[\\s\\S]")));
+    assert(std::regex_match("X", std::regex("[^Y\\s]")));
+    assert(!std::regex_match("X", std::regex("[^X\\s]")));
+
+    assert(std::regex_match("X", std::regex("[\\w]")));
+    assert(std::regex_match("_", std::regex("[\\w]")));
+    assert(!std::regex_match("X", std::regex("[^\\w]")));
+    assert(!std::regex_match("_", std::regex("[^\\w]")));
+
+    assert(!std::regex_match("X", std::regex("[\\W]")));
+    assert(!std::regex_match("_", std::regex("[\\W]")));
+    assert(std::regex_match("X", std::regex("[^\\W]")));
+    assert(std::regex_match("_", std::regex("[^\\W]")));
+}
diff --git a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
index dd17d35..dc0b985 100644
--- a/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
+++ b/test/std/re/re.alg/re.alg.search/invert_neg_word_search.pass.cpp
@@ -18,7 +18,7 @@
 
 #include <regex>
 #include <cassert>
-#include "test_macros.h"
+
 
 // PR34310
 int main()
diff --git a/test/std/thread/futures/futures.async/async_race.38682.pass.cpp b/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
new file mode 100644
index 0000000..9374c50
--- /dev/null
+++ b/test/std/thread/futures/futures.async/async_race.38682.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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: libcpp-has-no-threads
+// UNSUPPORTED: c++98, c++03
+
+// There's currently no release of OS X whose dylib contains the patch for
+// PR38682. Since the fix for future<void> is in the dylib, this test may fail.
+// UNSUPPORTED: apple-darwin
+
+// This test is designed to cause and allow TSAN to detect a race condition
+// in std::async, as reported in https://bugs.llvm.org/show_bug.cgi?id=38682.
+
+#include <cassert>
+#include <functional>
+#include <future>
+#include <numeric>
+#include <vector>
+
+
+static int worker(std::vector<int> const& data) {
+  return std::accumulate(data.begin(), data.end(), 0);
+}
+
+static int& worker_ref(int& i) { return i; }
+
+static void worker_void() { }
+
+int main() {
+  // future<T>
+  {
+    std::vector<int> const v{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+    for (int i = 0; i != 20; ++i) {
+      std::future<int> fut = std::async(std::launch::async, worker, v);
+      int answer = fut.get();
+      assert(answer == 55);
+    }
+  }
+
+  // future<T&>
+  {
+    for (int i = 0; i != 20; ++i) {
+      std::future<int&> fut = std::async(std::launch::async, worker_ref, std::ref(i));
+      int& answer = fut.get();
+      assert(answer == i);
+    }
+  }
+
+  // future<void>
+  {
+    for (int i = 0; i != 20; ++i) {
+      std::future<void> fut = std::async(std::launch::async, worker_void);
+      fut.get();
+    }
+  }
+}
diff --git a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
index 0ddbd0b..4e107ca 100644
--- a/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
+++ b/test/std/thread/futures/futures.shared_future/wait_until.pass.cpp
@@ -10,6 +10,8 @@
 // UNSUPPORTED: libcpp-has-no-threads
 // UNSUPPORTED: c++98, c++03
 
+// FLAKY_TEST.
+
 // <future>
 
 // class shared_future<R>
diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
index 6b62202..0a5a3e4 100644
--- a/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
+++ b/test/std/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 // UNSUPPORTED: libcpp-has-no-threads
+// FLAKY_TEST.
 
 // <thread>
 
diff --git a/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp b/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
index 3fc533a..b6a940f 100644
--- a/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
+++ b/test/std/utilities/charconv/charconv.from.chars/integral.pass.cpp
@@ -8,6 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03, c++11
+
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
 // <charconv>
 
 // from_chars_result from_chars(const char* first, const char* last,
diff --git a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
index 50ca5b1..ab78ca4 100644
--- a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
+++ b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
@@ -8,6 +8,15 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++98, c++03, c++11
+
+// XFAIL: with_system_cxx_lib=macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.10
+// XFAIL: with_system_cxx_lib=macosx10.9
+// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: with_system_cxx_lib=macosx10.7
+
 // <charconv>
 
 // to_chars_result to_chars(char* first, char* last, Integral value,
diff --git a/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000..c8247a1
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// binary_negate
+//  deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+    typedef int first_argument_type;
+    typedef int second_argument_type;
+    bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+    std::binary_negate<Predicate> f((Predicate())); // expected-error{{'binary_negate<Predicate>' is deprecated}}
+    (void)f;
+}
diff --git a/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000..584d3ab
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.fail.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not1
+//  deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+    typedef int argument_type;
+    bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+    std::not1(Predicate()); // expected-error{{'not1<Predicate>' is deprecated}}
+}
diff --git a/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000..92e3be5
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// not2
+//  deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+    typedef int first_argument_type;
+    typedef int second_argument_type;
+    bool operator()(first_argument_type, second_argument_type) const { return true; }
+};
+
+int main() {
+    std::not2(Predicate()); // expected-error{{'not2<Predicate>' is deprecated}}
+}
diff --git a/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp b/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp
new file mode 100644
index 0000000..b38a7d2
--- /dev/null
+++ b/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.fail.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// unary_negate
+//  deprecated in C++17
+
+// UNSUPPORTED: clang-4.0
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_DEPRECATION_WARNINGS
+
+#include <functional>
+
+#include "test_macros.h"
+
+struct Predicate {
+    typedef int argument_type;
+    bool operator()(argument_type) const { return true; }
+};
+
+int main() {
+    std::unary_negate<Predicate> f((Predicate())); // expected-error{{'unary_negate<Predicate>' is deprecated}}
+    (void)f;
+}
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 62a3be8..eb66ed4 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -15,6 +15,13 @@
 
 #include "test_macros.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
+
 int A_constructed = 0;
 
 struct A
@@ -27,6 +34,7 @@
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()
diff --git a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
index 3df8dd0..4d9d698 100644
--- a/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
+++ b/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
@@ -16,6 +16,12 @@
 #include "test_macros.h"
 #include <MoveOnly.h>
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 int A_constructed = 0;
 
 struct A
@@ -28,6 +34,7 @@
     ~A() {--A_constructed; data_ = 0;}
 
     bool operator==(int i) const {return data_ == i;}
+    A* operator& () DELETE_FUNCTION;
 };
 
 int main()
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
index 3e4a99e..a430b5d 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
@@ -23,6 +23,12 @@
 #include "test_allocator.h"
 #include "min_allocator.h"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 int new_count = 0;
 
 struct A
@@ -37,6 +43,8 @@
 
     int get_int() const {return int_;}
     char get_char() const {return char_;}
+
+    A* operator& () DELETE_FUNCTION;
 private:
     int int_;
     char char_;
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
index f8f73f7..88e6919 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -19,6 +19,12 @@
 #include "test_macros.h"
 #include "count_new.hpp"
 
+#if TEST_STD_VER >= 11
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
 struct A
 {
     static int count;
@@ -31,6 +37,9 @@
 
     int get_int() const {return int_;}
     char get_char() const {return char_;}
+
+    A* operator& () DELETE_FUNCTION;
+
 private:
     int int_;
     char char_;
diff --git a/test/std/utilities/time/date.time/ctime.pass.cpp b/test/std/utilities/time/date.time/ctime.pass.cpp
index fe9f38d..cd1f32b 100644
--- a/test/std/utilities/time/date.time/ctime.pass.cpp
+++ b/test/std/utilities/time/date.time/ctime.pass.cpp
@@ -47,7 +47,7 @@
     static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
     static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
     static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
-#if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)
+#if TEST_STD_VER > 14 && defined(TEST_HAS_TIMESPEC_GET)
     static_assert((std::is_same<decltype(std::timespec_get(nullptr, 0)), int>::value), "");
 #endif
 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
diff --git a/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp b/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
index ffe855c..5d61641 100644
--- a/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.arithmetic/op_+=.pass.cpp
@@ -12,15 +12,35 @@
 // time_point
 
 // time_point& operator+=(const duration& d);
+// constexpr in c++17
 
 #include <chrono>
 #include <cassert>
 
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool constexpr_test()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds Duration;
+    std::chrono::time_point<Clock, Duration> t(Duration(5));
+    t += Duration(4);
+    return t.time_since_epoch() == Duration(9);
+}
+#endif
+
 int main()
 {
+    {
     typedef std::chrono::system_clock Clock;
     typedef std::chrono::milliseconds Duration;
     std::chrono::time_point<Clock, Duration> t(Duration(3));
     t += Duration(2);
     assert(t.time_since_epoch() == Duration(5));
+    }
+    
+#if TEST_STD_VER > 14
+    static_assert(constexpr_test(), "");
+#endif
 }
diff --git a/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp b/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
index acad1cf..44d5d41 100644
--- a/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
+++ b/test/std/utilities/time/time.point/time.point.arithmetic/op_-=.pass.cpp
@@ -12,15 +12,35 @@
 // time_point
 
 // time_point& operator-=(const duration& d);
+// constexpr in c++17
 
 #include <chrono>
 #include <cassert>
 
+#include "test_macros.h"
+
+#if TEST_STD_VER > 14
+constexpr bool constexpr_test()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds Duration;
+    std::chrono::time_point<Clock, Duration> t(Duration(5));
+    t -= Duration(4);
+    return t.time_since_epoch() == Duration(1);
+}
+#endif
+
 int main()
 {
+    {
     typedef std::chrono::system_clock Clock;
     typedef std::chrono::milliseconds Duration;
     std::chrono::time_point<Clock, Duration> t(Duration(3));
     t -= Duration(2);
     assert(t.time_since_epoch() == Duration(1));
+    }
+    
+#if TEST_STD_VER > 14
+    static_assert(constexpr_test(), "");
+#endif
 }
diff --git a/test/std/utilities/variant/variant.relops/relops.pass.cpp b/test/std/utilities/variant/variant.relops/relops.pass.cpp
index 4337b4b..41a9535 100644
--- a/test/std/utilities/variant/variant.relops/relops.pass.cpp
+++ b/test/std/utilities/variant/variant.relops/relops.pass.cpp
@@ -85,43 +85,79 @@
 }
 #endif // TEST_HAS_NO_EXCEPTIONS
 
+struct MyBool {
+  bool value;
+  constexpr explicit MyBool(bool v) : value(v) {}
+  constexpr operator bool() const noexcept { return value; }
+};
+
+struct ComparesToMyBool {
+  int value = 0;
+};
+inline constexpr MyBool operator==(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value == RHS.value);
+}
+inline constexpr MyBool operator!=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value != RHS.value);
+}
+inline constexpr MyBool operator<(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value < RHS.value);
+}
+inline constexpr MyBool operator<=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value <= RHS.value);
+}
+inline constexpr MyBool operator>(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value > RHS.value);
+}
+inline constexpr MyBool operator>=(const ComparesToMyBool& LHS, const ComparesToMyBool& RHS) noexcept {
+  return MyBool(LHS.value >= RHS.value);
+}
+
+template <class T1, class T2>
+void test_equality_basic() {
+  {
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{42});
+    constexpr V v2(std::in_place_index<0>, T1{42});
+    static_assert(v1 == v2, "");
+    static_assert(v2 == v1, "");
+    static_assert(!(v1 != v2), "");
+    static_assert(!(v2 != v1), "");
+  }
+  {
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{42});
+    constexpr V v2(std::in_place_index<0>, T1{43});
+    static_assert(!(v1 == v2), "");
+    static_assert(!(v2 == v1), "");
+    static_assert(v1 != v2, "");
+    static_assert(v2 != v1, "");
+  }
+  {
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{42});
+    constexpr V v2(std::in_place_index<1>, T2{42});
+    static_assert(!(v1 == v2), "");
+    static_assert(!(v2 == v1), "");
+    static_assert(v1 != v2, "");
+    static_assert(v2 != v1, "");
+  }
+  {
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<1>, T2{42});
+    constexpr V v2(std::in_place_index<1>, T2{42});
+    static_assert(v1 == v2, "");
+    static_assert(v2 == v1, "");
+    static_assert(!(v1 != v2), "");
+    static_assert(!(v2 != v1), "");
+  }
+}
+
 void test_equality() {
-  {
-    using V = std::variant<int, long>;
-    constexpr V v1(42);
-    constexpr V v2(42);
-    static_assert(v1 == v2, "");
-    static_assert(v2 == v1, "");
-    static_assert(!(v1 != v2), "");
-    static_assert(!(v2 != v1), "");
-  }
-  {
-    using V = std::variant<int, long>;
-    constexpr V v1(42);
-    constexpr V v2(43);
-    static_assert(!(v1 == v2), "");
-    static_assert(!(v2 == v1), "");
-    static_assert(v1 != v2, "");
-    static_assert(v2 != v1, "");
-  }
-  {
-    using V = std::variant<int, long>;
-    constexpr V v1(42);
-    constexpr V v2(42l);
-    static_assert(!(v1 == v2), "");
-    static_assert(!(v2 == v1), "");
-    static_assert(v1 != v2, "");
-    static_assert(v2 != v1, "");
-  }
-  {
-    using V = std::variant<int, long>;
-    constexpr V v1(42l);
-    constexpr V v2(42l);
-    static_assert(v1 == v2, "");
-    static_assert(v2 == v1, "");
-    static_assert(!(v1 != v2), "");
-    static_assert(!(v2 != v1), "");
-  }
+  test_equality_basic<int, long>();
+  test_equality_basic<ComparesToMyBool, int>();
+  test_equality_basic<int, ComparesToMyBool>();
+  test_equality_basic<ComparesToMyBool, ComparesToMyBool>();
 #ifndef TEST_HAS_NO_EXCEPTIONS
   {
     using V = std::variant<int, MakeEmptyT>;
@@ -160,41 +196,54 @@
 template <class Var>
 constexpr bool test_less(const Var &l, const Var &r, bool expect_less,
                          bool expect_greater) {
+  static_assert(std::is_same_v<decltype(l < r), bool>, "");
+  static_assert(std::is_same_v<decltype(l <= r), bool>, "");
+  static_assert(std::is_same_v<decltype(l > r), bool>, "");
+  static_assert(std::is_same_v<decltype(l >= r), bool>, "");
+
   return ((l < r) == expect_less) && (!(l >= r) == expect_less) &&
          ((l > r) == expect_greater) && (!(l <= r) == expect_greater);
 }
 
-void test_relational() {
+template <class T1, class T2>
+void test_relational_basic() {
   { // same index, same value
-    using V = std::variant<int, long>;
-    constexpr V v1(1);
-    constexpr V v2(1);
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{1});
+    constexpr V v2(std::in_place_index<0>, T1{1});
     static_assert(test_less(v1, v2, false, false), "");
   }
   { // same index, value < other_value
-    using V = std::variant<int, long>;
-    constexpr V v1(0);
-    constexpr V v2(1);
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{0});
+    constexpr V v2(std::in_place_index<0>, T1{1});
     static_assert(test_less(v1, v2, true, false), "");
   }
   { // same index, value > other_value
-    using V = std::variant<int, long>;
-    constexpr V v1(1);
-    constexpr V v2(0);
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{1});
+    constexpr V v2(std::in_place_index<0>, T1{0});
     static_assert(test_less(v1, v2, false, true), "");
   }
   { // LHS.index() < RHS.index()
-    using V = std::variant<int, long>;
-    constexpr V v1(0);
-    constexpr V v2(0l);
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<0>, T1{0});
+    constexpr V v2(std::in_place_index<1>, T2{0});
     static_assert(test_less(v1, v2, true, false), "");
   }
   { // LHS.index() > RHS.index()
-    using V = std::variant<int, long>;
-    constexpr V v1(0l);
-    constexpr V v2(0);
+    using V = std::variant<T1, T2>;
+    constexpr V v1(std::in_place_index<1>, T2{0});
+    constexpr V v2(std::in_place_index<0>, T1{0});
     static_assert(test_less(v1, v2, false, true), "");
   }
+}
+
+void test_relational() {
+  test_relational_basic<int, long>();
+  test_relational_basic<ComparesToMyBool, int>();
+  test_relational_basic<int, ComparesToMyBool>();
+  test_relational_basic<ComparesToMyBool, ComparesToMyBool>();
 #ifndef TEST_HAS_NO_EXCEPTIONS
   { // LHS.index() < RHS.index(), RHS is empty
     using V = std::variant<int, MakeEmptyT>;
diff --git a/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp b/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp
new file mode 100644
index 0000000..ab68bc4
--- /dev/null
+++ b/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+//                     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, c++11, c++14
+
+// <variant>
+
+// template <class ...Types>
+// constexpr bool
+// operator==(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator!=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator<=(variant<Types...> const&, variant<Types...> const&) noexcept;
+//
+// template <class ...Types>
+// constexpr bool
+// operator>=(variant<Types...> const&, variant<Types...> const&) noexcept;
+
+#include <cassert>
+#include <type_traits>
+#include <utility>
+#include <variant>
+
+#include "test_macros.h"
+
+
+struct MyBoolExplicit {
+  bool value;
+  constexpr explicit MyBoolExplicit(bool v) : value(v) {}
+  constexpr explicit operator bool() const noexcept { return value; }
+};
+
+struct ComparesToMyBoolExplicit {
+  int value = 0;
+};
+inline constexpr MyBoolExplicit operator==(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value == RHS.value);
+}
+inline constexpr MyBoolExplicit operator!=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value != RHS.value);
+}
+inline constexpr MyBoolExplicit operator<(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value < RHS.value);
+}
+inline constexpr MyBoolExplicit operator<=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value <= RHS.value);
+}
+inline constexpr MyBoolExplicit operator>(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value > RHS.value);
+}
+inline constexpr MyBoolExplicit operator>=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
+  return MyBoolExplicit(LHS.value >= RHS.value);
+}
+
+
+int main() {
+  using V = std::variant<int, ComparesToMyBoolExplicit>;
+  V v1(42);
+  V v2(101);
+  // expected-error-re@variant:* 6 {{static_assert failed {{.*}}"the relational operator does not return a type which is implicitly convertible to bool"}}
+  // expected-error@variant:* 6 {{no viable conversion}}
+  (void)(v1 == v2); // expected-note {{here}}
+  (void)(v1 != v2); // expected-note {{here}}
+  (void)(v1 < v2); // expected-note {{here}}
+  (void)(v1 <= v2); // expected-note {{here}}
+  (void)(v1 > v2); // expected-note {{here}}
+  (void)(v1 >= v2); // expected-note {{here}}
+}
diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp
index 76d8ab0..97a17bb 100644
--- a/test/support/nasty_macros.hpp
+++ b/test/support/nasty_macros.hpp
@@ -22,7 +22,11 @@
 #define _J NASTY_MACRO
 #define _K NASTY_MACRO
 #define _L NASTY_MACRO
+// Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid
+// including that header, only define _M for other operating systems.
+#ifndef __FreeBSD__
 #define _M NASTY_MACRO
+#endif
 #define _N NASTY_MACRO
 #define _O NASTY_MACRO
 #define _P NASTY_MACRO
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index ac6ec79..e008b53 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -124,22 +124,29 @@
 
 // Sniff out to see if the underling C library has C11 features
 // Note that at this time (July 2018), MacOS X and iOS do NOT.
-#if __ISO_C_VISIBLE >= 2011
+// This is cribbed from __config; but lives here as well because we can't assume libc++
+#if __ISO_C_VISIBLE >= 2011 || TEST_STD_VER >= 11
 #  if defined(__FreeBSD__)
+//  Specifically, FreeBSD does NOT have timespec_get, even though they have all
+//  the rest of C11 - this is PR#38495
 #    define TEST_HAS_C11_FEATURES
 #  elif defined(__Fuchsia__)
 #    define TEST_HAS_C11_FEATURES
+#    define TEST_HAS_TIMESPEC_GET
 #  elif defined(__linux__)
 #    if !defined(_LIBCPP_HAS_MUSL_LIBC)
 #      if _LIBCPP_GLIBC_PREREQ(2, 17)
+#        define TEST_HAS_TIMESPEC_GET
 #        define TEST_HAS_C11_FEATURES
 #      endif
 #    else // defined(_LIBCPP_HAS_MUSL_LIBC)
 #      define TEST_HAS_C11_FEATURES
+#      define TEST_HAS_TIMESPEC_GET
 #    endif
 #  elif defined(_WIN32)
 #    if defined(_MSC_VER) && !defined(__MINGW32__)
 #      define TEST_HAS_C11_FEATURES // Using Microsoft's C Runtime library
+#      define TEST_HAS_TIMESPEC_GET
 #    endif
 #  endif
 #endif
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 6542ceb..186a273 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -677,7 +677,8 @@
                 if feature_macros[m]:
                     define += '=%s' % (feature_macros[m])
                 self.cxx.compile_flags += [define]
-            if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS':
+            if m == '_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS' or \
+               m == '_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT':
                 continue
             if m == '_LIBCPP_ABI_VERSION':
                 self.config.available_features.add('libcpp-abi-version-v%s'
diff --git a/utils/libcxx/test/format.py b/utils/libcxx/test/format.py
index 74e3cc0..8276b3f 100644
--- a/utils/libcxx/test/format.py
+++ b/utils/libcxx/test/format.py
@@ -250,9 +250,8 @@
             #
             # Therefore, we check if the test was expected to fail because of
             # nodiscard before enabling it
-            test_str = "ignoring return value of function declared with " \
-              + "'nodiscard' attribute"
-            if test_str in contents:
+            test_str_list = ['ignoring return value', 'nodiscard', 'NODISCARD']
+            if any(test_str in contents for test_str in test_str_list):
                 test_cxx.flags += ['-Werror=unused-result']
         cmd, out, err, rc = test_cxx.compile(source_path, out=os.devnull)
         expected_rc = 0 if use_verify else 1
diff --git a/utils/libcxx/test/target_info.py b/utils/libcxx/test/target_info.py
index 0e93e11..de2232f 100644
--- a/utils/libcxx/test/target_info.py
+++ b/utils/libcxx/test/target_info.py
@@ -222,12 +222,17 @@
                           self.full_config.config.available_features)
         llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False)
         shared_libcxx = self.full_config.get_lit_bool('enable_shared', True)
+        # FIXME: Remove the need to link -lrt in all the tests, and instead
+        # limit it only to the filesystem tests. This ensures we don't cause an
+        # implicit dependency on librt except when filesystem is needed.
+        enable_fs = self.full_config.get_lit_bool('enable_filesystem',
+                                                  default=False)
         flags += ['-lm']
         if not llvm_unwinder:
             flags += ['-lgcc_s', '-lgcc']
         if enable_threads:
             flags += ['-lpthread']
-            if not shared_libcxx:
+            if not shared_libcxx or enable_fs:
               flags += ['-lrt']
         flags += ['-lc']
         if llvm_unwinder:
diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html
index fa6a47a..97f5a8d 100644
--- a/www/cxx2a_status.html
+++ b/www/cxx2a_status.html
@@ -73,7 +73,7 @@
 	<tr><td><a href="https://wg21.link/P0768R1">P0768R1</a></td><td>CWG</td><td>Library Support for the Spaceship (Comparison) Operator</td><td>Albuquerque</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0777R1">P0777R1</a></td><td>LWG</td><td>Treating Unnecessary <tt>decay</tt></td><td>Albuquerque</td><td>Complete</td><td>7.0</td></tr>
 	<tr><td><a href="https://wg21.link/P0122R7">P0122R7</a></td><td>LWG</td><td>&lt;span&gt;</td><td>Jacksonville</td><td>Complete</td><td>7.0</td></tr>
-	<tr><td><a href="https://wg21.link/P0355R7">P0355R7</a></td><td>LWG</td><td>Extending chrono to Calendars and Time Zones</td><td>Jacksonville</td><td></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0355R7">P0355R7</a></td><td>LWG</td><td>Extending chrono to Calendars and Time Zones</td><td>Jacksonville</td><td><i>In progress</i></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0551R3">P0551R3</a></td><td>LWG</td><td>Thou Shalt Not Specialize <tt>std</tt> Function Templates!</td><td>Jacksonville</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0753R2">P0753R2</a></td><td>LWG</td><td>Manipulators for C++ Synchronized Buffered Ostream</td><td>Jacksonville</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0754R2">P0754R2</a></td><td>LWG</td><td>&lt;version&gt;</td><td>Jacksonville</td><td>Complete</td><td>7.0</td></tr>
@@ -89,7 +89,7 @@
 	<tr><td><a href="https://wg21.link/P0476R2">P0476R2</a></td><td>LWG</td><td>Bit-casting object representations</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0528R3">P0528R3</a></td><td>CWG</td><td>The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0542R5">P0542R5</a></td><td>CWG</td><td>Support for contract based programming in C++</td><td>Rapperswil</td><td></td><td></td></tr>
-	<tr><td><a href="https://wg21.link/P0556R3">P0556R3</a></td><td>LWG</td><td>Integral power-of-2 operations</td><td>Rapperswil</td><td></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0556R3">P0556R3</a></td><td>LWG</td><td>Integral power-of-2 operations</td><td>Rapperswil</td><td><i>In Progress</i></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0619R4">P0619R4</a></td><td>LWG</td><td>Reviewing Deprecated Facilities of C++17 for C++20</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0646R1">P0646R1</a></td><td>LWG</td><td>Improving the Return Value of Erase-Like Algorithms</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0722R3">P0722R3</a></td><td>CWG</td><td>Efficient sized delete for variable sized classes</td><td>Rapperswil</td><td></td><td></td></tr>
@@ -102,7 +102,7 @@
 	<tr><td><a href="https://wg21.link/P0892R2">P0892R2</a></td><td>CWG</td><td>explicit(bool)</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0898R3">P0898R3</a></td><td>LWG</td><td>Standard Library Concepts</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0935R0">P0935R0</a></td><td>LWG</td><td>Eradicating unnecessarily explicit default constructors from the standard library</td><td>Rapperswil</td><td></td><td></td></tr>
-	<tr><td><a href="https://wg21.link/P0941R2">P0941R2</a></td><td>CWG</td><td>Integrating feature-test macros into the C++ WD</td><td>Rapperswil</td><td></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0941R2">P0941R2</a></td><td>CWG</td><td>Integrating feature-test macros into the C++ WD</td><td>Rapperswil</td><td><i>In progress</i></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P1023R0">P1023R0</a></td><td>LWG</td><td>constexpr comparison operators for std::array</td><td>Rapperswil</td><td>Complete</td><td>8.0</td></tr>
 	<tr><td><a href="https://wg21.link/P1025R1">P1025R1</a></td><td>CWG</td><td>Update The Reference To The Unicode Standard</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P1120R0">P1120R0</a></td><td>CWG</td><td>Consistency improvements for &lt;=&gt; and other comparison operators</td><td>Rapperswil</td><td></td><td></td></tr>
@@ -148,8 +148,8 @@
 	<tr><td><a href="https://wg21.link/LWG2948">2948</a></td><td>unique_ptr does not define operator<< for stream output</td><td>Albuquerque</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG2950">2950</a></td><td>std::byte operations are misspecified</td><td>Albuquerque</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG2952">2952</a></td><td>iterator_traits should work for pointers to cv T</td><td>Albuquerque</td><td>Complete</td></tr>
-	<tr><td><a href="https://wg21.link/LWG2953">2953</a></td><td>LWG 2853 should apply to deque::erase too</td><td>Albuquerque</td><td></td></tr>
-	<tr><td><a href="https://wg21.link/LWG2958">2958</a></td><td>Moves improperly defined as deleted</td><td>Albuquerque</td><td></td></tr>
+	<tr><td><a href="https://wg21.link/LWG2953">2953</a></td><td>LWG 2853 should apply to deque::erase too</td><td>Albuquerque</td><td>Complete</td></tr>
+	<tr><td><a href="https://wg21.link/LWG2958">2958</a></td><td>Moves improperly defined as deleted</td><td>Albuquerque</td><td><I>We already do this</I></td></tr>
 	<tr><td><a href="https://wg21.link/LWG2964">2964</a></td><td>Apparently redundant requirement for dynamic_pointer_cast</td><td>Albuquerque</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG2965">2965</a></td><td>Non-existing path::native_string() in filesystem_error::what() specification</td><td>Albuquerque</td><td>Nothing to do</td></tr>
 	<tr><td><a href="https://wg21.link/LWG2972">2972</a></td><td>What is is_trivially_destructible_v&lt;int&gt;?</td><td>Albuquerque</td><td>Complete</td></tr>
@@ -187,7 +187,7 @@
 	<tr><td><a href="https://wg21.link/LWG3013">3013</a></td><td><tt>(recursive_)directory_iterator</tt> construction and traversal should not be <tt>noexcept</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3014">3014</a></td><td>More <tt>noexcept</tt> issues with filesystem operations</td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3015">3015</a></td><td><tt>copy_options::<i>unspecified</i></tt> underspecified</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
-	<tr><td><a href="https://wg21.link/LWG3017">3017</a></td><td><tt>list splice</tt> functions should use <tt>addressof</tt></td><td>Jacksonville</td><td></td></tr>
+	<tr><td><a href="https://wg21.link/LWG3017">3017</a></td><td><tt>list splice</tt> functions should use <tt>addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3020">3020</a></td><td>[networking.ts] Remove spurious nested <tt>value_type</tt> buffer sequence requirement</td><td>Jacksonville</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG3026">3026</a></td><td><tt>filesystem::weakly_canonical</tt> still defined in terms of <tt>canonical(p, base)</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3030">3030</a></td><td>Who shall meet the requirements of <tt>try_lock</tt>?</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
@@ -216,13 +216,13 @@
 	<tr><td><a href="https://wg21.link/LWG3083">3083</a></td><td>What should ios::iword(-1) do?</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
 	<tr><td><a href="https://wg21.link/LWG3094">3094</a></td><td>[time.duration.io]p4 makes surprising claims about encoding</td><td>Rapperswil</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG3100">3100</a></td><td>Unnecessary and confusing "empty span" wording</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
-	<tr><td><a href="https://wg21.link/LWG3102">3102</a></td><td>Clarify span iterator and const_iterator behavior</td><td>Rapperswil</td><td></td></tr>
+	<tr><td><a href="https://wg21.link/LWG3102">3102</a></td><td>Clarify span iterator and const_iterator behavior</td><td>Rapperswil</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3104">3104</a></td><td>Fixing duration division</td><td>Rapperswil</td><td>Complete</td></tr>
 
 <!-- 	<tr><td></td><td></td><td></td><td></td></tr> -->
   </table>
 
-  <p>Last Updated: 1-Aug-2018</p>
+  <p>Last Updated: 12-Sep-2018</p>
 </div>
 </body>
 </html>
diff --git a/www/index.html b/www/index.html
index 8f9ae51..3724b8b 100644
--- a/www/index.html
+++ b/www/index.html
@@ -22,8 +22,9 @@
 
   <div class="submenu">
     <label>Quick Links</label>
-    <a href="https://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a>
-    <a href="https://lists.llvm.org/mailman/listinfo/cfe-commits">cfe-commits</a>
+    <a href="https://libcxxabi.llvm.org/">libc++abi</a>
+    <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
+    <a href="https://lists.llvm.org/mailman/listinfo/libcxx-commits">libcxx-commits</a>
     <a href="https://bugs.llvm.org/">Bug Reports</a>
     <a href="https://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a>
     <a href="https://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a>
@@ -35,8 +36,8 @@
   <h1>"libc++" C++ Standard Library</h1>
   <!--*********************************************************************-->
 
-  <p>libc++ is a new implementation of the C++ standard library, targeting
-     C++11.</p>
+  <p>libc++ is an implementation of the C++ standard library, targeting
+     C++11, C++14 and above.</p>
 
   <p>All of the code in libc++ is <a
      href="https://llvm.org/docs/DeveloperPolicy.html#license">dual licensed</a>
@@ -114,9 +115,8 @@
   <!--=====================================================================-->
 
   <p>
-    libc++ is known to work on the following platforms, using g++-4.2 and
-    clang (lack of C++11 language support disables some functionality). Note
-    that functionality provided by &lt;atomic&gt; is only functional with
+    libc++ is known to work on the following platforms, using g++ and
+    clang. Note that functionality provided by &lt;atomic&gt; is only functional with
     clang.
   </p>
 
@@ -126,6 +126,8 @@
     <li>FreeBSD 10+ i386</li>
     <li>FreeBSD 10+ x86_64</li>
     <li>FreeBSD 10+ ARM</li>
+    <li>Linux i386</li>
+    <li>Linux x86_64</li>
   </ul>
 
   <!--=====================================================================-->
@@ -198,7 +200,7 @@
   </p>
 
   <p>Send discussions to the
-    <a href="https://lists.llvm.org/mailman/listinfo/cfe-dev">clang mailing list</a>.</p>
+    <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libc++ mailing list</a>.</p>
 
   <!--=====================================================================-->
   <h2>Bug reports and patches</h2>
@@ -207,14 +209,14 @@
   <p>
   If you think you've found a bug in libc++, please report it using
   the <a href="https://bugs.llvm.org/">LLVM Bugzilla</a>. If you're not sure, you
-  can post a message to the <a href="https://lists.llvm.org/mailman/listinfo/cfe-dev">cfe-dev</a>
-  mailing list or on IRC. Please include "libc++" in your subject.
+  can post a message to the <a href="https://lists.llvm.org/mailman/listinfo/libcxx-dev">libcxx-dev</a>
+  mailing list or on IRC.
   </p>
 
   <p>
   If you want to contribute a patch to libc++, the best place for that is
   <a href="https://llvm.org/docs/Phabricator.html">Phabricator</a>. Please
-  include [libc++] in the subject and add cfe-commits as a subscriber.
+  add libcxx-commits as a subscriber.
   </p>
 
   <!--=====================================================================-->
diff --git a/www/upcoming_meeting.html b/www/upcoming_meeting.html
index 500bfb4..4227ed0 100644
--- a/www/upcoming_meeting.html
+++ b/www/upcoming_meeting.html
@@ -35,7 +35,7 @@
   <h1>libc++ Upcoming Meeting Status</h1>
   <!--*********************************************************************-->
 
-  <p>This is a temporary page; please check the c++1z status <a href="cxx1z_status.html">here</a></p>
+  <p>This is a temporary page; please check the c++2a status <a href="cxx2a_status.html">here</a></p>
   <p>This page shows the status of the papers and issues that are expected to be adopted in the next WG21 Meeting.</p>
 
   <p>The groups that have contributed papers:
@@ -47,77 +47,104 @@
   </p>
 
   <h3>Paper Status</h3>
-  <table id="papers" border="1">
-	<tr><th>Paper #</th><th>Paper Name</th><th>Meeting</th><th>Status</th></tr>
-	<tr><td><a href="https://wg21.link/P0805R1">P0805R1</a></td><td>Comparing Containers</td><td>Jacksonville</td><td><i>Patch Ready: <a href="https://reviews.llvm.org/D43773">D43773</a></i></td></tr>
-<!--
-	<tr><td><a href="https://wg21.link/LWGn3346">3346</a></td><td>LWG</td><td>Terminology for Container Element Requirements - Rev 1</td><td>Kona</td><td>Complete</td><td>3.4</td></tr>
--->
-<!--  	<tr><td></td><td></td><td></td><td></td><td></td><td></td></tr> -->
-  </table>
+	<table border="1">
+	<tr><th>Paper #</th><th>Group</th><th>Paper Name</th><th>Meeting</th><th>Status</th></tr>
+	<tr><td><a href="https://wg21.link/P0487R0">P0487R0</a></td><td>LWG</td><td>Fixing operator&gt;&gt; (basic_istream&amp;, CharT*) (LWG 2499)</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P0602R3">P0602R3</a></td><td>LWG</td><td>variant and optional should propagate copy/move triviality</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P0655R0">P0655R0</a></td><td>LWG</td><td>visit&lt;R&gt;: Explicit Return Type for visit</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P0972R0">P0972R0</a></td><td>LWG</td><td>&lt;chrono&gt; zero(), min(), and max() should be noexcept</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P1004R0">P1004R0</a></td><td>LWG</td><td>Making std::vector constexpr</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P1006R0">P1006R0</a></td><td>LWG</td><td>Constexpr in std::pointer_traits</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="https://wg21.link/P1032R0">P1032R0</a></td><td>LWG</td><td>Misc constexpr bits</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="http://wiki.edg.com/pub/LWGBatavia2018/LibraryWorkingGroup/D1148R0a.pdf">D1148</a></td><td>LWG</td><td>Cleaning up Clause 20</td><td>San Diego</td><td><i> </i></td></tr>
+	<tr><td><a href="http://wiki.edg.com/pub/LWGBatavia2018/LibraryWorkingGroup/D1163R0V2.pdf">D1163</a></td><td>LWG</td><td>Explicitly Implicifying explicit Constructors</td><td>San Diego</td><td><i> </i></td></tr>
+	</table>
+
 
   <h3>Library Working group Issues Status</h3>
   <table id="issues" border="1">
 	<tr><th>Issue #</th><th>Issue Name</th><th>Meeting</th><th>Status</th></tr>
 
-<tr><td><a href="https://wg21.link/LWG2139">2139</a></td><td>What is a user-defined type?</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG2970">2970</a></td><td>Return type of std::visit misspecified</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3058">3058</a></td><td>Parallel adjacent_difference shouldn't require creating temporaries</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3062">3062</a></td><td>Unnecessary decay_t in is_execution_policy_v should be remove_cvref_t</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3067">3067</a></td><td>recursive_directory_iterator::pop must invalidate</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
-<tr><td><a href="https://wg21.link/LWG3071">3071</a></td><td>[networking.ts] read_until still refers to "input sequence"</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
-<tr><td><a href="https://wg21.link/LWG3074">3074</a></td><td>Non-member functions for valarray should only deduce from the valarray</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3076">3076</a></td><td>basic_string CTAD ambiguity</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3079">3079</a></td><td>LWG 2935 forgot to fix the existing_p overloads of create_directory</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3080">3080</a></td><td>Floating point from_chars pattern specification breaks round-tripping</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3083">3083</a></td><td>What should ios::iword(-1) do?</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
-<tr><td><a href="https://wg21.link/LWG3094">3094</a></td><td>[time.duration.io]p4 makes surprising claims about encoding</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3100">3100</a></td><td>Unnecessary and confusing "empty span" wording</td><td>Rapperswil</td><td><i>Nothing to do</i></td></tr>
-<tr><td><a href="https://wg21.link/LWG3102">3102</a></td><td>Clarify span iterator and const_iterator behavior</td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG3104">3104</a></td><td>Fixing duration division</td><td>Rapperswil</td><td>Complete</td></tr>
+<tr><td><a href="https://wg21.link/LWG2183">2183</a></td><td>Muddled allocator requirements for <tt>match_results</tt> constructors</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2184">2184</a></td><td>Muddled allocator requirements for <tt>match_results</tt> assignments</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2412">2412</a></td><td><tt>promise::set_value()</tt> and <tt>promise::get_future()</tt> should not race</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2682">2682</a></td><td><code>filesystem::copy()</code> won't create a symlink to a directory</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2697">2697</a></td><td>[concurr.ts] Behavior of <tt>future/shared_future</tt> unwrapping constructor when given an invalid <tt>future</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2936">2936</a></td><td>Path comparison is defined in terms of the generic format</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2943">2943</a></td><td>Problematic specification of the wide version of <tt>basic_filebuf::open</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2960">2960</a></td><td>[fund.ts.v3] <tt>nonesuch</tt> is insufficiently useless</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2995">2995</a></td><td><tt>basic_stringbuf</tt> default constructor forbids it from using SSO capacity</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG2996">2996</a></td><td>Missing rvalue overloads for <tt>shared_ptr</tt> operations</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3008">3008</a></td><td><tt>make_shared</tt> (sub)object destruction semantics are not specified</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3025">3025</a></td><td>Map-like container deduction guides should use <tt>pair&lt;Key, T&gt;</tt>, not <tt>pair&lt;const Key, T&gt;</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3031">3031</a></td><td>Algorithms and predicates with non-const reference arguments</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3037">3037</a></td><td><tt>polymorphic_allocator</tt> and incomplete types</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3038">3038</a></td><td><tt>polymorphic_allocator::allocate</tt> should not allow integer overflow to create vulnerabilities</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3054">3054</a></td><td><tt>uninitialized_copy</tt> appears to not be able to meet its exception-safety guarantee</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3065">3065</a></td><td>LWG 2989 missed that all <tt>path</tt>'s other operators should be hidden friends as well</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3096">3096</a></td><td><tt>path::lexically_relative</tt> is confused by trailing slashes</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3116">3116</a></td><td><tt><i>OUTERMOST_ALLOC_TRAITS</i></tt> needs <tt>remove_reference_t</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3122">3122</a></td><td><tt>__cpp_lib_chrono_udls</tt> was accidentally dropped</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3127">3127</a></td><td><tt>basic_osyncstream::rdbuf</tt> needs a <tt>const_cast</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3128">3128</a></td><td><tt>strstream::rdbuf</tt> needs a <tt>const_cast</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3129">3129</a></td><td><tt>regex_token_iterator</tt> constructor uses wrong pointer arithmetic</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3130">3130</a></td><td>&sect;[input.output] needs many <tt>addressof</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3131">3131</a></td><td><tt>addressof</tt> all the things</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3132">3132</a></td><td>Library needs to ban macros named <tt>expects</tt> or <tt>ensures</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3134">3134</a></td><td>[fund.ts.v3] LFTSv3 contains extraneous [meta] variable templates that should have been deleted by P09961</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3137">3137</a></td><td>Header for <tt>__cpp_lib_to_chars</tt></td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3145">3145</a></td><td><tt>file_clock</tt> breaks ABI for C++17 implementations</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3147">3147</a></td><td>Definitions of "likely" and "unlikely" are likely to cause problems</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3148">3148</a></td><td><tt>&lt;concepts&gt;</tt> should be freestanding</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3153">3153</a></td><td><tt>Common</tt> and <tt>common_type</tt> have too little in common</td><td>San Diego</td><td></td></tr>
+<tr><td><a href="https://wg21.link/LWG3154">3154</a></td><td><tt>Common</tt> and <tt>CommonReference</tt> have a common defect</td><td>San Diego</td><td></td></tr>
 
 </table>
 
 <h3>Issues to "Review"</h3>
 <table border="1">
 <tr><th>Issue #</th><th>Issue Name</th><th>Meeting</th><th>Status</th></tr>
-<tr><td><a href="https://wg21.link/LWG2412">2412</a></td><td><tt>promise::set_value()</tt> and <tt>promise::get_future()</tt> should not race</td><td>Rapperswil</td><td>Complete</td></tr>
-<tr><td><a href="https://wg21.link/LWG2682">2682</a></td><td><code>filesystem::copy()</code> won't create a symlink to a directory</td><td>Rapperswil</td><td>Complete</td></tr>
-<tr><td><a href="https://wg21.link/LWG2697">2697</a></td><td>[concurr.ts] Behavior of <tt>future/shared_future</tt> unwrapping constructor when given an invalid <tt>future</tt></td><td>Rapperswil</td><td></td></tr>
-<tr><td><a href="https://wg21.link/LWG2708">2708</a></td><td><tt>recursive_directory_iterator::recursion_pending()</tt> is incorrectly specified</td><td>Rapperswil</td><td>Complete</td></tr>
-<tr><td><a href="https://wg21.link/LWG2936">2936</a></td><td>Path comparison is defined in terms of the generic format</td><td>Rapperswil</td><td></td></tr>
 </table>
 
 
 <h3>Comments about the issues</h3>
 <ul>
-<li>2139 - I think that this is just wording cleanup.</li>
-<li>2970 - I think that we already do this - checking with Michael.</li>
-<li>3058 - We don't do the parallel algos yet</li>
-<li>3062 - This should be very easy.</li>
-<li>3067 - Adding restrictions; no code changes needed.</li>
-<li>3071 - This is just wording cleanup.</li>
-<li>3074 - Large change, that looks straightforward.</li>
-<li>3076 - </li>
-<li>3079 - Eric? </li>
-<li>3080 - We don't have a from_chars implementation yet.</li>
-<li>3083 - This is just wording cleanup.</li>
-<li>3094 - We haven't implemented Howard's date library yet.</li>
-<li>3100 - This is just wording cleanup.</li>
-<li>3102 - This should be just adding tests.</li>
-<li>3104 - We already do this.</li>
+<li>2183 - </li>
+<li>2184 - </li>
+<li>2412 - </li>
+<li>2682 - </li>
+<li>2697 - </li>
+<li>2936 - </li>
+<li>2943 - </li>
+<li>2960 - </li>
+<li>2995 - </li>
+<li>2996 - </li>
+<li>3008 - </li>
+<li>3025 - </li>
+<li>3031 - Marshall says: I don't think we have to do anything for this issue. Maybe some tests; maybe a static_assert.</li>
+<li>3037 - Marshall says: We don't have std::polymorphic_allocator yet.</li>
+<li>3038 - Marshall says: We don't have std::polymorphic_allocator yet.</li>
+<li>3054 - Marshall says: We already do this; may need to update some tests.</li>
+<li>3065 - </li>
+<li>3096 - Eric? </li>
+<li>3116 - </li>
+<li>3122 - </li>
+<li>3127 - </li>
+<li>3128 - </li>
+<li>3129 - Marshall says: This is an easy change; I think this is more wording cleanup than anything. I will prepare a patch</li>
+<li>3130 - </li>
+<li>3131 - </li>
+<li>3132 - Marshall says: I don't think we have to do anything for this issue</li>
+<li>3134 - Marshall says: I don't think we have to do anything for this issue</li>
+<li>3137 - Marshall says: This is an easy change; I will prepare a patch</li>
+<li>3145 - Eric? </li>
+<li>3147 - Marshall - I don't think we have to do anything for this issue</li>
+<li>3148 - </li>
+<li>3153 - </li>
+<li>3154 - </li>
 </ul>
 
-<h3>Comments about the "Review" issues</h3>
-<ul>
-<li> 2412 - I think we do this already</li>
-<li> 2682 - We already to this </li>
-<li> 2697 - No concurrency TS implementation yet</li>
-<li> 2708 - We already do this </li>
-<li> 2936 - Eric - don't we do this already?</li>
-</ul>
-
-<p>Last Updated: 10-May-2018</p>
+<p>Last Updated: 6-Oct-2018</p>
 </div>
 </body>
 </html>