Merge upstream LLVM to 223068.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dbc8e83..50c1fa2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,9 +40,13 @@
 option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
-option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
+option(LIBCXX_ENABLE_CXX1Y "Enable -std=c++1y and use of c++1y language features if the compiler supports it." OFF)
 option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
 option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
+if (LIBCXX_BUILT_STANDALONE)
+  set(LLVM_USE_SANITIZER "" CACHE STRING
+      "Define the sanitizer used to build the library and tests")
+endif()
 
 set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
 if (NOT LIBCXX_CXX_ABI)
@@ -80,101 +84,15 @@
   )
 set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
 
-#===============================================================================
-# Add an ABI library if appropriate
-#===============================================================================
 
-#
-# _setup_abi: Set up the build to use an ABI library
-#
-# Parameters:
-#   abidefines: A list of defines needed to compile libc++ with the ABI library
-#   abilibs   : A list of libraries to link against
-#   abifiles  : A list of files (which may be relative paths) to copy into the
-#               libc++ build tree for the build.  These files will also be
-#               installed alongside the libc++ headers.
-#   abidirs   : A list of relative paths to create under an include directory
-#               in the libc++ build directory.
-#
-macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs)
-  list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
-  set(${abipathvar} "${${abipathvar}}"
-    CACHE PATH
-    "Paths to C++ ABI header directories separated by ';'." FORCE
-    )
-  set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
-  set(LIBCXX_ABILIB_FILES ${abifiles})
-
-  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
-  foreach(_d ${abidirs})
-    file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
-  endforeach()
-
-  foreach(fpath ${LIBCXX_ABILIB_FILES})
-    set(found FALSE)
-    foreach(incpath ${${abipathvar}})
-      if (EXISTS "${incpath}/${fpath}")
-        set(found TRUE)
-        get_filename_component(dstdir ${fpath} PATH)
-        get_filename_component(ifile ${fpath} NAME)
-        file(COPY "${incpath}/${fpath}"
-          DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
-          )
-        list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
-      endif()
-    endforeach()
-    if (NOT found)
-      message(FATAL_ERROR "Failed to find ${fpath}")
-    endif()
-  endforeach()
-
-  add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
-  include_directories("${CMAKE_BINARY_DIR}/include")
-
-  install(FILES ${abilib_headers}
-    DESTINATION include/c++/v1
-    PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-    )
-endmacro()
-
-if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
-    "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
-  set(_LIBSUPCXX_INCLUDE_FILES
-    cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
-    bits/cxxabi_tweaks.h bits/cxxabi_forced.h
-    )
-  if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
-    set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
-    set(_LIBSUPCXX_LIBNAME stdc++)
-  else()
-    set(_LIBSUPCXX_DEFINES "")
-    set(_LIBSUPCXX_LIBNAME supc++)
-  endif()
-  setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
-    "-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
-    "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
-    )
-elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
-  if (LIBCXX_CXX_ABI_INTREE)
-    # Link against just-built "cxxabi" target.
-    set(CXXABI_LIBNAME cxxabi)
-  else()
-    # Assume c++abi is installed in the system, rely on -lc++abi link flag.
-    set(CXXABI_LIBNAME "c++abi")
-  endif()
-  setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
-    ${CXXABI_LIBNAME} "cxxabi.h" ""
-    )
-elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
-  setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
-    "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
-    )
-elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
-  message(FATAL_ERROR
-    "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
-    "supported for c++ abi."
-    )
-endif ()
+# Declare libc++ configuration variables.
+# They are intended for use as follows:
+# LIBCXX_CXX_FLAGS: General flags for both the compiler and linker.
+# LIBCXX_COMPILE_FLAGS: Compile only flags.
+# LIBCXX_LINK_FLAGS: Linker only flags.
+set(LIBCXX_CXX_FLAGS "")
+set(LIBCXX_COMPILE_FLAGS "")
+set(LIBCXX_LINK_FLAGS "")
 
 # Configure compiler.
 # @LOCALMOD-START Use a custom compiler config because cmake try_compile always
@@ -186,6 +104,8 @@
   include(config-ix)
 endif()
 # @LOCALMOD-END
+# Configure ABI library
+include(HandleLibCXXABI)
 
 #===============================================================================
 # Setup Compiler Flags
@@ -199,12 +119,27 @@
   # headers.
 else()
   if (LIBCXX_HAS_NOSTDINCXX_FLAG)
-    list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
+    list(APPEND LIBCXX_COMPILE_FLAGS -nostdinc++)
     string(REPLACE "-stdlib=libc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+    string(REPLACE "-stdlib=libstdc++" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
   endif()
-  if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
-    list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
+  # If c++1y has been enabled then attempt to use it. Fail if it is no supported
+  # by the compiler. Otherwise choose c++11 and ensure the compiler supports it.
+  if (LIBCXX_ENABLE_CXX1Y)
+    if (LIBCXX_HAS_STDCXX1Y_FLAG)
+      set(LIBCXX_STD_VERSION c++1y)
+    else()
+      message(FATAL_ERROR "c++1y was enabled but the compiler does not support it.")
+    endif()
+  else()
+    if (LIBCXX_HAS_STDCXX11_FLAG)
+      set(LIBCXX_STD_VERSION c++11)
+    else()
+      message(FATAL_ERROR "c++11 is required by libc++ but is not supported by the compiler")
+    endif()
   endif()
+  # LIBCXX_STD_VERSION should always be set at this point.
+  list(APPEND LIBCXX_CXX_FLAGS "-std=${LIBCXX_STD_VERSION}")
 endif()
 
 macro(append_if list condition var)
@@ -215,23 +150,23 @@
 
 # Get warning flags
 if (NOT MSVC)
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
-  list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -Werror=return-type)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
+  list(APPEND LIBCXX_COMPILE_FLAGS -Werror=return-type)
 endif()
 
-append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
-append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
-append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
-append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
+append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_W_FLAG -W)
+append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
+append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
+append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
 if (LIBCXX_ENABLE_WERROR)
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WX_FLAG -WX)
 else()
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
 endif()
 if (LIBCXX_ENABLE_PEDANTIC)
-  append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
+  append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
 endif()
 
 # Get feature flags.
@@ -239,39 +174,39 @@
 if (LIBCXX_ENABLE_EXCEPTIONS)
   # Catches C++ exceptions only and tells the compiler to assume that extern C
   # functions never throw a C++ exception.
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
 else()
-  list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
+  list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
 endif()
 # RTTI
 if (NOT LIBCXX_ENABLE_RTTI)
-  list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
-  append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
+  list(APPEND LIBCXX_CXX_FLAGS -D_LIBCPP_NO_RTTI)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
+  append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
 endif()
 # Assert
 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
 if (LIBCXX_ENABLE_ASSERTIONS)
   # MSVC doesn't like _DEBUG on release builds. See PR 4379.
   if (NOT MSVC)
-    list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
+    list(APPEND LIBCXX_COMPILE_FLAGS -D_DEBUG)
   endif()
   # On Release builds cmake automatically defines NDEBUG, so we
   # explicitly undefine it:
   if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
-    list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
+    list(APPEND LIBCXX_COMPILE_FLAGS -UNDEBUG)
   endif()
 else()
   if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
-    list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
+    list(APPEND LIBCXX_COMPILE_FLAGS -DNDEBUG)
   endif()
 endif()
 # Static library
 if (NOT LIBCXX_ENABLE_SHARED)
-  list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
+  list(APPEND LIBCXX_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
 endif()
 
 # This is the _ONLY_ place where add_definitions is called.
@@ -279,14 +214,42 @@
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
 
-string(REPLACE ";" " " LIBCXX_CXX_REQUIRED_FLAGS "${LIBCXX_CXX_REQUIRED_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_REQUIRED_FLAGS}")
+# Configure for sanitizers. If LIBCXX_BUILT_STANDALONE then we have to do
+# the flag translation ourselves. Othewise LLVM's CMakeList.txt will handle it.
+if (LIBCXX_BUILT_STANDALONE)
+  # NOTE: LLVM_USE_SANITIZER checks for a UNIX like system instead of MSVC.
+  # But we don't have LLVM_ON_UNIX so checking for MSVC is the best we can do.
+  if (LLVM_USE_SANITIZER AND NOT MSVC)
+    append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG
+              "-fno-omit-frame-pointer")
+    if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" AND
+        NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
+      append_if(LIBCXX_CXX_FLAGS LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG
+                "-gline-tables-only")
+    endif()
+    if (LLVM_USE_SANITIZER STREQUAL "Address")
+      list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=address")
+    elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
+      list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=memory")
+      if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
+        list(APPEND LIBCXX_CXX_FLAGS "-fsanitize-memory-track-origins")
+      endif()
+    elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
+      list(APPEND LIBCXX_CXX_FLAGS
+          "-fsanitize=undefined -fno-sanitize=vptr,function -fno-sanitize-recover")
+    elseif (LLVM_USE_SANITIZER STREQUAL "Thread")
+      list(APPEND LIBCXX_CXX_FLAGS "-fsanitize=thread")
+    else()
+      message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
+    endif()
+  elseif(MSVC)
+    message(WARNING "LLVM_USE_SANITIZER is not supported with MSVC")
+  endif()
+endif()
 
-string(REPLACE ";" " " LIBCXX_CXX_WARNING_FLAGS "${LIBCXX_CXX_WARNING_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_WARNING_FLAGS}")
-
-string(REPLACE ";" " " LIBCXX_CXX_FEATURE_FLAGS "${LIBCXX_CXX_FEATURE_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_FEATURE_FLAGS}")
+string(REPLACE ";" " " LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS}")
+# @LOCALMOD reverse the order, so that we can override -std=...
+set(CMAKE_CXX_FLAGS "${LIBCXX_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
 
 #===============================================================================
 # Setup Source Code
diff --git a/CREDITS.TXT b/CREDITS.TXT
index 368b526..7a28ada 100644
--- a/CREDITS.TXT
+++ b/CREDITS.TXT
@@ -33,6 +33,10 @@
 E: marshall@idio.com
 D: C++14 support, patches and bug fixes.
 
+N: Eric Fiselier
+E: eric@efcs.ca
+D: LFTS support, patches and bug fixes.
+
 N: Bill Fisher
 E: william.w.fisher@gmail.com
 D: Regex bug fixes.
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
new file mode 100644
index 0000000..4d2a869
--- /dev/null
+++ b/cmake/Modules/HandleLibCXXABI.cmake
@@ -0,0 +1,98 @@
+
+#===============================================================================
+# Add an ABI library if appropriate
+#===============================================================================
+
+#
+# _setup_abi: Set up the build to use an ABI library
+#
+# Parameters:
+#   abidefines: A list of defines needed to compile libc++ with the ABI library
+#   abilib    : The ABI library to link against.
+#   abifiles  : A list of files (which may be relative paths) to copy into the
+#               libc++ build tree for the build.  These files will also be
+#               installed alongside the libc++ headers.
+#   abidirs   : A list of relative paths to create under an include directory
+#               in the libc++ build directory.
+#
+macro(setup_abi_lib abipathvar abidefines abilib abifiles abidirs)
+  list(APPEND LIBCXX_COMPILE_FLAGS ${abidefines})
+  set(${abipathvar} "${${abipathvar}}"
+    CACHE PATH
+    "Paths to C++ ABI header directories separated by ';'." FORCE
+    )
+
+  set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
+
+  set(LIBCXX_ABILIB_FILES ${abifiles})
+
+  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
+  foreach(_d ${abidirs})
+    file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
+  endforeach()
+
+  foreach(fpath ${LIBCXX_ABILIB_FILES})
+    set(found FALSE)
+    foreach(incpath ${${abipathvar}})
+      if (EXISTS "${incpath}/${fpath}")
+        set(found TRUE)
+        get_filename_component(dstdir ${fpath} PATH)
+        get_filename_component(ifile ${fpath} NAME)
+        file(COPY "${incpath}/${fpath}"
+          DESTINATION "${CMAKE_BINARY_DIR}/include/${dstdir}"
+          )
+        install(FILES "${CMAKE_BINARY_DIR}/include/${fpath}"
+          DESTINATION include/c++/v1/${dstdir}
+          PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+          )
+        list(APPEND abilib_headers "${CMAKE_BINARY_DIR}/include/${fpath}")
+      endif()
+    endforeach()
+    if (NOT found)
+      message(FATAL_ERROR "Failed to find ${fpath}")
+    endif()
+  endforeach()
+
+  add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers})
+  include_directories("${CMAKE_BINARY_DIR}/include")
+
+endmacro()
+
+if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
+    "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
+  set(_LIBSUPCXX_INCLUDE_FILES
+    cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
+    bits/cxxabi_tweaks.h bits/cxxabi_forced.h
+    )
+  if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
+    set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
+    set(_LIBSUPCXX_LIBNAME stdc++)
+  else()
+    set(_LIBSUPCXX_DEFINES "")
+    set(_LIBSUPCXX_LIBNAME supc++)
+  endif()
+  setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
+    "-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
+    "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
+    )
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
+  if (LIBCXX_CXX_ABI_INTREE)
+    # Link against just-built "cxxabi" target.
+    set(CXXABI_LIBNAME cxxabi)
+  else()
+    # Assume c++abi is installed in the system, rely on -lc++abi link flag.
+    set(CXXABI_LIBNAME "c++abi")
+  endif()
+  setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
+    ${CXXABI_LIBNAME} "cxxabi.h" ""
+    )
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
+  setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
+    "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
+    )
+elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
+  message(FATAL_ERROR
+    "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
+    "supported for c++ abi."
+    )
+endif ()
\ No newline at end of file
diff --git a/cmake/config-ix-pnacl.cmake b/cmake/config-ix-pnacl.cmake
index e8d6025..829cfcc 100644
--- a/cmake/config-ix-pnacl.cmake
+++ b/cmake/config-ix-pnacl.cmake
@@ -7,6 +7,7 @@
 #                  https://code.google.com/p/nativeclient/issues/detail?id=3661
 
 set(LIBCXX_HAS_STDCXX0X_FLAG 1)
+set(LIBCXX_HAS_STDCXX11_FLAG 1)
 set(LIBCXX_HAS_FPIC_FLAG 0) # Not quite true, but untested in PNaCl.
 set(LIBCXX_HAS_NODEFAULTLIBS_FLAG 1)
 set(LIBCXX_HAS_NOSTDINCXX_FLAG 1)
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index e8adafd..428d737 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -2,26 +2,29 @@
 include(CheckCXXCompilerFlag)
 
 # Check compiler flags
-check_cxx_compiler_flag(-std=c++0x            LIBCXX_HAS_STDCXX0X_FLAG)
-check_cxx_compiler_flag(-fPIC                 LIBCXX_HAS_FPIC_FLAG)
-check_cxx_compiler_flag(-nodefaultlibs        LIBCXX_HAS_NODEFAULTLIBS_FLAG)
-check_cxx_compiler_flag(-nostdinc++           LIBCXX_HAS_NOSTDINCXX_FLAG)
-check_cxx_compiler_flag(-Wall                 LIBCXX_HAS_WALL_FLAG)
-check_cxx_compiler_flag(-W                    LIBCXX_HAS_W_FLAG)
-check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
-check_cxx_compiler_flag(-Wwrite-strings       LIBCXX_HAS_WWRITE_STRINGS_FLAG)
-check_cxx_compiler_flag(-Wno-long-long        LIBCXX_HAS_WNO_LONG_LONG_FLAG)
-check_cxx_compiler_flag(-pedantic             LIBCXX_HAS_PEDANTIC_FLAG)
-check_cxx_compiler_flag(-Werror               LIBCXX_HAS_WERROR_FLAG)
-check_cxx_compiler_flag(-Wno-error            LIBCXX_HAS_WNO_ERROR_FLAG)
-check_cxx_compiler_flag(-fno-exceptions       LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
-check_cxx_compiler_flag(-fno-rtti             LIBCXX_HAS_FNO_RTTI_FLAG)
-check_cxx_compiler_flag(/WX                   LIBCXX_HAS_WX_FLAG)
-check_cxx_compiler_flag(/WX-                  LIBCXX_HAS_NO_WX_FLAG)
-check_cxx_compiler_flag(/EHsc                 LIBCXX_HAS_EHSC_FLAG)
-check_cxx_compiler_flag(/EHs-                 LIBCXX_HAS_NO_EHS_FLAG)
-check_cxx_compiler_flag(/EHa-                 LIBCXX_HAS_NO_EHA_FLAG)
-check_cxx_compiler_flag(/GR-                  LIBCXX_HAS_NO_GR_FLAG)
+check_cxx_compiler_flag(-std=c++11              LIBCXX_HAS_STDCXX11_FLAG)
+check_cxx_compiler_flag(-std=c++1y              LIBCXX_HAS_STDCXX1Y_FLAG)
+check_cxx_compiler_flag(-fPIC                   LIBCXX_HAS_FPIC_FLAG)
+check_cxx_compiler_flag(-fno-omit-frame-pointer LIBCXX_HAS_FNO_OMIT_FRAME_POINTER_FLAG)
+check_cxx_compiler_flag(-nodefaultlibs          LIBCXX_HAS_NODEFAULTLIBS_FLAG)
+check_cxx_compiler_flag(-nostdinc++             LIBCXX_HAS_NOSTDINCXX_FLAG)
+check_cxx_compiler_flag(-Wall                   LIBCXX_HAS_WALL_FLAG)
+check_cxx_compiler_flag(-W                      LIBCXX_HAS_W_FLAG)
+check_cxx_compiler_flag(-Wno-unused-parameter   LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
+check_cxx_compiler_flag(-Wwrite-strings         LIBCXX_HAS_WWRITE_STRINGS_FLAG)
+check_cxx_compiler_flag(-Wno-long-long          LIBCXX_HAS_WNO_LONG_LONG_FLAG)
+check_cxx_compiler_flag(-pedantic               LIBCXX_HAS_PEDANTIC_FLAG)
+check_cxx_compiler_flag(-Werror                 LIBCXX_HAS_WERROR_FLAG)
+check_cxx_compiler_flag(-Wno-error              LIBCXX_HAS_WNO_ERROR_FLAG)
+check_cxx_compiler_flag(-fno-exceptions         LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
+check_cxx_compiler_flag(-fno-rtti               LIBCXX_HAS_FNO_RTTI_FLAG)
+check_cxx_compiler_flag(-gline-tables-only      LIBCXX_HAS_GLINE_TABLES_ONLY_FLAG)
+check_cxx_compiler_flag(/WX                     LIBCXX_HAS_WX_FLAG)
+check_cxx_compiler_flag(/WX-                    LIBCXX_HAS_NO_WX_FLAG)
+check_cxx_compiler_flag(/EHsc                   LIBCXX_HAS_EHSC_FLAG)
+check_cxx_compiler_flag(/EHs-                   LIBCXX_HAS_NO_EHS_FLAG)
+check_cxx_compiler_flag(/EHa-                   LIBCXX_HAS_NO_EHA_FLAG)
+check_cxx_compiler_flag(/GR-                    LIBCXX_HAS_NO_GR_FLAG)
 
 # Check libraries
 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index bbf7ea4..df2cd34 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,13 +1,22 @@
 if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
 endif()
-
-install(DIRECTORY .
-  DESTINATION include/c++/v1
-  FILES_MATCHING
+set(LIBCXX_HEADER_PATTERN
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
   PATTERN ".svn" EXCLUDE
   ${LIBCXX_SUPPORT_HEADER_PATTERN}
+  )
+
+file(COPY .
+  DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
+  FILES_MATCHING
+  ${LIBCXX_HEADER_PATTERN}
+  )
+
+install(DIRECTORY .
+  DESTINATION include/c++/v1
+  FILES_MATCHING
+  ${LIBCXX_HEADER_PATTERN}
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   )
diff --git a/include/__config b/include/__config
index ce235af..6f57df5 100644
--- a/include/__config
+++ b/include/__config
@@ -19,6 +19,11 @@
 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
 #endif
 
+#if !_WIN32
+#include <unistd.h>
+#include <errno.h>  // for ELAST on FreeBSD
+#endif
+
 #define _LIBCPP_VERSION 1101
 
 #define _LIBCPP_ABI_VERSION 1
@@ -106,6 +111,13 @@
 # endif
 #endif // __sun__
 
+#if defined(__native_client__)
+  // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
+  // including accesses to the special files under /dev. C++11's
+  // std::random_device is instead exposed through a NaCl syscall.
+# define _LIBCPP_USING_NACL_RANDOM
+#endif // defined(__native_client__)
+
 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
 # include <endian.h>
 # if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -221,13 +233,9 @@
 #endif
 
 #if __cplusplus < 201103L
-#ifdef __linux__
-#define _LIBCPP_HAS_NO_UNICODE_CHARS
-#else
 typedef __char16_t char16_t;
 typedef __char32_t char32_t;
 #endif
-#endif
 
 #if !(__has_feature(cxx_exceptions))
 #define _LIBCPP_NO_EXCEPTIONS
@@ -608,7 +616,7 @@
 #endif
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE
-#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #endif
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE2
@@ -635,6 +643,25 @@
 #define _LIBCPP_WCTYPE_IS_MASK
 #endif
 
+#if defined(ELAST)
+#define _LIBCPP_ELAST ELAST
+#elif defined(__linux__)
+#define _LIBCPP_ELAST 4095
+// @LOCALMOD-START
+#elif defined(__native_client__)
+// NaCl doesn't have ELAST or __ELASTERROR
+// @LOCALMOD-END
+#elif defined(_NEWLIB_VERSION)
+#define _LIBCPP_ELAST __ELASTERROR
+#elif defined(__APPLE__)
+// Not _LIBCPP_ELAST needed on Apple
+#elif defined(__sun__)
+#define _LIBCPP_ELAST ESTALE
+#else
+// Warn here so that the person doing the libcxx port has an easier time:
+#warning This platform's ELAST hasn't been ported yet
+#endif
+
 #ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
 #  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
 #endif
@@ -678,8 +705,8 @@
 // g++ and cl.exe have RTTI on by default and define a macro when it is.
 // g++ only defines the macro in 4.3.2 and onwards.
 #if !defined(_LIBCPP_NO_RTTI)
-#  if defined(__GNUG__) && (__GNUC__ >= 4 && \
-   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
+#  if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
+   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
 #    define _LIBCPP_NO_RTTI
 #  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
 #    define _LIBCPP_NO_RTTI
diff --git a/include/__locale b/include/__locale
index c0a04a1..03f1b52 100644
--- a/include/__locale
+++ b/include/__locale
@@ -29,8 +29,17 @@
 # if __ANDROID_API__ <= 20
 #  include <support/android/locale_bionic.h>
 # endif
+#elif defined(__sun__)
+# include <support/solaris/xlocale.h>
+// @LOCALMOD-START
+#elif defined(_NEWLIB_VERSION)
+// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
+// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
+// has had a chance to bake for a bit.
+#include <support/newlib/xlocale.h>
+// @LOCALMOD-END
 #elif (defined(__GLIBC__) || defined(__APPLE__)      || defined(__FreeBSD__) \
-    || defined(__sun__)   || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
+    || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
 # include <xlocale.h>
 #endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
 
@@ -38,66 +47,6 @@
 #pragma GCC system_header
 #endif
 
-// @LOCALMOD-START Newlib doesn't have the following C extensions for
-//                 locales. This probably shouldn't rely on
-//                 _NEWLIB_VERSION: lack of locale_t support could
-//                 instead be detected at configuration time.
-#if defined(_NEWLIB_VERSION)
-typedef void *locale_t;
-extern "C" locale_t duplocale(locale_t);
-extern "C" void freelocale(locale_t);
-extern "C" locale_t newlocale(int, const char *, locale_t);
-extern "C" locale_t uselocale(locale_t);
-#define LC_COLLATE_MASK (1 << LC_COLLATE)
-#define LC_CTYPE_MASK (1 << LC_CTYPE)
-#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
-#define LC_MONETARY_MASK (1 << LC_MONETARY)
-#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
-#define LC_TIME_MASK (1 << LC_TIME)
-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
-                     LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
-#define isxdigit_l(a, L) (((void) L), isxdigit(a))
-#define iswxdigit_l(a, L) (((void) L), iswxdigit(a))
-#define isdigit_l(a, L) (((void) L), isdigit(a))
-#define iswdigit_l(a, L) (((void) L), iswdigit(a))
-#define iswcntrl_l(a, L) (((void) L), iswcntrl(a))
-#define iswcntrl_l(a, L) (((void) L), iswcntrl(a))
-#define isalpha_l(a, L) (((void) L), isalpha(a))
-#define iswalpha_l(a, L) (((void) L), iswalpha(a))
-#define ispunct_l(a, L) (((void) L), ispunct(a))
-#define iswpunct_l(a, L) (((void) L), iswpunct(a))
-#define isblank_l(a, L) (((void) L), isblank(a))
-#define iswblank_l(a, L) (((void) L), iswblank(a))
-#define isspace_l(a, L) (((void) L), isspace(a))
-#define iswspace_l(a, L) (((void) L), iswspace(a))
-#define isprint_l(a, L) (((void) L), isprint(a))
-#define iswprint_l(a, L) (((void) L), iswprint(a))
-#define islower_l(a, L) (((void) L), islower(a))
-#define iswlower_l(a, L) (((void) L), iswlower(a))
-#define isupper_l(a, L) (((void) L), isupper(a))
-#define iswupper_l(a, L) (((void) L), iswupper(a))
-#define tolower_l(a, L) (((void) L), tolower(a))
-#define towlower_l(a, L) (((void) L), towlower(a))
-#define toupper_l(a, L) (((void) L), toupper(a))
-#define towupper_l(a, L) (((void) L), towupper(a))
-#define strftime_l(a, b, c, d, L) (((void) L), strftime(a, b, c, d))
-#define strtoll_l(a, b, c, L) (((void) L), strtoll(a, b, c))
-#define strtoull_l(a, b, c, L) (((void) L), strtoull(a, b, c))
-#define strtold_l(a, b, L) (((void) L), strtold(a, b))
-#define strcoll_l(a, b, L) (((void) L), strcoll(a, b))
-#define wstrcoll_l(a, b, L) (((void) L), wstrcoll(a, b))
-#define cscoll_l(a, b, L) (((void) L), cscoll(a, b))
-#define wcscoll_l(a, b, L) (((void) L), wcscoll(a, b))
-#define strxfrm_l(a, b, c, L) (((void) L), strxfrm(a, b, c))
-#define wstrxfrm_l(a, b, c, L) (((void) L), wstrxfrm(a, b, c))
-#define csxfrm_l(a, b, c, L) (((void) L), csxfrm(a, b, c))
-#define wcsxfrm_l(a, b, c, L) (((void) L), wcsxfrm(a, b, c))
-#define sscanf_l(a, b, L, ...) (((void) L), sscanf(a, b, ##__VA_ARGS__))
-#define snprintf_l(a, b, L, c, ...) (((void) L), snprintf(a, b, c, ##__VA_ARGS__))
-#define asprintf_l(a, L, b, ...) (((void) L), asprintf(a, b, ##__VA_ARGS__))
-#endif
- // @LOCALMOD-END
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 class _LIBCPP_TYPE_VIS locale;
diff --git a/include/__mutex_base b/include/__mutex_base
index 293fead..d5ece7c 100644
--- a/include/__mutex_base
+++ b/include/__mutex_base
@@ -22,6 +22,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 class _LIBCPP_TYPE_VIS mutex
 {
     pthread_mutex_t __m_;
@@ -315,6 +317,7 @@
     void __do_timed_wait(unique_lock<mutex>& __lk,
        chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
 };
+#endif // !_LIBCPP_HAS_NO_THREADS
 
 template <class _To, class _Rep, class _Period>
 inline _LIBCPP_INLINE_VISIBILITY
@@ -332,6 +335,7 @@
     return __r;
 }
 
+#ifndef _LIBCPP_HAS_NO_THREADS
 template <class _Predicate>
 void
 condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
@@ -396,6 +400,8 @@
                       _VSTD::move(__pred));
 }
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP___MUTEX_BASE
diff --git a/include/__tuple b/include/__tuple
index ee5b916..bffb95c 100644
--- a/include/__tuple
+++ b/include/__tuple
@@ -245,19 +245,30 @@
 
 // __tuple_convertible
 
-template <bool, class _Tp, class _Up>
+template <class, class>
 struct __tuple_convertible_imp : public false_type {};
 
 template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
-struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+struct __tuple_convertible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
     : public integral_constant<bool,
                                is_convertible<_Tp0, _Up0>::value &&
-                               __tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+                               __tuple_convertible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
 
 template <>
-struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
+struct __tuple_convertible_imp<__tuple_types<>, __tuple_types<> >
     : public true_type {};
 
+template <bool, class, class>
+struct __tuple_convertible_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_convertible_apply<true, _Tp, _Up>
+  : public __tuple_convertible_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
 template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
                                 bool = __tuple_like<_Up>::value>
 struct __tuple_convertible
@@ -265,26 +276,36 @@
 
 template <class _Tp, class _Up>
 struct __tuple_convertible<_Tp, _Up, true, true>
-    : public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
-                                     tuple_size<_Up>::value,
-             typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
+    : public __tuple_convertible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                     tuple_size<_Up>::value, _Tp, _Up>
 {};
 
 // __tuple_constructible
 
-template <bool, class _Tp, class _Up>
+template <class, class>
 struct __tuple_constructible_imp : public false_type {};
 
 template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
-struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+struct __tuple_constructible_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
     : public integral_constant<bool,
                                is_constructible<_Up0, _Tp0>::value &&
-                               __tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+                               __tuple_constructible_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
 
 template <>
-struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
+struct __tuple_constructible_imp<__tuple_types<>, __tuple_types<> >
     : public true_type {};
 
+template <bool _SameSize, class, class>
+struct __tuple_constructible_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_constructible_apply<true, _Tp, _Up>
+  : public __tuple_constructible_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
 template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
                                 bool = __tuple_like<_Up>::value>
 struct __tuple_constructible
@@ -292,26 +313,36 @@
 
 template <class _Tp, class _Up>
 struct __tuple_constructible<_Tp, _Up, true, true>
-    : public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
-                                     tuple_size<_Up>::value,
-             typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
+    : public __tuple_constructible_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                     tuple_size<_Up>::value, _Tp, _Up>
 {};
 
 // __tuple_assignable
 
-template <bool, class _Tp, class _Up>
+template <class, class>
 struct __tuple_assignable_imp : public false_type {};
 
 template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
-struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
+struct __tuple_assignable_imp<__tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
     : public integral_constant<bool,
                                is_assignable<_Up0&, _Tp0>::value &&
-                               __tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
+                               __tuple_assignable_imp<__tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
 
 template <>
-struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
+struct __tuple_assignable_imp<__tuple_types<>, __tuple_types<> >
     : public true_type {};
 
+template <bool, class, class>
+struct __tuple_assignable_apply : public false_type {};
+
+template <class _Tp, class _Up>
+struct __tuple_assignable_apply<true, _Tp, _Up>
+  : __tuple_assignable_imp<
+      typename __make_tuple_types<_Tp>::type
+    , typename __make_tuple_types<_Up>::type
+    >
+{};
+
 template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
                                 bool = __tuple_like<_Up>::value>
 struct __tuple_assignable
@@ -319,9 +350,8 @@
 
 template <class _Tp, class _Up>
 struct __tuple_assignable<_Tp, _Up, true, true>
-    : public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
-                                    tuple_size<_Up>::value,
-             typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
+    : public __tuple_assignable_apply<tuple_size<typename remove_reference<_Tp>::type>::value ==
+                                    tuple_size<_Up>::value, _Tp, _Up>
 {};
 
 _LIBCPP_END_NAMESPACE_STD
diff --git a/include/algorithm b/include/algorithm
index 3ba104b..02cbc81 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -1140,7 +1140,7 @@
 mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
          _InputIterator2 __first2, _BinaryPredicate __pred)
 {
-    for (; __first1 != __last1; ++__first1, ++__first2)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             break;
     return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
@@ -1164,7 +1164,7 @@
          _InputIterator2 __first2, _InputIterator2 __last2,
          _BinaryPredicate __pred)
 {
-    for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             break;
     return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
@@ -1189,7 +1189,7 @@
 bool
 equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred)
 {
-    for (; __first1 != __last1; ++__first1, ++__first2)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             return false;
     return true;
@@ -1213,7 +1213,7 @@
         _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred,
         input_iterator_tag, input_iterator_tag )
 {
-    for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             return false;
     return __first1 == __last1 && __first2 == __last2;
@@ -1267,7 +1267,7 @@
                _ForwardIterator2 __first2, _BinaryPredicate __pred)
 {
     // shorten sequences as much as possible by lopping of any equal parts
-    for (; __first1 != __last1; ++__first1, ++__first2)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             goto __not_done;
     return true;
@@ -1327,7 +1327,7 @@
                  forward_iterator_tag, forward_iterator_tag )
 {
     // shorten sequences as much as possible by lopping of any equal parts
-    for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
+    for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2)
         if (!__pred(*__first1, *__first2))
             goto __not_done;
     return __first1 == __last1 && __first2 == __last2;
@@ -1745,7 +1745,7 @@
 _OutputIterator
 __copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 {
-    for (; __first != __last; ++__first, ++__result)
+    for (; __first != __last; ++__first, (void) ++__result)
         *__result = *__first;
     return __result;
 }
@@ -1874,7 +1874,7 @@
 _OutputIterator
 __move(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 {
-    for (; __first != __last; ++__first, ++__result)
+    for (; __first != __last; ++__first, (void) ++__result)
         *__result = _VSTD::move(*__first);
     return __result;
 }
@@ -1950,7 +1950,7 @@
 _OutputIterator
 transform(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _UnaryOperation __op)
 {
-    for (; __first != __last; ++__first, ++__result)
+    for (; __first != __last; ++__first, (void) ++__result)
         *__result = __op(*__first);
     return __result;
 }
@@ -1961,7 +1961,7 @@
 transform(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
           _OutputIterator __result, _BinaryOperation __binary_op)
 {
-    for (; __first1 != __last1; ++__first1, ++__first2, ++__result)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2, ++__result)
         *__result = __binary_op(*__first1, *__first2);
     return __result;
 }
@@ -1998,7 +1998,7 @@
 replace_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
              const _Tp& __old_value, const _Tp& __new_value)
 {
-    for (; __first != __last; ++__first, ++__result)
+    for (; __first != __last; ++__first, (void) ++__result)
         if (*__first == __old_value)
             *__result = __new_value;
         else
@@ -2014,7 +2014,7 @@
 replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
                 _Predicate __pred, const _Tp& __new_value)
 {
-    for (; __first != __last; ++__first, ++__result)
+    for (; __first != __last; ++__first, (void) ++__result)
         if (__pred(*__first))
             *__result = __new_value;
         else
@@ -2029,7 +2029,7 @@
 _OutputIterator
 __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
 {
-    for (; __n > 0; ++__first, --__n)
+    for (; __n > 0; ++__first, (void) --__n)
         *__first = __value_;
     return __first;
 }
@@ -2103,7 +2103,7 @@
 _OutputIterator
 generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
 {
-    for (; __n > 0; ++__first, --__n)
+    for (; __n > 0; ++__first, (void) --__n)
         *__first = __gen();
     return __first;
 }
@@ -4372,7 +4372,7 @@
     if (__len1 <= __len2)
     {
         value_type* __p = __buff;
-        for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), ++__i, ++__p)
+        for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)
             ::new(__p) value_type(_VSTD::move(*__i));
         __merge<_Compare>(move_iterator<value_type*>(__buff),
                           move_iterator<value_type*>(__p),
@@ -4383,7 +4383,7 @@
     else
     {
         value_type* __p = __buff;
-        for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), ++__i, ++__p)
+        for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)
             ::new(__p) value_type(_VSTD::move(*__i));
         typedef reverse_iterator<_BidirectionalIterator> _RBi;
         typedef reverse_iterator<value_type*> _Rv;
@@ -4408,7 +4408,7 @@
         if (__len2 == 0)
             return;
         // shrink [__first, __middle) as much as possible (with no moves), returning if it shrinks to 0
-        for (; true; ++__first, --__len1)
+        for (; true; ++__first, (void) --__len1)
         {
             if (__len1 == 0)
                 return;
@@ -5067,7 +5067,7 @@
     _RandomAccessIterator __r = __result_first;
     if (__r != __result_last)
     {
-        for (; __first != __last && __r != __result_last; ++__first, ++__r)
+        for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
             *__r = *__first;
         __make_heap<_Compare>(__result_first, __r, __comp);
         typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
@@ -5589,7 +5589,7 @@
 __lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
                           _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
 {
-    for (; __first2 != __last2; ++__first1, ++__first2)
+    for (; __first2 != __last2; ++__first1, (void) ++__first2)
     {
         if (__first1 == __last1 || __comp(*__first1, *__first2))
             return true;
diff --git a/include/atomic b/include/atomic
index eaf0d28..fe85609 100644
--- a/include/atomic
+++ b/include/atomic
@@ -533,6 +533,10 @@
 #pragma GCC system_header
 #endif
 
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <atomic> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if !__has_feature(cxx_atomic) && _GNUC_VER < 407
@@ -1791,4 +1795,6 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif  // !_LIBCPP_HAS_NO_THREADS
+
 #endif  // _LIBCPP_ATOMIC
diff --git a/include/chrono b/include/chrono
index 2c65eee..9229234 100644
--- a/include/chrono
+++ b/include/chrono
@@ -926,6 +926,7 @@
     static time_point from_time_t(time_t __t) _NOEXCEPT;
 };
 
+#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
 class _LIBCPP_TYPE_VIS steady_clock
 {
 public:
@@ -939,6 +940,9 @@
 };
 
 typedef steady_clock high_resolution_clock;
+#else
+typedef system_clock high_resolution_clock;
+#endif
 
 } // chrono
 
diff --git a/include/cmath b/include/cmath
index 4e1240e..bddae84 100644
--- a/include/cmath
+++ b/include/cmath
@@ -316,9 +316,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_signbit(_A1 __x) _NOEXCEPT
+__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
 {
-    return signbit(__x);
+    return signbit(__lcpp_x);
 }
 
 #undef signbit
@@ -326,9 +326,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-signbit(_A1 __x) _NOEXCEPT
+signbit(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
+    return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // signbit
@@ -340,9 +340,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 int
-__libcpp_fpclassify(_A1 __x) _NOEXCEPT
+__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
 {
-    return fpclassify(__x);
+    return fpclassify(__lcpp_x);
 }
 
 #undef fpclassify
@@ -350,9 +350,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
-fpclassify(_A1 __x) _NOEXCEPT
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
+    return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // fpclassify
@@ -364,9 +364,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isfinite(_A1 __x) _NOEXCEPT
+__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
 {
-    return isfinite(__x);
+    return isfinite(__lcpp_x);
 }
 
 #undef isfinite
@@ -374,9 +374,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isfinite(_A1 __x) _NOEXCEPT
+isfinite(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
+    return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // isfinite
@@ -388,9 +388,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isinf(_A1 __x) _NOEXCEPT
+__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
 {
-    return isinf(__x);
+    return isinf(__lcpp_x);
 }
 
 #undef isinf
@@ -398,9 +398,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isinf(_A1 __x) _NOEXCEPT
+isinf(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
+    return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // isinf
@@ -412,9 +412,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isnan(_A1 __x) _NOEXCEPT
+__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 {
-    return isnan(__x);
+    return isnan(__lcpp_x);
 }
 
 #undef isnan
@@ -422,9 +422,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isnan(_A1 __x) _NOEXCEPT
+isnan(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
+    return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // isnan
@@ -436,9 +436,9 @@
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isnormal(_A1 __x) _NOEXCEPT
+__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
 {
-    return isnormal(__x);
+    return isnormal(__lcpp_x);
 }
 
 #undef isnormal
@@ -446,9 +446,9 @@
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isnormal(_A1 __x) _NOEXCEPT
+isnormal(_A1 __lcpp_x) _NOEXCEPT
 {
-    return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
+    return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
 }
 
 #endif  // isnormal
@@ -460,9 +460,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return isgreater(__x, __y);
+    return isgreater(__lcpp_x, __lcpp_y);
 }
 
 #undef isgreater
@@ -475,10 +475,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-isgreater(_A1 __x, _A2 __y) _NOEXCEPT
+isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_isgreater((type)__x, (type)__y);
+    return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // isgreater
@@ -490,9 +490,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return isgreaterequal(__x, __y);
+    return isgreaterequal(__lcpp_x, __lcpp_y);
 }
 
 #undef isgreaterequal
@@ -505,10 +505,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
+isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_isgreaterequal((type)__x, (type)__y);
+    return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // isgreaterequal
@@ -520,9 +520,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return isless(__x, __y);
+    return isless(__lcpp_x, __lcpp_y);
 }
 
 #undef isless
@@ -535,10 +535,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-isless(_A1 __x, _A2 __y) _NOEXCEPT
+isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_isless((type)__x, (type)__y);
+    return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // isless
@@ -550,9 +550,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return islessequal(__x, __y);
+    return islessequal(__lcpp_x, __lcpp_y);
 }
 
 #undef islessequal
@@ -565,10 +565,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-islessequal(_A1 __x, _A2 __y) _NOEXCEPT
+islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_islessequal((type)__x, (type)__y);
+    return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // islessequal
@@ -580,9 +580,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return islessgreater(__x, __y);
+    return islessgreater(__lcpp_x, __lcpp_y);
 }
 
 #undef islessgreater
@@ -595,10 +595,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
+islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_islessgreater((type)__x, (type)__y);
+    return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // islessgreater
@@ -610,9 +610,9 @@
 template <class _A1, class _A2>
 _LIBCPP_ALWAYS_INLINE
 bool
-__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
+__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
-    return isunordered(__x, __y);
+    return isunordered(__lcpp_x, __lcpp_y);
 }
 
 #undef isunordered
@@ -625,10 +625,10 @@
     std::is_arithmetic<_A2>::value,
     bool
 >::type
-isunordered(_A1 __x, _A2 __y) _NOEXCEPT
+isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename std::__promote<_A1, _A2>::type type;
-    return __libcpp_isunordered((type)__x, (type)__y);
+    return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
 }
 
 #endif  // isunordered
@@ -657,15 +657,15 @@
 #if !defined(_AIX)
 inline _LIBCPP_INLINE_VISIBILITY
 float
-abs(float __x) _NOEXCEPT {return fabsf(__x);}
+abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 double
-abs(double __x) _NOEXCEPT {return fabs(__x);}
+abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
 
 inline _LIBCPP_INLINE_VISIBILITY
 long double
-abs(long double __x) _NOEXCEPT {return fabsl(__x);}
+abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
 #endif // !defined(_AIX)
 
 #ifndef __sun__
@@ -676,14 +676,14 @@
 using ::acosf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       acos(float __x) _NOEXCEPT       {return acosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
+acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
 
 // asin
 
@@ -691,14 +691,14 @@
 using ::asinf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       asin(float __x) _NOEXCEPT       {return asinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
+asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
 
 // atan
 
@@ -706,14 +706,14 @@
 using ::atanf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       atan(float __x) _NOEXCEPT       {return atanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
+atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
 
 // atan2
 
@@ -721,24 +721,24 @@
 using ::atan2f;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __y, float __x) _NOEXCEPT             {return atan2f(__y, __x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
+inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
 #endif
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-atan2(_A1 __y, _A2 __x) _NOEXCEPT
+atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return atan2((__result_type)__y, (__result_type)__x);
+    return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
 }
 
 // ceil
@@ -747,14 +747,14 @@
 using ::ceilf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __x) _NOEXCEPT       {return ceilf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXCEPT       {return ceilf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
+ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
 
 // cos
 
@@ -762,14 +762,14 @@
 using ::cosf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       cos(float __x) _NOEXCEPT       {return cosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return cosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
+cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
 
 // cosh
 
@@ -777,14 +777,14 @@
 using ::coshf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __x) _NOEXCEPT       {return coshf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __lcpp_x) _NOEXCEPT       {return coshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
+cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
 
 #endif // __sun__
 // exp
@@ -795,15 +795,15 @@
 #ifndef __sun__
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       exp(float __x) _NOEXCEPT       {return expf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       exp(float __lcpp_x) _NOEXCEPT       {return expf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
 #endif
 
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
+exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
 
 // fabs
 
@@ -811,14 +811,14 @@
 using ::fabsf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __x) _NOEXCEPT       {return fabsf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __lcpp_x) _NOEXCEPT       {return fabsf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
+fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
 
 // floor
 
@@ -826,14 +826,14 @@
 using ::floorf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       floor(float __x) _NOEXCEPT       {return floorf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       floor(float __lcpp_x) _NOEXCEPT       {return floorf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
+floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
 
 // fmod
 
@@ -843,24 +843,24 @@
 #ifndef __sun__
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __x, float __y) _NOEXCEPT             {return fmodf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmodf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
 #endif
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-fmod(_A1 __x, _A2 __y) _NOEXCEPT
+fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return fmod((__result_type)__x, (__result_type)__y);
+    return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 
@@ -870,14 +870,14 @@
 using ::frexpf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __x, int* __e) _NOEXCEPT       {return frexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT       {return frexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
+frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
 
 // ldexp
 
@@ -885,14 +885,14 @@
 using ::ldexpf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __x, int __e) _NOEXCEPT       {return ldexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT       {return ldexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
+ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
 
 // log
 
@@ -902,14 +902,14 @@
 #ifndef __sun__
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       log(float __x) _NOEXCEPT       {return logf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       log(float __lcpp_x) _NOEXCEPT       {return logf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-log(_A1 __x) _NOEXCEPT {return log((double)__x);}
+log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
 
 
 // log10
@@ -918,14 +918,14 @@
 using ::log10f;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       log10(float __x) _NOEXCEPT       {return log10f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       log10(float __lcpp_x) _NOEXCEPT       {return log10f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
+log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
 
 // modf
 
@@ -933,8 +933,8 @@
 using ::modff;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       modf(float __x, float* __y) _NOEXCEPT             {return modff(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT             {return modff(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
 #endif
 
 // pow
@@ -946,24 +946,24 @@
 #ifndef __sun__
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       pow(float __x, float __y) _NOEXCEPT             {return powf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
 #endif
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-pow(_A1 __x, _A2 __y) _NOEXCEPT
+pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return pow((__result_type)__x, (__result_type)__y);
+    return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // sin
@@ -972,14 +972,14 @@
 using ::sinf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       sin(float __x) _NOEXCEPT       {return sinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return sinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
+sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
 
 // sinh
 
@@ -987,14 +987,14 @@
 using ::sinhf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __x) _NOEXCEPT       {return sinhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __lcpp_x) _NOEXCEPT       {return sinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
+sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
 
 // sqrt
 
@@ -1004,14 +1004,14 @@
 
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __x) _NOEXCEPT       {return sqrtf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return sqrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
+sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
 
 // tan
 
@@ -1020,14 +1020,14 @@
 #ifndef __sun__
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       tan(float __x) _NOEXCEPT       {return tanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return tanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
+tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
 
 // tanh
 
@@ -1035,14 +1035,14 @@
 using ::tanhf;
 
 #if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __x) _NOEXCEPT       {return tanhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __lcpp_x) _NOEXCEPT       {return tanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
 #endif
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
+tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
 
 // acosh
 
@@ -1050,13 +1050,13 @@
 using ::acosh;
 using ::acoshf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __x) _NOEXCEPT       {return acoshf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __lcpp_x) _NOEXCEPT       {return acoshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
+acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
 #endif
 
 // asinh
@@ -1065,13 +1065,13 @@
 using ::asinh;
 using ::asinhf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __x) _NOEXCEPT       {return asinhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __lcpp_x) _NOEXCEPT       {return asinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
+asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
 #endif
 
 // atanh
@@ -1080,13 +1080,13 @@
 using ::atanh;
 using ::atanhf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __x) _NOEXCEPT       {return atanhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __lcpp_x) _NOEXCEPT       {return atanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
+atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
 #endif
 
 // cbrt
@@ -1095,13 +1095,13 @@
 using ::cbrt;
 using ::cbrtf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __x) _NOEXCEPT       {return cbrtf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __lcpp_x) _NOEXCEPT       {return cbrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
+cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
 #endif
 
 // copysign
@@ -1109,23 +1109,23 @@
 using ::copysign;
 using ::copysignf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       copysign(float __x, float __y) _NOEXCEPT             {return copysignf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return copysignf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return copysignl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-copysign(_A1 __x, _A2 __y) _NOEXCEPT
+copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return copysign((__result_type)__x, (__result_type)__y);
+    return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 #ifndef _LIBCPP_MSVCRT
@@ -1135,75 +1135,75 @@
 using ::erf;
 using ::erff;
 
-inline _LIBCPP_INLINE_VISIBILITY float       erf(float __x) _NOEXCEPT       {return erff(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       erf(float __lcpp_x) _NOEXCEPT       {return erff(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
+erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
 
 // erfc
 
 using ::erfc;
 using ::erfcf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __x) _NOEXCEPT       {return erfcf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __lcpp_x) _NOEXCEPT       {return erfcf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
+erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
 
 // exp2
 
 using ::exp2;
 using ::exp2f;
 
-inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __x) _NOEXCEPT       {return exp2f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __lcpp_x) _NOEXCEPT       {return exp2f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
+exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
 
 // expm1
 
 using ::expm1;
 using ::expm1f;
 
-inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __x) _NOEXCEPT       {return expm1f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __lcpp_x) _NOEXCEPT       {return expm1f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
+expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
 
 // fdim
 
 using ::fdim;
 using ::fdimf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __x, float __y) _NOEXCEPT             {return fdimf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fdimf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-fdim(_A1 __x, _A2 __y) _NOEXCEPT
+fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return fdim((__result_type)__x, (__result_type)__y);
+    return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // fma
@@ -1211,25 +1211,25 @@
 using ::fmaf;
 using ::fma;
 
-inline _LIBCPP_INLINE_VISIBILITY float       fma(float __x, float __y, float __z) _NOEXCEPT                   {return fmaf(__x, __y, __z);}
-inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY float       fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT                   {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
 
 template <class _A1, class _A2, class _A3>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value &&
     is_arithmetic<_A3>::value,
-    typename __promote<_A1, _A2, _A3>::type
+    __promote<_A1, _A2, _A3>
 >::type
-fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
+fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2, _A3>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value &&
                       is_same<_A3, __result_type>::value)), "");
-    return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
+    return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
 }
 
 // fmax
@@ -1237,23 +1237,23 @@
 using ::fmax;
 using ::fmaxf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __x, float __y) _NOEXCEPT             {return fmaxf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmaxf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-fmax(_A1 __x, _A2 __y) _NOEXCEPT
+fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return fmax((__result_type)__x, (__result_type)__y);
+    return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // fmin
@@ -1261,23 +1261,23 @@
 using ::fmin;
 using ::fminf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __x, float __y) _NOEXCEPT             {return fminf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fminf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-fmin(_A1 __x, _A2 __y) _NOEXCEPT
+fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return fmin((__result_type)__x, (__result_type)__y);
+    return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // hypot
@@ -1285,23 +1285,23 @@
 using ::hypot;
 using ::hypotf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __x, float __y) _NOEXCEPT             {return hypotf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return hypotf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-hypot(_A1 __x, _A2 __y) _NOEXCEPT
+hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return hypot((__result_type)__x, (__result_type)__y);
+    return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // ilogb
@@ -1309,27 +1309,27 @@
 using ::ilogb;
 using ::ilogbf;
 
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT       {return ilogbf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT       {return ilogbf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, int>::type
-ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
+ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
 
 // lgamma
 
 using ::lgamma;
 using ::lgammaf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __x) _NOEXCEPT       {return lgammaf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __lcpp_x) _NOEXCEPT       {return lgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
 
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
+lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
 
 
 // llrint
@@ -1337,99 +1337,99 @@
 using ::llrint;
 using ::llrintf;
 
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT       {return llrintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return llrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, long long>::type
-llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
+llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
 
 // llround
 
 using ::llround;
 using ::llroundf;
 
-inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT       {return llroundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT       {return llroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, long long>::type
-llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
+llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
 
 // log1p
 
 using ::log1p;
 using ::log1pf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __x) _NOEXCEPT       {return log1pf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __lcpp_x) _NOEXCEPT       {return log1pf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
+log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
 
 // log2
 
 using ::log2;
 using ::log2f;
 
-inline _LIBCPP_INLINE_VISIBILITY float       log2(float __x) _NOEXCEPT       {return log2f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return log2f(__lcpp_x);}
 #if defined(_NEWLIB_VERSION) // @LOCALMOD-START Missing from newlib. Note that PNaCl represents ``long double`` as ``double``, hence the intrinsic's type.
-inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return __builtin_log2(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return __builtin_log2(__lcpp_x);}
 #else
-inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
 #endif // @LOCALMOD-END
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
+log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
 
 // logb
 
 using ::logb;
 using ::logbf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       logb(float __x) _NOEXCEPT       {return logbf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       logb(float __lcpp_x) _NOEXCEPT       {return logbf(__lcpp_x);}
 #if defined(_NEWLIB_VERSION) // @LOCALMOD-START Missing from newlib. Note that PNaCl represents ``long double`` as ``double``, hence the intrinsic's type.
-inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return __builtin_logb(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return __builtin_logb(__lcpp_x);}
 #else
-inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
 #endif // @LOCALMOD-END
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
+logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
 
 // lrint
 
 using ::lrint;
 using ::lrintf;
 
-inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT       {return lrintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT       {return lrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, long>::type
-lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
+lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
 
 // lround
 
 using ::lround;
 using ::lroundf;
 
-inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT       {return lroundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT       {return lroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, long>::type
-lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
+lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
 
 #endif // _LIBCPP_MSVCRT
 #endif // __sun__
@@ -1449,82 +1449,82 @@
 using ::nearbyint;
 using ::nearbyintf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __x) _NOEXCEPT       {return nearbyintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __lcpp_x) _NOEXCEPT       {return nearbyintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
+nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
 
 // nextafter
 
 using ::nextafter;
 using ::nextafterf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __x, float __y) _NOEXCEPT             {return nextafterf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return nextafterf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-nextafter(_A1 __x, _A2 __y) _NOEXCEPT
+nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return nextafter((__result_type)__x, (__result_type)__y);
+    return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // nexttoward
 
 #if defined(_NEWLIB_VERSION) // @LOCALMOD-START Missing from newlib. Note that PNaCl represents ``long double`` as ``double``, hence the intrinsic's type.
-inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __x, long double __y) _NOEXCEPT       {return __builtin_nexttoward(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return __builtin_nexttoward(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT       {return __builtin_nexttoward(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return __builtin_nexttoward(__lcpp_x, __lcpp_y);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-nexttoward(_A1 __x, long double __y) _NOEXCEPT {return __builtin_nexttoward((double)__x, __y);}
+nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return __builtin_nexttoward((double)__lcpp_x, __lcpp_y);}
 #else
 using ::nexttoward;
 using ::nexttowardf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __x, long double __y) _NOEXCEPT       {return nexttowardf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT       {return nexttowardf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
+nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
 #endif // @LOCALMOD-END
 // remainder
 
 using ::remainder;
 using ::remainderf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __x, float __y) _NOEXCEPT             {return remainderf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return remainderf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-remainder(_A1 __x, _A2 __y) _NOEXCEPT
+remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return remainder((__result_type)__x, (__result_type)__y);
+    return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
 }
 
 // remquo
@@ -1532,23 +1532,23 @@
 using ::remquo;
 using ::remquof;
 
-inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __x, float __y, int* __z) _NOEXCEPT             {return remquof(__x, __y, __z);}
-inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT             {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
 
 template <class _A1, class _A2>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
 <
     is_arithmetic<_A1>::value &&
     is_arithmetic<_A2>::value,
-    typename __promote<_A1, _A2>::type
+    __promote<_A1, _A2>
 >::type
-remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
+remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
 {
     typedef typename __promote<_A1, _A2>::type __result_type;
     static_assert((!(is_same<_A1, __result_type>::value &&
                       is_same<_A2, __result_type>::value)), "");
-    return remquo((__result_type)__x, (__result_type)__y, __z);
+    return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
 }
 
 // rint
@@ -1556,78 +1556,78 @@
 using ::rint;
 using ::rintf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       rint(float __x) _NOEXCEPT       {return rintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       rint(float __lcpp_x) _NOEXCEPT       {return rintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
+rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
 
 // round
 
 using ::round;
 using ::roundf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       round(float __x) _NOEXCEPT       {return roundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       round(float __lcpp_x) _NOEXCEPT       {return roundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-round(_A1 __x) _NOEXCEPT {return round((double)__x);}
+round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
 
 // scalbln
 
 using ::scalbln;
 using ::scalblnf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __x, long __y) _NOEXCEPT       {return scalblnf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT       {return scalblnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
+scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
 
 // scalbn
 
 using ::scalbn;
 using ::scalbnf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __x, int __y) _NOEXCEPT       {return scalbnf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT       {return scalbnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
+scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
 
 // tgamma
 
 using ::tgamma;
 using ::tgammaf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __x) _NOEXCEPT       {return tgammaf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __lcpp_x) _NOEXCEPT       {return tgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
+tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
 
 // trunc
 
 using ::trunc;
 using ::truncf;
 
-inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __x) _NOEXCEPT       {return truncf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __lcpp_x) _NOEXCEPT       {return truncf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
 
 template <class _A1>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if<is_integral<_A1>::value, double>::type
-trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
+trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
 
 #endif // !_LIBCPP_MSVCRT
 
diff --git a/include/condition_variable b/include/condition_variable
index dc67266..1af2484 100644
--- a/include/condition_variable
+++ b/include/condition_variable
@@ -115,6 +115,8 @@
 #pragma GCC system_header
 #endif
 
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 class _LIBCPP_TYPE_VIS condition_variable_any
@@ -253,4 +255,6 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 #endif  // _LIBCPP_CONDITION_VARIABLE
diff --git a/include/deque b/include/deque
index 9b256b7..5602d4a 100644
--- a/include/deque
+++ b/include/deque
@@ -1588,7 +1588,7 @@
 {
     iterator __i = __base::begin();
     iterator __e = __base::end();
-    for (; __f != __l && __i != __e; ++__f, ++__i)
+    for (; __f != __l && __i != __e; ++__f, (void) ++__i)
         *__i = *__f;
     if (__f != __l)
         __append(__f, __l);
@@ -2160,7 +2160,7 @@
         if (__n > __de)
         {
             __m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
-            for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
+            for (_BiIter __j = __m; __j != __l; ++__i, (void) ++__j, ++__base::size())
                 __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
             __n = __de;
         }
@@ -2200,7 +2200,7 @@
     if (__n > __back_capacity)
         __add_back_capacity(__n - __back_capacity);
     // __n <= __back_capacity
-    for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
+    for (iterator __i = __base::end(); __f != __l; ++__i, (void) ++__f, ++__base::size())
         __alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
 }
 
diff --git a/include/experimental/optional b/include/experimental/optional
index 41d86b4..2f0df35 100644
--- a/include/experimental/optional
+++ b/include/experimental/optional
@@ -692,4 +692,4 @@
 
 #endif  // _LIBCPP_STD_VER > 11
 
-#endif  // _LIBCPP_ARRAY
+#endif  // _LIBCPP_OPTIONAL
diff --git a/include/experimental/string_view b/include/experimental/string_view
index b0382e5..d423f39 100644
--- a/include/experimental/string_view
+++ b/include/experimental/string_view
@@ -313,8 +313,7 @@
         _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
         void remove_prefix(size_type __n) _NOEXCEPT
         {
-            if (__n > __size)
-                __n = __size;
+            _LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()");
             __data += __n;
             __size -= __n;
         }
@@ -322,8 +321,7 @@
         _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
         void remove_suffix(size_type __n) _NOEXCEPT
         {
-            if (__n > __size)
-                __n = __size;
+            _LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()");
             __size -= __n;
         }
 
@@ -349,7 +347,8 @@
 
         template<class _Allocator = allocator<_CharT> >
         _LIBCPP_INLINE_VISIBILITY
-        basic_string<_CharT, _Traits, _Allocator> to_string( const _Allocator& __a = _Allocator())
+        basic_string<_CharT, _Traits, _Allocator>
+        to_string( const _Allocator& __a = _Allocator()) const
         { return basic_string<_CharT, _Traits, _Allocator> ( begin(), end(), __a ); }
 
         size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const
diff --git a/include/forward_list b/include/forward_list
index a83b195..651452f 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -991,7 +991,7 @@
     iterator __i = before_begin();
     iterator __j = _VSTD::next(__i);
     iterator __e = end();
-    for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
+    for (; __j != __e && __f != __l; ++__i, (void) ++__j, ++__f)
         *__j = *__f;
     if (__j == __e)
         insert_after(__i, __f, __l);
@@ -1201,7 +1201,7 @@
         try
         {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-            for (++__f; __f != __l; ++__f, __last = __last->__next_)
+            for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_)))
             {
                 __h.reset(__node_traits::allocate(__a, 1));
                 __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
@@ -1430,7 +1430,7 @@
             iterator __j = _VSTD::next(__i, 2);
             for (; __j != __e && *__j == __v; ++__j)
                 ;
-			__deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
+            __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j);
             if (__j == __e)
                 break;
             __i = __j;
diff --git a/include/future b/include/future
index de00f25..6fe6f8d 100644
--- a/include/future
+++ b/include/future
@@ -374,6 +374,10 @@
 #pragma GCC system_header
 #endif
 
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <future> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 //enum class future_errc
@@ -779,9 +783,12 @@
 {
     if (this->__state_ & base::__constructed)
         reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
-    typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
+    typedef allocator_traits<_A> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _A __a(__alloc_);
     this->~__assoc_state_alloc();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template <class _Rp, class _Alloc>
@@ -802,9 +809,12 @@
 void
 __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
 {
-    typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_state_alloc>::type _A;
+    typedef allocator_traits<_A> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _A __a(__alloc_);
     this->~__assoc_state_alloc();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template <class _Alloc>
@@ -825,9 +835,12 @@
 void
 __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
 {
-    typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_);
+    typedef typename __allocator_traits_rebind<_Alloc, __assoc_sub_state_alloc>::type _A;
+    typedef allocator_traits<_A> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _A __a(__alloc_);
     this->~__assoc_sub_state_alloc();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template <class _Rp, class _Fp>
@@ -1410,12 +1423,13 @@
 template <class _Alloc>
 promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
 {
-    typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp, _Alloc> >::other _A2;
+    typedef __assoc_state_alloc<_Rp, _Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
     typedef __allocator_destructor<_A2> _D2;
     _A2 __a(__a0);
-    unique_ptr<__assoc_state_alloc<_Rp, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
-    ::new(__hold.get()) __assoc_state_alloc<_Rp, _Alloc>(__a0);
-    __state_ = __hold.release();
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
 }
 
 template <class _Rp>
@@ -1583,12 +1597,13 @@
 template <class _Alloc>
 promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
 {
-    typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp&, _Alloc> >::other _A2;
+    typedef __assoc_state_alloc<_Rp&, _Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
     typedef __allocator_destructor<_A2> _D2;
     _A2 __a(__a0);
-    unique_ptr<__assoc_state_alloc<_Rp&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
-    ::new(__hold.get()) __assoc_state_alloc<_Rp&, _Alloc>(__a0);
-    __state_ = __hold.release();
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
 }
 
 template <class _Rp>
@@ -1719,12 +1734,13 @@
 template <class _Alloc>
 promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
 {
-    typedef typename _Alloc::template rebind<__assoc_sub_state_alloc<_Alloc> >::other _A2;
+    typedef __assoc_sub_state_alloc<_Alloc> _State;
+    typedef typename __allocator_traits_rebind<_Alloc, _State>::type _A2;
     typedef __allocator_destructor<_A2> _D2;
     _A2 __a(__a0);
-    unique_ptr<__assoc_sub_state_alloc<_Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
-    ::new(__hold.get()) __assoc_sub_state_alloc<_Alloc>(__a0);
-    __state_ = __hold.release();
+    unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
+    __state_ = _VSTD::addressof(*__hold.release());
 }
 
 template <class _Rp>
@@ -1804,10 +1820,12 @@
 void
 __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
 {
-    typedef typename _Alloc::template rebind<__packaged_task_func>::other _Ap;
+    typedef typename __allocator_traits_rebind<_Alloc, __packaged_task_func>::type _Ap;
+    typedef allocator_traits<_Ap> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
     _Ap __a(__f_.second());
     __f_.~__compressed_pair<_Fp, _Alloc>();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
@@ -1896,7 +1914,6 @@
                                   allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
     : __f_(nullptr)
 {
-    typedef allocator_traits<_Alloc> __alloc_traits;
     typedef typename remove_reference<typename decay<_Fp>::type>::type _FR;
     typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
     if (sizeof(_FF) <= sizeof(__buf_))
@@ -1906,18 +1923,13 @@
     }
     else
     {
-        typedef typename __alloc_traits::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
-            rebind_alloc<_FF>
-#else
-            rebind_alloc<_FF>::other
-#endif
-                                                     _Ap;
+        typedef typename __allocator_traits_rebind<_Alloc, _FF>::type _Ap;
         _Ap __a(__a0);
         typedef __allocator_destructor<_Ap> _Dp;
         unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
-        ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
-        __f_ = __hold.release();
+        ::new (static_cast<void*>(_VSTD::addressof(*__hold.get())))
+            _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
+        __f_ = _VSTD::addressof(*__hold.release());
     }
 }
 
@@ -2612,4 +2624,6 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 #endif  // _LIBCPP_FUTURE
diff --git a/include/ios b/include/ios
index d95f18a..ff79998 100644
--- a/include/ios
+++ b/include/ios
@@ -216,7 +216,7 @@
 #include <__locale>
 #include <system_error>
 
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 #include <atomic>     // for __xindex_
 #endif
 
@@ -367,7 +367,7 @@
     int*            __index_;
     size_t          __event_size_;
     size_t          __event_cap_;
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
     static atomic<int> __xindex_;
 #else
     static int      __xindex_;
diff --git a/include/istream b/include/istream
index 14fa466..168a4d0 100644
--- a/include/istream
+++ b/include/istream
@@ -82,6 +82,13 @@
     pos_type tellg();
     basic_istream& seekg(pos_type);
     basic_istream& seekg(off_type, ios_base::seekdir);
+protected:
+    basic_istream(const basic_istream& rhs) = delete;
+    basic_istream(basic_istream&& rhs);
+    // 27.7.2.1.2 Assign/swap:
+    basic_istream& operator=(const basic_istream& rhs) = delete;
+    basic_istream& operator=(basic_istream&& rhs);
+    void swap(basic_istream& rhs);
 };
 
 // 27.7.1.2.3 character extraction templates:
@@ -184,13 +191,22 @@
     _LIBCPP_INLINE_VISIBILITY
     basic_istream(basic_istream&& __rhs);
 #endif
-
     // 27.7.1.1.2 Assign/swap:
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     basic_istream& operator=(basic_istream&& __rhs);
 #endif
     void swap(basic_istream& __rhs);
+
+#if _LIBCPP_STD_VER > 11
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    basic_istream           (const basic_istream& __rhs) = delete;
+    basic_istream& operator=(const basic_istream& __rhs) = delete;
+#else
+    basic_istream           (const basic_istream& __rhs); // not defined
+    basic_istream& operator=(const basic_istream& __rhs); // not defined
+#endif
+#endif
 public:
 
     // 27.7.1.1.3 Prefix/suffix:
diff --git a/include/iterator b/include/iterator
index 88e615a..bcf142a 100644
--- a/include/iterator
+++ b/include/iterator
@@ -324,6 +324,17 @@
 template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c));      // C++14
 template <class C> auto crend(const C& c) -> decltype(std::rend(c));          // C++14
 
+// 24.8, container access:
+template <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
+template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
+template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
+template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
+template <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
+template <class C> constexpr auto data(C& c) -> decltype(c.data());               // C++17
+template <class C> constexpr auto data(const C& c) -> decltype(c.data());         // C++17
+template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;           // C++17
+template <class E> constexpr const E* data(initializer_list<E> il) noexcept;      // C++17
+
 }  // std
 
 */
@@ -1568,6 +1579,36 @@
 
 #endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
 
+#if _LIBCPP_STD_VER > 14
+template <class _C>
+constexpr auto size(const _C& __c) -> decltype(__c.size()) { return __c.size(); }
+
+template <class _Tp, size_t _N>
+constexpr size_t size(const _Tp (&__array)[_N]) noexcept { return _N; }
+
+template <class _C>
+constexpr auto empty(const _C& __c) -> decltype(__c.empty()) { return __c.empty(); }
+
+template <class _Tp, size_t _N>
+constexpr bool empty(const _Tp (&__array)[_N]) noexcept { return false; }
+
+template <class _Ep>
+constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; }
+
+template <class _C> constexpr
+auto data(_C& __c) -> decltype(__c.data()) { return __c.data(); }
+
+template <class _C> constexpr
+auto data(const _C& __c) -> decltype(__c.data()) { return __c.data(); }
+
+template <class _Tp, size_t _N>
+constexpr _Tp* data(_Tp (&__array)[_N]) noexcept { return __array; }
+
+template <class _Ep>
+constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
+#endif
+
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_ITERATOR
diff --git a/include/limits b/include/limits
index a5b1ae5..ce967ea 100644
--- a/include/limits
+++ b/include/limits
@@ -237,7 +237,7 @@
     static _LIBCPP_CONSTEXPR const bool is_bounded = true;
     static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value;
 
-#if __i386__ || __x86_64__ || defined(__pnacl__) // @LOCALMOD
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__)
     static _LIBCPP_CONSTEXPR const bool traps = true;
 #else
     static _LIBCPP_CONSTEXPR const bool traps = false;
diff --git a/include/locale b/include/locale
index 910daa8..0d01002 100644
--- a/include/locale
+++ b/include/locale
@@ -193,7 +193,12 @@
 #include <ctime>
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include <support/win32/locale_win32.h>
-#elif !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) // @LOCALMOD Not supported by newlib.
+#elif defined(_NEWLIB_VERSION)
+// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
+// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
+// has had a chance to bake for a bit
+#include <support/newlib/xlocale.h>
+#elif !defined(__ANDROID__)
 #include <nl_types.h>
 #endif
 
@@ -229,7 +234,8 @@
 // OSX has nice foo_l() functions that let you turn off use of the global
 // locale.  Linux, not so much.  The following functions avoid the locale when
 // that's possible and otherwise do the wrong thing.  FIXME.
-#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || defined(_NEWLIB_VERSION) // @LOCALMOD
+#if defined(__linux__) || defined(__EMSCRIPTEN__) || defined(_AIX) || \
+    defined(_NEWLIB_VERSION)
 
 #ifdef _LIBCPP_LOCALE__L_EXTENSIONS
 decltype(MB_CUR_MAX_L(_VSTD::declval<locale_t>()))
@@ -450,7 +456,7 @@
     size_t __n_does_match = 0;       // but none of them definitely do
     // Initialize all statuses to __might_match, except for "" keywords are __does_match
     unsigned char* __st = __status;
-    for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
+    for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
     {
         if (!__ky->empty())
             *__st = __might_match;
@@ -476,7 +482,7 @@
         // If the keyword doesn't match this character, then change the keyword
         //    to doesn't match
         __st = __status;
-        for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
+        for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
         {
             if (*__st == __might_match)
             {
@@ -510,7 +516,7 @@
             if (__n_might_match + __n_does_match > 1)
             {
                 __st = __status;
-                for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, ++__st)
+                for (_ForwardIterator __ky = __kb; __ky != __ke; ++__ky, (void) ++__st)
                 {
                     if (*__st == __does_match && __ky->size() != __indx+1)
                     {
@@ -525,7 +531,7 @@
     if (__b == __e)
         __err |= ios_base::eofbit;
     // Return the first matching result
-    for (__st = __status; __kb != __ke; ++__kb, ++__st)
+    for (__st = __status; __kb != __ke; ++__kb, (void) ++__st)
         if (*__st == __does_match)
             break;
     if (__kb == __ke)
@@ -1851,7 +1857,7 @@
         return 0;
     }
     int __r = __ct.narrow(__c, 0) - '0';
-    for (++__b, --__n; __b != __e && __n > 0; ++__b, --__n)
+    for (++__b, (void) --__n; __b != __e && __n > 0; ++__b, (void) --__n)
     {
         // get next digit
         __c = *__b;
@@ -2964,6 +2970,8 @@
     size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
     size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
                        2 * __cur_cap : numeric_limits<size_t>::max();
+    if (__new_cap == 0)
+        __new_cap = sizeof(_Tp);
     size_t __n_off = static_cast<size_t>(__n - __b.get());
     _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
     if (__t == 0)
@@ -3673,7 +3681,7 @@
 typename messages<_CharT>::catalog
 messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
 {
-#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION) // @LOCALMOD Not supported by newlib.
+#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
     return -1;
 #else // _WIN32 || __ANDROID__
     catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
@@ -3688,7 +3696,7 @@
 messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
                          const string_type& __dflt) const
 {
-#if defined(_WIN32) || defined(__ANDROID__)|| defined(_NEWLIB_VERSION) // @LOCALMOD Not supported by newlib.
+#if defined(_WIN32) || defined(__ANDROID__) || defined(_NEWLIB_VERSION)
     return __dflt;
 #else // _WIN32
     string __ndflt;
@@ -3710,7 +3718,7 @@
 void
 messages<_CharT>::do_close(catalog __c) const
 {
-#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) // @LOCALMOD Not supported by newlib.
+#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
     if (__c != -1)
         __c <<= 1;
     nl_catd __cat = (nl_catd)__c;
diff --git a/include/map b/include/map
index 5534e40..5c3969a 100644
--- a/include/map
+++ b/include/map
@@ -159,7 +159,7 @@
     template<typename K>
         const_iterator find(const K& x) const;  // C++14
     template<typename K>
-      size_type count(const K& x) const;
+      size_type count(const K& x) const;        // C++14
 
     size_type      count(const key_type& k) const;
           iterator lower_bound(const key_type& k);
@@ -353,7 +353,7 @@
     template<typename K>
         const_iterator find(const K& x) const;  // C++14
     template<typename K>
-      size_type count(const K& x) const;
+      size_type count(const K& x) const;        // C++14
 
     size_type      count(const key_type& k) const;
           iterator lower_bound(const key_type& k);
@@ -1104,6 +1104,12 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type      count(const key_type& __k) const
         {return __tree_.__count_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                  {return __tree_.__count_unique(__k);}
+#endif
     _LIBCPP_INLINE_VISIBILITY
     iterator lower_bound(const key_type& __k)
         {return __tree_.lower_bound(__k);}
@@ -1834,6 +1840,12 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type      count(const key_type& __k) const
         {return __tree_.__count_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                   {return __tree_.__count_multi(__k);}
+#endif
     _LIBCPP_INLINE_VISIBILITY
     iterator lower_bound(const key_type& __k)
         {return __tree_.lower_bound(__k);}
diff --git a/include/memory b/include/memory
index dc9aeba..662faa0 100644
--- a/include/memory
+++ b/include/memory
@@ -610,7 +610,7 @@
     #include <cassert>
 #endif
 
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 #  include <atomic>
 #endif
 
@@ -1450,7 +1450,7 @@
     template <class _Tp, class... _Args>
         _LIBCPP_INLINE_VISIBILITY
         static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
-            {__construct(__has_construct<allocator_type, pointer, _Args...>(),
+            {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
                          __a, __p, _VSTD::forward<_Args>(__args)...);}
 #else  // _LIBCPP_HAS_NO_VARIADICS
     template <class _Tp>
@@ -3660,7 +3660,7 @@
 const void*
 __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
 {
-    return __t == typeid(_Dp) ? &__data_.first().second() : 0;
+    return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0;
 }
 
 #endif  // _LIBCPP_NO_RTTI
@@ -3677,9 +3677,13 @@
 void
 __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
 {
-    typename _Alloc::template rebind<__shared_ptr_pointer>::other __a(__data_.second());
+    typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _A;
+    typedef allocator_traits<_A> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+
+    _A __a(__data_.second());
     __data_.second().~_Alloc();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template <class _Tp, class _Alloc>
@@ -3742,9 +3746,12 @@
 void
 __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
 {
-    typename _Alloc::template rebind<__shared_ptr_emplace>::other __a(__data_.first());
+    typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _A;
+    typedef allocator_traits<_A> _ATraits;
+    typedef pointer_traits<typename _ATraits::pointer> _PTraits;
+    _A __a(__data_.first());
     __data_.first().~_Alloc();
-    __a.deallocate(this, 1);
+    __a.deallocate(_PTraits::pointer_to(*this), 1);
 }
 
 template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this;
@@ -4090,12 +4097,13 @@
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
         typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
-        typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
+        typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
         typedef __allocator_destructor<_A2> _D2;
         _A2 __a2(__a);
         unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
-        ::new(__hold2.get()) _CntrlBlk(__p, __d, __a);
-        __cntrl_ = __hold2.release();
+        ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+            _CntrlBlk(__p, __d, __a);
+        __cntrl_ = _VSTD::addressof(*__hold2.release());
         __enable_weak_this(__p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
@@ -4117,12 +4125,13 @@
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
         typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
-        typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
+        typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
         typedef __allocator_destructor<_A2> _D2;
         _A2 __a2(__a);
         unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
-        ::new(__hold2.get()) _CntrlBlk(__p, __d, __a);
-        __cntrl_ = __hold2.release();
+        ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+            _CntrlBlk(__p, __d, __a);
+        __cntrl_ = _VSTD::addressof(*__hold2.release());
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
@@ -4282,14 +4291,15 @@
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
 {
     typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
-    typedef typename _Alloc::template rebind<_CntrlBlk>::other _A2;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
     typedef __allocator_destructor<_A2> _D2;
     _A2 __a2(__a);
     unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
-    __r.__cntrl_ = __hold2.release();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
     __r.__enable_weak_this(__r.__ptr_);
     return __r;
 }
@@ -4373,14 +4383,15 @@
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)
 {
     typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
-    typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2(__a);
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a);
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
-    __r.__cntrl_ = __hold2.release();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
     __r.__enable_weak_this(__r.__ptr_);
     return __r;
 }
@@ -4391,14 +4402,15 @@
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)
 {
     typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
-    typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2(__a);
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a, __a0);
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
-    __r.__cntrl_ = __hold2.release();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
     __r.__enable_weak_this(__r.__ptr_);
     return __r;
 }
@@ -4409,14 +4421,15 @@
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)
 {
     typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
-    typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2(__a);
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a, __a0, __a1);
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0, __a1);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
-    __r.__cntrl_ = __hold2.release();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
     __r.__enable_weak_this(__r.__ptr_);
     return __r;
 }
@@ -4427,14 +4440,15 @@
 shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)
 {
     typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;
-    typedef typename _Alloc::template rebind<_CntrlBlk>::other _Alloc2;
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2(__a);
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a, __a0, __a1, __a2);
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))
+        _CntrlBlk(__a, __a0, __a1, __a2);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
-    __r.__cntrl_ = __hold2.release();
+    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());
     __r.__enable_weak_this(__r.__ptr_);
     return __r;
 }
@@ -5262,7 +5276,7 @@
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
 
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 
 class _LIBCPP_TYPE_VIS __sp_mut
 {
@@ -5388,7 +5402,7 @@
     return atomic_compare_exchange_weak(__p, __v, __w);
 }
 
-#endif  // __has_feature(cxx_atomic)
+#endif  // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 
 //enum class
 struct _LIBCPP_TYPE_VIS pointer_safety
diff --git a/include/module.modulemap b/include/module.modulemap
index a0f4254..6aeb23f 100644
--- a/include/module.modulemap
+++ b/include/module.modulemap
@@ -16,6 +16,7 @@
   module atomic {
     header "atomic"
     export *
+    requires cplusplus11
   }
   module bitset {
     header "bitset"
diff --git a/include/mutex b/include/mutex
index 5dfba63..9c26356 100644
--- a/include/mutex
+++ b/include/mutex
@@ -187,6 +187,8 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 class _LIBCPP_TYPE_VIS recursive_mutex
 {
     pthread_mutex_t __m_;
@@ -425,6 +427,8 @@
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 struct _LIBCPP_TYPE_VIS_ONLY once_flag;
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
diff --git a/include/numeric b/include/numeric
index e520c8e..21c3781 100644
--- a/include/numeric
+++ b/include/numeric
@@ -91,7 +91,7 @@
 _Tp
 inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
 {
-    for (; __first1 != __last1; ++__first1, ++__first2)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
         __init = __init + *__first1 * *__first2;
     return __init;
 }
@@ -102,7 +102,7 @@
 inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
               _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
 {
-    for (; __first1 != __last1; ++__first1, ++__first2)
+    for (; __first1 != __last1; ++__first1, (void) ++__first2)
         __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
     return __init;
 }
@@ -116,7 +116,7 @@
     {
         typename iterator_traits<_InputIterator>::value_type __t(*__first);
         *__result = __t;
-        for (++__first, ++__result; __first != __last; ++__first, ++__result)
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
         {
             __t = __t + *__first;
             *__result = __t;
@@ -135,7 +135,7 @@
     {
         typename iterator_traits<_InputIterator>::value_type __t(*__first);
         *__result = __t;
-        for (++__first, ++__result; __first != __last; ++__first, ++__result)
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
         {
             __t = __binary_op(__t, *__first);
             *__result = __t;
@@ -153,7 +153,7 @@
     {
         typename iterator_traits<_InputIterator>::value_type __t1(*__first);
         *__result = __t1;
-        for (++__first, ++__result; __first != __last; ++__first, ++__result)
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
         {
             typename iterator_traits<_InputIterator>::value_type __t2(*__first);
             *__result = __t2 - __t1;
@@ -173,7 +173,7 @@
     {
         typename iterator_traits<_InputIterator>::value_type __t1(*__first);
         *__result = __t1;
-        for (++__first, ++__result; __first != __last; ++__first, ++__result)
+        for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
         {
             typename iterator_traits<_InputIterator>::value_type __t2(*__first);
             *__result = __binary_op(__t2, __t1);
@@ -188,7 +188,7 @@
 void
 iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
 {
-    for (; __first != __last; ++__first, ++__value_)
+    for (; __first != __last; ++__first, (void) ++__value_)
         *__first = __value_;
 }
 
diff --git a/include/ostream b/include/ostream
index 9d96fd8..a7af299 100644
--- a/include/ostream
+++ b/include/ostream
@@ -67,6 +67,13 @@
     pos_type tellp();
     basic_ostream& seekp(pos_type);
     basic_ostream& seekp(off_type, ios_base::seekdir);
+protected:
+    basic_ostream(const basic_ostream& rhs) = delete;
+    basic_ostream(basic_ostream&& rhs);
+    // 27.7.3.3 Assign/swap
+    basic_ostream& operator=(basic_ostream& rhs) = delete;
+    basic_ostream& operator=(const basic_ostream&& rhs);
+    void swap(basic_ostream& rhs);
 };
 
 // 27.7.2.6.4 character inserters
@@ -162,14 +169,19 @@
 #endif
 
     // 27.7.2.3 Assign/swap
-#if _LIBCPP_STD_VER > 11
-    basic_ostream& operator=(const basic_ostream&) = delete;
-#endif
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     basic_ostream& operator=(basic_ostream&& __rhs);
 #endif
     void swap(basic_ostream& __rhs);
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+    basic_ostream           (const basic_ostream& __rhs) = delete;
+    basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+#else
+    basic_ostream           (const basic_ostream& __rhs); // not defined
+    basic_ostream& operator=(const basic_ostream& __rhs); // not defined
+#endif
 public:
 
     // 27.7.2.4 Prefix/suffix:
diff --git a/include/random b/include/random
index c0db1ab..a8d21a2 100644
--- a/include/random
+++ b/include/random
@@ -3475,9 +3475,9 @@
 
 class _LIBCPP_TYPE_VIS random_device
 {
-#if !defined(_WIN32)
+#if !(defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM))
     int __f_;
-#endif // defined(_WIN32)
+#endif // !(defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM))
 public:
     // types
     typedef unsigned result_type;
@@ -4009,6 +4009,8 @@
     }
 }
 
+// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
+//           variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
 template<class _IntType>
 template<class _URNG>
 _IntType
@@ -4035,7 +4037,8 @@
             if (__u < 0)
                 return __rd - 1;
         }
-        --__rd;
+        if ( __rd != 0 )
+            --__rd;
         ++__ru;
         if (__ru <= __pr.__t_)
         {
diff --git a/include/set b/include/set
index b9e776d..22d794d 100644
--- a/include/set
+++ b/include/set
@@ -663,6 +663,12 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type      count(const key_type& __k) const
         {return __tree_.__count_unique(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                  {return __tree_.__count_unique(__k);}
+#endif
     _LIBCPP_INLINE_VISIBILITY
     iterator lower_bound(const key_type& __k)
         {return __tree_.lower_bound(__k);}
@@ -1066,6 +1072,12 @@
     _LIBCPP_INLINE_VISIBILITY
     size_type      count(const key_type& __k) const
         {return __tree_.__count_multi(__k);}
+#if _LIBCPP_STD_VER > 11
+    template <typename _K2>
+    _LIBCPP_INLINE_VISIBILITY
+    typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
+    count(const _K2& __k)                  {return __tree_.__count_multi(__k);}
+#endif
 
     _LIBCPP_INLINE_VISIBILITY
     iterator lower_bound(const key_type& __k)
diff --git a/include/shared_mutex b/include/shared_mutex
index 7661054..9b7f0bf 100644
--- a/include/shared_mutex
+++ b/include/shared_mutex
@@ -112,6 +112,10 @@
 #pragma GCC system_header
 #endif
 
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <shared_mutex> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 class _LIBCPP_TYPE_VIS shared_timed_mutex
@@ -232,7 +236,7 @@
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-    shared_lock() noexcept
+    shared_lock() _NOEXCEPT
         : __m_(nullptr),
           __owns_(false)
         {}
@@ -244,7 +248,7 @@
         {__m_->lock_shared();}
 
     _LIBCPP_INLINE_VISIBILITY
-    shared_lock(mutex_type& __m, defer_lock_t) noexcept
+    shared_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
         : __m_(&__m),
           __owns_(false)
         {}
@@ -288,7 +292,7 @@
     shared_lock& operator=(shared_lock const&) = delete;
 
     _LIBCPP_INLINE_VISIBILITY
-    shared_lock(shared_lock&& __u) noexcept
+    shared_lock(shared_lock&& __u) _NOEXCEPT
         : __m_(__u.__m_),
           __owns_(__u.__owns_)
         {
@@ -297,7 +301,7 @@
         }
 
     _LIBCPP_INLINE_VISIBILITY
-    shared_lock& operator=(shared_lock&& __u) noexcept
+    shared_lock& operator=(shared_lock&& __u) _NOEXCEPT
     {
         if (__owns_)
             __m_->unlock_shared();
@@ -320,14 +324,14 @@
 
     // Setters
     _LIBCPP_INLINE_VISIBILITY
-    void swap(shared_lock& __u) noexcept
+    void swap(shared_lock& __u) _NOEXCEPT
     {
         _VSTD::swap(__m_, __u.__m_);
         _VSTD::swap(__owns_, __u.__owns_);
     }
 
     _LIBCPP_INLINE_VISIBILITY
-    mutex_type* release() noexcept
+    mutex_type* release() _NOEXCEPT
     {
         mutex_type* __m = __m_;
         __m_ = nullptr;
@@ -337,13 +341,13 @@
 
     // Getters
     _LIBCPP_INLINE_VISIBILITY
-    bool owns_lock() const noexcept {return __owns_;}
+    bool owns_lock() const _NOEXCEPT {return __owns_;}
 
     _LIBCPP_INLINE_VISIBILITY
-    explicit operator bool () const noexcept {return __owns_;}
+    explicit operator bool () const _NOEXCEPT {return __owns_;}
 
     _LIBCPP_INLINE_VISIBILITY
-    mutex_type* mutex() const noexcept {return __m_;}
+    mutex_type* mutex() const _NOEXCEPT {return __m_;}
 };
 
 template <class _Mutex>
@@ -409,11 +413,13 @@
 template <class _Mutex>
 inline _LIBCPP_INLINE_VISIBILITY
 void
-swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept
+swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT
     {__x.swap(__y);}
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif  // !_LIBCPP_HAS_NO_THREADS
+
 #endif  // _LIBCPP_STD_VER > 11
 
 #endif  // _LIBCPP_SHARED_MUTEX
diff --git a/include/sstream b/include/sstream
index f90d446..27ae78f 100644
--- a/include/sstream
+++ b/include/sstream
@@ -325,11 +325,16 @@
     __p = const_cast<char_type*>(__str_.data());
     if (__binp != -1)
         this->setg(__p + __binp, __p + __ninp, __p + __einp);
+    else
+        this->setg(nullptr, nullptr, nullptr);
     if (__bout != -1)
     {
         this->setp(__p + __bout, __p + __eout);
         this->pbump(__nout);
     }
+    else
+        this->setp(nullptr, nullptr);
+
     __hm_ = __hm == -1 ? nullptr : __p + __hm;
     __mode_ = __rhs.__mode_;
     __p = const_cast<char_type*>(__rhs.__str_.data());
diff --git a/include/string b/include/string
index fe72e9d..fe42bbf 100644
--- a/include/string
+++ b/include/string
@@ -509,14 +509,11 @@
     typedef streampos pos_type;
     typedef mbstate_t state_type;
 
-    _LIBCPP_INLINE_VISIBILITY
-    static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
         {__c1 = __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 < __c2;}
 
     static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -526,20 +523,15 @@
     static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
     static char_type*       assign(char_type* __s, size_t __n, char_type __a);
 
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
         {return char_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  to_int_type(char_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  to_int_type(char_type __c) _NOEXCEPT
         {return int_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool      eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool      eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
         {return int_type(EOF);}
 };
 
@@ -636,51 +628,37 @@
     typedef streampos pos_type;
     typedef mbstate_t state_type;
 
-    _LIBCPP_INLINE_VISIBILITY
-    static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
         {__c1 = __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
             {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
         {return (unsigned char)__c1 < (unsigned char)__c2;}
 
-    _LIBCPP_INLINE_VISIBILITY
-    static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
+    static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
         {return memcmp(__s1, __s2, __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static size_t length(const char_type* __s) {return strlen(__s);}
-    _LIBCPP_INLINE_VISIBILITY
-    static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
+    static inline size_t length(const char_type* __s) {return strlen(__s);}
+    static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
         {return (const char_type*)memchr(__s, to_int_type(__a), __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
+    static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
         {return (char_type*)memmove(__s1, __s2, __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
         {
             _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
             return (char_type*)memcpy(__s1, __s2, __n);
         }
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* assign(char_type* __s, size_t __n, char_type __a)
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
         {return (char_type*)memset(__s, to_int_type(__a), __n);}
 
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
         {return char_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
         {return int_type((unsigned char)__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  eof() _NOEXCEPT
         {return int_type(EOF);}
 };
 
@@ -695,52 +673,38 @@
     typedef streampos pos_type;
     typedef mbstate_t state_type;
 
-    _LIBCPP_INLINE_VISIBILITY
-    static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
         {__c1 = __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 < __c2;}
 
-    _LIBCPP_INLINE_VISIBILITY
-    static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
+    static inline int compare(const char_type* __s1, const char_type* __s2, size_t __n)
         {return wmemcmp(__s1, __s2, __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static size_t length(const char_type* __s)
+    static inline size_t length(const char_type* __s)
         {return wcslen(__s);}
-    _LIBCPP_INLINE_VISIBILITY
-    static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
+    static inline const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
         {return (const char_type*)wmemchr(__s, __a, __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
+    static inline char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
         {return (char_type*)wmemmove(__s1, __s2, __n);}
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
+    static inline char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
         {
             _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
             return (char_type*)wmemcpy(__s1, __s2, __n);
         }
-    _LIBCPP_INLINE_VISIBILITY
-    static char_type* assign(char_type* __s, size_t __n, char_type __a)
+    static inline char_type* assign(char_type* __s, size_t __n, char_type __a)
         {return (char_type*)wmemset(__s, __a, __n);}
 
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
         {return char_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
         {return int_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
         {return int_type(WEOF);}
 };
 
@@ -755,14 +719,11 @@
     typedef u16streampos   pos_type;
     typedef mbstate_t      state_type;
 
-    _LIBCPP_INLINE_VISIBILITY
-    static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
         {__c1 = __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 < __c2;}
 
     static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -772,20 +733,15 @@
     static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
     static char_type*       assign(char_type* __s, size_t __n, char_type __a);
 
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
         {return char_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
         {return int_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
         {return int_type(0xDFFF);}
 };
 
@@ -876,14 +832,11 @@
     typedef u32streampos   pos_type;
     typedef mbstate_t      state_type;
 
-    _LIBCPP_INLINE_VISIBILITY
-    static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
+    static inline void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
         {__c1 = __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
         {return __c1 < __c2;}
 
     static int              compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -893,20 +846,15 @@
     static char_type*       copy(char_type* __s1, const char_type* __s2, size_t __n);
     static char_type*       assign(char_type* __s, size_t __n, char_type __a);
 
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type  not_eof(int_type __c) _NOEXCEPT
         {return eq_int_type(__c, eof()) ? ~eof() : __c;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
         {return char_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
         {return int_type(__c);}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
         {return __c1 == __c2;}
-    _LIBCPP_INLINE_VISIBILITY
-    static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
+    static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
         {return int_type(0xFFFFFFFF);}
 };
 
@@ -2267,7 +2215,7 @@
         __set_long_cap(__cap+1);
         __set_long_size(__sz);
     }
-    for (; __first != __last; ++__first, ++__p)
+    for (; __first != __last; ++__first, (void) ++__p)
         traits_type::assign(*__p, *__first);
     traits_type::assign(*__p, value_type());
 }
diff --git a/include/support/android/locale_bionic.h b/include/support/android/locale_bionic.h
index 354fcfe..3a020da 100644
--- a/include/support/android/locale_bionic.h
+++ b/include/support/android/locale_bionic.h
@@ -20,173 +20,12 @@
 #include <stdlib.h>
 #include <xlocale.h>
 
-static inline int isalnum_l(int c, locale_t) {
-  return isalnum(c);
-}
-
-static inline int isalpha_l(int c, locale_t) {
-  return isalpha(c);
-}
-
-static inline int isblank_l(int c, locale_t) {
-  return isblank(c);
-}
-
-static inline int iscntrl_l(int c, locale_t) {
-  return iscntrl(c);
-}
-
-static inline int isdigit_l(int c, locale_t) {
-  return isdigit(c);
-}
-
-static inline int isgraph_l(int c, locale_t) {
-  return isgraph(c);
-}
-
-static inline int islower_l(int c, locale_t) {
-  return islower(c);
-}
-
-static inline int isprint_l(int c, locale_t) {
-  return isprint(c);
-}
-
-static inline int ispunct_l(int c, locale_t) {
-  return ispunct(c);
-}
-
-static inline int isspace_l(int c, locale_t) {
-  return isspace(c);
-}
-
-static inline int isupper_l(int c, locale_t) {
-  return isupper(c);
-}
-
-static inline int isxdigit_l(int c, locale_t) {
-  return isxdigit(c);
-}
-
-static inline int iswalnum_l(wint_t c, locale_t) {
-  return iswalnum(c);
-}
-
-static inline int iswalpha_l(wint_t c, locale_t) {
-  return iswalpha(c);
-}
-
-static inline int iswblank_l(wint_t c, locale_t) {
-  return iswblank(c);
-}
-
-static inline int iswcntrl_l(wint_t c, locale_t) {
-  return iswcntrl(c);
-}
-
-static inline int iswdigit_l(wint_t c, locale_t) {
-  return iswdigit(c);
-}
-
-static inline int iswgraph_l(wint_t c, locale_t) {
-  return iswgraph(c);
-}
-
-static inline int iswlower_l(wint_t c, locale_t) {
-  return iswlower(c);
-}
-
-static inline int iswprint_l(wint_t c, locale_t) {
-  return iswprint(c);
-}
-
-static inline int iswpunct_l(wint_t c, locale_t) {
-  return iswpunct(c);
-}
-
-static inline int iswspace_l(wint_t c, locale_t) {
-  return iswspace(c);
-}
-
-static inline int iswupper_l(wint_t c, locale_t) {
-  return iswupper(c);
-}
-
-static inline int iswxdigit_l(wint_t c, locale_t) {
-  return iswxdigit(c);
-}
-
-static inline int toupper_l(int c, locale_t) {
-  return toupper(c);
-}
-
-static inline int tolower_l(int c, locale_t) {
-  return tolower(c);
-}
-
-static inline int towupper_l(int c, locale_t) {
-  return towupper(c);
-}
-
-static inline int towlower_l(int c, locale_t) {
-  return towlower(c);
-}
-
-static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
-  return strcoll(s1, s2);
-}
-
-static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
-                               locale_t) {
-  return strxfrm(dest, src, n);
-}
-
-static inline size_t strftime_l(char *s, size_t max, const char *format,
-                                const struct tm *tm, locale_t) {
-  return strftime(s, max, format, tm);
-}
-
-static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
-  return wcscoll(ws1, ws2);
-}
-
-static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
-                               locale_t) {
-  return wcsxfrm(dest, src, n);
-}
-
-static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
-  return strtold(nptr, endptr);
-}
-
-static inline long long strtoll_l(const char *nptr, char **endptr, size_t base,
-                                  locale_t) {
-  return strtoll(nptr, endptr, base);
-}
-
-static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
-                                            size_t base, locale_t) {
-  return strtoull(nptr, endptr, base);
-}
-
-static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
-                                  size_t base, locale_t) {
-  return wcstoll(nptr, endptr, base);
-}
-
-static inline unsigned long long wcstoull_l(const wchar_t *nptr,
-                                            wchar_t **endptr, size_t base,
-                                            locale_t) {
-  return wcstoull(nptr, endptr, base);
-}
-
-static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
-                                    locale_t) {
-  return wcstold(nptr, endptr);
-}
-
 #ifdef __cplusplus
 }
 #endif
+
+// Share implementation with Newlib
+#include <support/xlocale/xlocale.h>
+
 #endif // defined(__ANDROID__)
 #endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
diff --git a/include/support/newlib/xlocale.h b/include/support/newlib/xlocale.h
new file mode 100644
index 0000000..d067cf8
--- /dev/null
+++ b/include/support/newlib/xlocale.h
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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_SUPPORT_NEWLIB_XLOCALE_H
+#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
+
+#if defined(_NEWLIB_VERSION)
+
+#include <cstdlib>
+#include <clocale>
+#include <cwctype>
+#include <ctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Patch over newlib's lack of extended locale support
+typedef void *locale_t;
+static inline locale_t duplocale(locale_t) {
+  return NULL;
+}
+
+static inline void freelocale(locale_t) {
+}
+
+static inline locale_t newlocale(int, const char *, locale_t) {
+  return NULL;
+}
+
+static inline locale_t uselocale(locale_t) {
+  return NULL;
+}
+
+#define LC_COLLATE_MASK  (1 << LC_COLLATE)
+#define LC_CTYPE_MASK    (1 << LC_CTYPE)
+#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
+#define LC_MONETARY_MASK (1 << LC_MONETARY)
+#define LC_NUMERIC_MASK  (1 << LC_NUMERIC)
+#define LC_TIME_MASK     (1 << LC_TIME)
+#define LC_ALL_MASK (LC_COLLATE_MASK|\
+                     LC_CTYPE_MASK|\
+                     LC_MONETARY_MASK|\
+                     LC_NUMERIC_MASK|\
+                     LC_TIME_MASK|\
+                     LC_MESSAGES_MASK)
+
+// Share implementation with Android's Bionic
+#include <support/xlocale/xlocale.h>
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _NEWLIB_VERSION
+
+#endif
diff --git a/include/support/solaris/xlocale.h b/include/support/solaris/xlocale.h
index 875a39a..6b5b544 100644
--- a/include/support/solaris/xlocale.h
+++ b/include/support/solaris/xlocale.h
@@ -14,6 +14,8 @@
 #ifndef __XLOCALE_H_INCLUDED
 #define __XLOCALE_H_INCLUDED
 
+#include <stdlib.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
index bc96587..5765bab 100644
--- a/include/support/win32/support.h
+++ b/include/support/win32/support.h
@@ -31,6 +31,8 @@
 #define NOMINMAX
 #endif
 
+// The mingw headers already define these as static.
+#ifndef __MINGW32__
 extern "C" {
 
 int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
@@ -40,6 +42,7 @@
 size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
                   size_t nwc, size_t len, mbstate_t *__restrict ps);
 }
+#endif // __MINGW32__
 
 #if defined(_LIBCPP_MSVCRT)
 #define snprintf _snprintf
diff --git a/include/support/xlocale/xlocale.h b/include/support/xlocale/xlocale.h
new file mode 100644
index 0000000..99f710e
--- /dev/null
+++ b/include/support/xlocale/xlocale.h
@@ -0,0 +1,194 @@
+// -*- C++ -*-
+//===------------------- support/xlocale/xlocale.h ------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+// This is a shared implementation of a shim to provide extended locale support
+// on top of libc's that don't support it (like Android's bionic, and Newlib).
+//
+// The 'illusion' only works when the specified locale is "C" or "POSIX", but
+// that's about as good as we can do without implementing full xlocale support
+// in the underlying libc.
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
+#define _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline int isalnum_l(int c, locale_t) {
+  return isalnum(c);
+}
+
+static inline int isalpha_l(int c, locale_t) {
+  return isalpha(c);
+}
+
+static inline int isblank_l(int c, locale_t) {
+  return isblank(c);
+}
+
+static inline int iscntrl_l(int c, locale_t) {
+  return iscntrl(c);
+}
+
+static inline int isdigit_l(int c, locale_t) {
+  return isdigit(c);
+}
+
+static inline int isgraph_l(int c, locale_t) {
+  return isgraph(c);
+}
+
+static inline int islower_l(int c, locale_t) {
+  return islower(c);
+}
+
+static inline int isprint_l(int c, locale_t) {
+  return isprint(c);
+}
+
+static inline int ispunct_l(int c, locale_t) {
+  return ispunct(c);
+}
+
+static inline int isspace_l(int c, locale_t) {
+  return isspace(c);
+}
+
+static inline int isupper_l(int c, locale_t) {
+  return isupper(c);
+}
+
+static inline int isxdigit_l(int c, locale_t) {
+  return isxdigit(c);
+}
+
+static inline int iswalnum_l(wint_t c, locale_t) {
+  return iswalnum(c);
+}
+
+static inline int iswalpha_l(wint_t c, locale_t) {
+  return iswalpha(c);
+}
+
+static inline int iswblank_l(wint_t c, locale_t) {
+  return iswblank(c);
+}
+
+static inline int iswcntrl_l(wint_t c, locale_t) {
+  return iswcntrl(c);
+}
+
+static inline int iswdigit_l(wint_t c, locale_t) {
+  return iswdigit(c);
+}
+
+static inline int iswgraph_l(wint_t c, locale_t) {
+  return iswgraph(c);
+}
+
+static inline int iswlower_l(wint_t c, locale_t) {
+  return iswlower(c);
+}
+
+static inline int iswprint_l(wint_t c, locale_t) {
+  return iswprint(c);
+}
+
+static inline int iswpunct_l(wint_t c, locale_t) {
+  return iswpunct(c);
+}
+
+static inline int iswspace_l(wint_t c, locale_t) {
+  return iswspace(c);
+}
+
+static inline int iswupper_l(wint_t c, locale_t) {
+  return iswupper(c);
+}
+
+static inline int iswxdigit_l(wint_t c, locale_t) {
+  return iswxdigit(c);
+}
+
+static inline int toupper_l(int c, locale_t) {
+  return toupper(c);
+}
+
+static inline int tolower_l(int c, locale_t) {
+  return tolower(c);
+}
+
+static inline int towupper_l(int c, locale_t) {
+  return towupper(c);
+}
+
+static inline int towlower_l(int c, locale_t) {
+  return towlower(c);
+}
+
+static inline int strcoll_l(const char *s1, const char *s2, locale_t) {
+  return strcoll(s1, s2);
+}
+
+static inline size_t strxfrm_l(char *dest, const char *src, size_t n,
+                               locale_t) {
+  return strxfrm(dest, src, n);
+}
+
+static inline size_t strftime_l(char *s, size_t max, const char *format,
+                                const struct tm *tm, locale_t) {
+  return strftime(s, max, format, tm);
+}
+
+static inline int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t) {
+  return wcscoll(ws1, ws2);
+}
+
+static inline size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n,
+                               locale_t) {
+  return wcsxfrm(dest, src, n);
+}
+
+static inline long double strtold_l(const char *nptr, char **endptr, locale_t) {
+  return strtold(nptr, endptr);
+}
+
+static inline long long strtoll_l(const char *nptr, char **endptr, int base,
+                                  locale_t) {
+  return strtoll(nptr, endptr, base);
+}
+
+static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
+                                            int base, locale_t) {
+  return strtoull(nptr, endptr, base);
+}
+
+static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
+                                  int base, locale_t) {
+  return wcstoll(nptr, endptr, base);
+}
+
+static inline unsigned long long wcstoull_l(const wchar_t *nptr,
+                                            wchar_t **endptr, int base,
+                                            locale_t) {
+  return wcstoull(nptr, endptr, base);
+}
+
+static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
+                                    locale_t) {
+  return wcstold(nptr, endptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_XLOCALE_XLOCALE_H
diff --git a/include/thread b/include/thread
index 1f1e4a2..808d76b 100644
--- a/include/thread
+++ b/include/thread
@@ -106,6 +106,10 @@
 
 #define __STDCPP_THREADS__ __cplusplus
 
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error <thread> is not supported on this single threaded system
+#else // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Tp>
@@ -455,4 +459,6 @@
 
 _LIBCPP_END_NAMESPACE_STD
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 #endif  // _LIBCPP_THREAD
diff --git a/include/tuple b/include/tuple
index c3fdd40..5fc27f9 100644
--- a/include/tuple
+++ b/include/tuple
@@ -376,19 +376,18 @@
 _LIBCPP_INLINE_VISIBILITY
 void __swallow(_Tp&&...) _NOEXCEPT {}
 
-template <bool ...> struct __all;
+template <bool ..._Pred>
+struct __all
+    : is_same<__all<_Pred...>, __all<(_Pred, true)...>>
+{ };
 
-template <>
-struct __all<>
-{
-    static const bool value = true;
-};
+template <class _Tp>
+struct __all_default_constructible;
 
-template <bool _B0, bool ... _Bp>
-struct __all<_B0, _Bp...>
-{
-    static const bool value = _B0 && __all<_Bp...>::value;
-};
+template <class ..._Tp>
+struct __all_default_constructible<__tuple_types<_Tp...>>
+    : __all<is_default_constructible<_Tp>::value...>
+{ };
 
 // __tuple_impl
 
@@ -512,6 +511,9 @@
         typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
 public:
 
+    template <bool _Dummy = true, class _Up = typename enable_if<
+        __all<(_Dummy && is_default_constructible<_Tp>::value)...>::value
+    >::type>
     _LIBCPP_INLINE_VISIBILITY
     _LIBCPP_CONSTEXPR tuple()
         _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
@@ -547,6 +549,12 @@
                                      sizeof...(_Up) < sizeof...(_Tp) ?
                                         sizeof...(_Up) :
                                         sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
                          >::value,
                          bool
                       >::type = false
@@ -554,7 +562,7 @@
         _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
         tuple(_Up&&... __u)
             _NOEXCEPT_((
-                is_nothrow_constructible<
+                is_nothrow_constructible<base,
                     typename __make_tuple_indices<sizeof...(_Up)>::type,
                     typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
                     typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
@@ -587,6 +595,12 @@
                                      sizeof...(_Up) < sizeof...(_Tp) ?
                                         sizeof...(_Up) :
                                         sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
                          >::value,
                          bool
                       >::type =false
@@ -595,7 +609,7 @@
         explicit
         tuple(_Up&&... __u)
             _NOEXCEPT_((
-                is_nothrow_constructible<
+                is_nothrow_constructible<base,
                     typename __make_tuple_indices<sizeof...(_Up)>::type,
                     typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
                     typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
@@ -620,6 +634,12 @@
                                      sizeof...(_Up) < sizeof...(_Tp) ?
                                         sizeof...(_Up) :
                                         sizeof...(_Tp)>::type
+                         >::value &&
+                         __all_default_constructible<
+                            typename __make_tuple_types<tuple, sizeof...(_Tp),
+                                sizeof...(_Up) < sizeof...(_Tp) ?
+                                    sizeof...(_Up) :
+                                    sizeof...(_Tp)>::type
                          >::value
                       >::type
              >
diff --git a/include/type_traits b/include/type_traits
index 371a15e..f467735 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -197,7 +197,9 @@
     template <class F, class... ArgTypes>
       using result_of_t       = typename result_of<F(ArgTypes...)>::type;  // C++14
 
-}  // std
+    template <class...>
+      using void_t = void;
+}  // C++17
 
 */
 #include <__config>
@@ -209,6 +211,11 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+template <class...> 
+struct __void_t { typedef void type; };
+#endif
+
 template <bool _Bp, class _If, class _Then>
     struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;};
 template <class _If, class _Then>
@@ -218,6 +225,9 @@
 template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
 #endif
 
+template <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;};
+
 template <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {};
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;};
 
@@ -1208,43 +1218,46 @@
           bool = __numeric_type<_A1>::value &&
                  __numeric_type<_A2>::value &&
                  __numeric_type<_A3>::value>
-class __promote
+class __promote_imp
 {
+public:
     static const bool value = false;
 };
 
 template <class _A1, class _A2, class _A3>
-class __promote<_A1, _A2, _A3, true>
+class __promote_imp<_A1, _A2, _A3, true>
 {
 private:
-    typedef typename __promote<_A1>::type __type1;
-    typedef typename __promote<_A2>::type __type2;
-    typedef typename __promote<_A3>::type __type3;
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
+    typedef typename __promote_imp<_A3>::type __type3;
 public:
     typedef decltype(__type1() + __type2() + __type3()) type;
     static const bool value = true;
 };
 
 template <class _A1, class _A2>
-class __promote<_A1, _A2, void, true>
+class __promote_imp<_A1, _A2, void, true>
 {
 private:
-    typedef typename __promote<_A1>::type __type1;
-    typedef typename __promote<_A2>::type __type2;
+    typedef typename __promote_imp<_A1>::type __type1;
+    typedef typename __promote_imp<_A2>::type __type2;
 public:
     typedef decltype(__type1() + __type2()) type;
     static const bool value = true;
 };
 
 template <class _A1>
-class __promote<_A1, void, void, true>
+class __promote_imp<_A1, void, void, true>
 {
 public:
     typedef typename __numeric_type<_A1>::type type;
     static const bool value = true;
-    static const bool __does_not_throw = _NOEXCEPT_OR_FALSE(static_cast<type>(declval<_A1>()));
 };
 
+template <class _A1, class _A2 = void, class _A3 = void>
+class __promote : public __promote_imp<_A1, _A2, _A3> {};
+
 #ifdef _LIBCPP_STORE_AS_OPTIMIZATION
 
 // __transform
@@ -1523,7 +1536,7 @@
 
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
     : public is_assignable<typename add_lvalue_reference<_Tp>::type,
-                     const typename add_lvalue_reference<_Tp>::type> {};
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
 // is_move_assignable
 
@@ -1537,11 +1550,11 @@
 
 // is_destructible
 
-//	if it's a reference, return true
-//	if it's a function, return false
-//	if it's   void,     return false
-//	if it's an array of unknown bound, return false
-//	Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed
+//  if it's a reference, return true
+//  if it's a function, return false
+//  if it's   void,     return false
+//  if it's an array of unknown bound, return false
+//  Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed
 //    where _Up is remove_all_extents<_Tp>::type
 
 template <class>
@@ -1549,15 +1562,15 @@
 
 template <typename _Tp>
 struct __is_destructor_wellformed {
-	template <typename _Tp1>
-	static char  __test (
+    template <typename _Tp1>
+    static char  __test (
         typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type
     );
 
-	template <typename _Tp1>
-	static __two __test (...);
-	
-	static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
+    template <typename _Tp1>
+    static __two __test (...);
+    
+    static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
 };
 
 template <class _Tp, bool>
@@ -1698,6 +1711,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
 {
     typedef _Class const _ClassType;
@@ -1706,6 +1727,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
 {
     typedef _Class volatile _ClassType;
@@ -1714,6 +1743,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
 {
     typedef _Class const volatile _ClassType;
@@ -1721,6 +1758,14 @@
     typedef _Rp (_FnType) (_Param...);
 };
 
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
 #if __has_feature(cxx_reference_qualified_functions)
 
 template <class _Rp, class _Class, class ..._Param>
@@ -1732,6 +1777,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
+{
+    typedef _Class& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
 {
     typedef _Class const& _ClassType;
@@ -1740,6 +1793,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
+{
+    typedef _Class const& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
 {
     typedef _Class volatile& _ClassType;
@@ -1748,6 +1809,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
+{
+    typedef _Class volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
 {
     typedef _Class const volatile& _ClassType;
@@ -1756,6 +1825,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
+{
+    typedef _Class const volatile& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
 {
     typedef _Class&& _ClassType;
@@ -1764,6 +1841,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
+{
+    typedef _Class&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
 {
     typedef _Class const&& _ClassType;
@@ -1772,6 +1857,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
+{
+    typedef _Class const&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
 {
     typedef _Class volatile&& _ClassType;
@@ -1780,6 +1873,14 @@
 };
 
 template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
+{
+    typedef _Class volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
+template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
 {
     typedef _Class const volatile&& _ClassType;
@@ -1787,6 +1888,14 @@
     typedef _Rp (_FnType) (_Param...);
 };
 
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
+{
+    typedef _Class const volatile&& _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_Param..., ...);
+};
+
 #endif  // __has_feature(cxx_reference_qualified_functions)
 
 #else  // _LIBCPP_HAS_NO_VARIADICS
@@ -1799,6 +1908,14 @@
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
 {
@@ -1807,6 +1924,14 @@
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
 {
@@ -1815,6 +1940,14 @@
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
 {
@@ -1823,6 +1956,14 @@
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false>
+{
+    typedef _Class _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
 {
@@ -1831,6 +1972,14 @@
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
 {
@@ -1839,6 +1988,14 @@
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
 {
@@ -1847,6 +2004,14 @@
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
 {
@@ -1855,6 +2020,14 @@
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false>
+{
+    typedef _Class const _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
 {
@@ -1863,6 +2036,14 @@
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
 {
@@ -1871,6 +2052,14 @@
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
 {
@@ -1879,6 +2068,14 @@
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
 {
@@ -1887,6 +2084,14 @@
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false>
+{
+    typedef _Class volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 template <class _Rp, class _Class>
 struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
 {
@@ -1895,6 +2100,14 @@
     typedef _Rp (_FnType) ();
 };
 
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (...);
+};
+
 template <class _Rp, class _Class, class _P0>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
 {
@@ -1903,6 +2116,14 @@
     typedef _Rp (_FnType) (_P0);
 };
 
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
 {
@@ -1911,6 +2132,14 @@
     typedef _Rp (_FnType) (_P0, _P1);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, ...);
+};
+
 template <class _Rp, class _Class, class _P0, class _P1, class _P2>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
 {
@@ -1919,6 +2148,14 @@
     typedef _Rp (_FnType) (_P0, _P1, _P2);
 };
 
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false>
+{
+    typedef _Class const volatile _ClassType;
+    typedef _Rp _ReturnType;
+    typedef _Rp (_FnType) (_P0, _P1, _P2, ...);
+};
+
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
 template <class _Rp, class _Class>
@@ -2413,8 +2650,8 @@
 
 template <class _Tp>
 struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
-    : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
-    {};
+    : public is_constructible<_Tp, 
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
 // is_move_constructible
 
@@ -2618,8 +2855,7 @@
 
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
     : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
-                               const typename add_lvalue_reference<_Tp>::type>
-    {};
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
 // is_trivially_move_assignable
 
@@ -2637,7 +2873,7 @@
 #if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
 
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
-    : public integral_constant<bool, __has_trivial_destructor(_Tp)> {};
+    : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
 
 #else
 
@@ -2665,29 +2901,38 @@
 
 #if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
 
-template <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
+template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
 
 template <class _Tp, class... _Args>
-struct __libcpp_is_nothrow_constructible<true, _Tp, _Args...>
+struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...>
     : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
 {
 };
 
-template <class _Tp, class... _Args>
-struct __libcpp_is_nothrow_constructible<false, _Tp, _Args...>
+template <class _Tp>
+void __implicit_conversion_to(_Tp) noexcept { }
+
+template <class _Tp, class _Arg>
+struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
+    : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))>
+{
+};
+
+template <class _Tp, bool _IsReference, class... _Args>
+struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...>
     : public false_type
 {
 };
 
 template <class _Tp, class... _Args>
 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
-    : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
+    : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
 {
 };
 
 template <class _Tp, size_t _Ns>
 struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]>
-    : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, _Tp>
+    : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp>
 {
 };
 
@@ -2810,8 +3055,8 @@
 // is_nothrow_copy_constructible
 
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
-    : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type>
-    {};
+    : public is_nothrow_constructible<_Tp,
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
 // is_nothrow_move_constructible
 
@@ -2895,8 +3140,7 @@
 
 template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
     : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
-                               const typename add_lvalue_reference<_Tp>::type>
-    {};
+                  typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
 
 // is_nothrow_move_assignable
 
@@ -3405,24 +3649,41 @@
 #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
 
 template <class _Tp>
-struct __has_operator_addressof_imp
+struct __has_operator_addressof_member_imp
 {
-    template <class>
-        static auto __test(__any) -> false_type;
     template <class _Up>
-        static auto __test(_Up* __u)
-            -> typename __select_2nd<decltype(__u->operator&()), true_type>::type;
+        static auto __test(int)
+            -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type;
+    template <class>
+        static auto __test(long) -> false_type;
 
-    static const bool value = decltype(__test<_Tp>(nullptr))::value;
+    static const bool value = decltype(__test<_Tp>(0))::value;
+};
+
+template <class _Tp>
+struct __has_operator_addressof_free_imp
+{
+    template <class _Up>
+        static auto __test(int)
+            -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type;
+    template <class>
+        static auto __test(long) -> false_type;
+
+    static const bool value = decltype(__test<_Tp>(0))::value;
 };
 
 template <class _Tp>
 struct __has_operator_addressof
-    : public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value>
+    : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value
+                                  || __has_operator_addressof_free_imp<_Tp>::value>
 {};
 
 #endif  // _LIBCPP_HAS_NO_ADVANCED_SFINAE
 
+#if _LIBCPP_STD_VER > 14
+template <class...> using void_t = void;
+#endif
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_TYPE_TRAITS
diff --git a/include/utility b/include/utility
index 4eafda4..6f324db 100644
--- a/include/utility
+++ b/include/utility
@@ -207,7 +207,7 @@
 _ForwardIterator2
 swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2)
 {
-    for(; __first1 != __last1; ++__first1, ++__first2)
+    for(; __first1 != __last1; ++__first1, (void) ++__first2)
         swap(*__first1, *__first2);
     return __first2;
 }
diff --git a/include/valarray b/include/valarray
index 3714350..2b94204 100644
--- a/include/valarray
+++ b/include/valarray
@@ -1220,6 +1220,7 @@
     const value_type* __s = __sa.__vp_;
     for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_)
         *__t = *__s;
+    return *this;
 }
 
 template <class _Tp>
@@ -2090,6 +2091,7 @@
     size_t __n = __1d_.size();
     for (size_t __i = 0; __i < __n; ++__i)
         __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]];
+    return *this;
 }
 
 template <class _Tp>
diff --git a/include/vector b/include/vector
index 1be584d..22a6343 100644
--- a/include/vector
+++ b/include/vector
@@ -784,7 +784,6 @@
             void
         >::type
         __construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
-    void __move_construct_at_end(pointer __first, pointer __last);
     void __append(size_type __n);
     void __append(size_type __n, const_reference __x);
     _LIBCPP_INLINE_VISIBILITY
@@ -836,7 +835,7 @@
     // may not meet the AddressSanitizer alignment constraints.
     // See the documentation for __sanitizer_annotate_contiguous_container for more details.
     void __annotate_contiguous_container
-    (const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid)
+    (const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const
     {
 #ifndef _LIBCPP_HAS_NO_ASAN
       if (__beg && is_same<allocator_type, __default_allocator_type>::value)
@@ -844,26 +843,50 @@
 #endif
     }
 
-    void __annotate_new(size_type __current_size)
+    void __annotate_new(size_type __current_size) const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + capacity(), data() + __current_size);
     }
-    void __annotate_delete()
+    void __annotate_delete() const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + size(), data() + capacity());
     }
-    void __annotate_increase(size_type __n)
+    void __annotate_increase(size_type __n) const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + size(), data() + size() + __n);
     }
-    void __annotate_shrink(size_type __old_size)
+    void __annotate_shrink(size_type __old_size) const
     {
       __annotate_contiguous_container(data(), data() + capacity(),
                                       data() + __old_size, data() + size());
     }
+#ifndef _LIBCPP_HAS_NO_ASAN
+    // The annotation for size increase should happen before the actual increase,
+    // but if an exception is thrown after that the annotation has to be undone.
+    struct __RAII_IncreaseAnnotator {
+      __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1)
+        : __commit(false), __v(__v), __n(__n) {
+        __v.__annotate_increase(__n);
+      }
+      void __done() { __commit = true; }
+      ~__RAII_IncreaseAnnotator() {
+        if (__commit) return;
+        __v.__annotate_shrink(__v.size() + __n);
+      }
+      bool __commit;
+      size_type __n;
+      const vector &__v;
+    };
+#else
+    struct __RAII_IncreaseAnnotator {
+      inline __RAII_IncreaseAnnotator(const vector &, size_type __n = 1) {}
+      inline void __done() {}
+    };
+#endif
+
 };
 
 template <class _Tp, class _Allocator>
@@ -959,12 +982,13 @@
 vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
 {
     allocator_type& __a = this->__alloc();
-    __annotate_increase(__n);
     do
     {
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
         ++this->__end_;
         --__n;
+        __annotator.__done();
     } while (__n > 0);
 }
 
@@ -980,12 +1004,13 @@
 vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
 {
     allocator_type& __a = this->__alloc();
-    __annotate_increase(__n);
     do
     {
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
         ++this->__end_;
         --__n;
+        __annotator.__done();
     } while (__n > 0);
 }
 
@@ -1001,22 +1026,9 @@
     allocator_type& __a = this->__alloc();
     for (; __first != __last; ++__first)
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
-        ++this->__end_;
-    }
-}
-
-template <class _Tp, class _Allocator>
-void
-vector<_Tp, _Allocator>::__move_construct_at_end(pointer __first, pointer __last)
-{
-    allocator_type& __a = this->__alloc();
-    for (; __first != __last; ++__first)
-    {
-        __annotate_increase(1);
-        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
-                                  _VSTD::move(*__first));
+        __annotator.__done();
         ++this->__end_;
     }
 }
@@ -1578,9 +1590,10 @@
 {
     if (this->__end_ != this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(this->__alloc(),
                                   _VSTD::__to_raw_pointer(this->__end_), __x);
+        __annotator.__done();
         ++this->__end_;
     }
     else
@@ -1596,10 +1609,11 @@
 {
     if (this->__end_ < this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(this->__alloc(),
                                   _VSTD::__to_raw_pointer(this->__end_),
                                   _VSTD::move(__x));
+        __annotator.__done();
         ++this->__end_;
     }
     else
@@ -1629,10 +1643,11 @@
 {
     if (this->__end_ < this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         __alloc_traits::construct(this->__alloc(),
                                   _VSTD::__to_raw_pointer(this->__end_),
                                   _VSTD::forward<_Args>(__args)...);
+        __annotator.__done();
         ++this->__end_;
     }
     else
@@ -1712,7 +1727,7 @@
     pointer __p = this->__begin_ + (__position - begin());
     if (this->__end_ < this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         if (__p == this->__end_)
         {
             __alloc_traits::construct(this->__alloc(),
@@ -1727,6 +1742,7 @@
                 ++__xr;
             *__p = *__xr;
         }
+        __annotator.__done();
     }
     else
     {
@@ -1752,7 +1768,7 @@
     pointer __p = this->__begin_ + (__position - begin());
     if (this->__end_ < this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         if (__p == this->__end_)
         {
             __alloc_traits::construct(this->__alloc(),
@@ -1765,6 +1781,7 @@
             __move_range(__p, this->__end_, __p + 1);
             *__p = _VSTD::move(__x);
         }
+        __annotator.__done();
     }
     else
     {
@@ -1791,7 +1808,7 @@
     pointer __p = this->__begin_ + (__position - begin());
     if (this->__end_ < this->__end_cap())
     {
-        __annotate_increase(1);
+        __RAII_IncreaseAnnotator __annotator(*this);
         if (__p == this->__end_)
         {
             __alloc_traits::construct(this->__alloc(),
@@ -1805,6 +1822,7 @@
             __move_range(__p, this->__end_, __p + 1);
             *__p = _VSTD::move(__tmp);
         }
+        __annotator.__done();
     }
     else
     {
@@ -1843,8 +1861,9 @@
             }
             if (__n > 0)
             {
-                __annotate_increase(__n);
+                __RAII_IncreaseAnnotator __annotator(*this, __n);
                 __move_range(__p, __old_last, __p + __old_n);
+                __annotator.__done();
                 const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
                 if (__p <= __xr && __xr < this->__end_)
                     __xr += __old_n;
@@ -1954,8 +1973,9 @@
             }
             if (__n > 0)
             {
-                __annotate_increase(__n);
+                __RAII_IncreaseAnnotator __annotator(*this, __n);
                 __move_range(__p, __old_last, __p + __old_n);
+                __annotator.__done();
                 _VSTD::copy(__first, __m, __p);
             }
         }
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index fc3fc9f..e83bc3e 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -11,12 +11,15 @@
   list(REMOVE_ITEM LIBCXXABI_SOURCES ${PNACL_EH_SUPPORT})
 endif()
   list(APPEND LIBCXX_SOURCES ${LIBCXXABI_SOURCES})
-  set(LIBCXX_CXX_ABI_LIBRARIES)
+  set(LIBCXX_CXX_ABI_LIBRARY)
 # @LOCALMOD-END
 
 if(WIN32)
   file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp)
   list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES})
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
+  file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c)
+  list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES})
 endif()
 
 # Add all the headers to the project for IDEs.
@@ -50,18 +53,22 @@
 endif()
 
 # Generate library list.
-set(libraries ${LIBCXX_CXX_ABI_LIBRARIES})
+set(libraries ${LIBCXX_CXX_ABI_LIBRARY})
 append_if(libraries LIBCXX_HAS_PTHREAD_LIB pthread)
 append_if(libraries LIBCXX_HAS_C_LIB c)
 append_if(libraries LIBCXX_HAS_M_LIB m)
 append_if(libraries LIBCXX_HAS_RT_LIB rt)
 append_if(libraries LIBCXX_HAS_GCC_S_LIB gcc_s)
 
+#if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path.
+if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH)
+  target_link_libraries(cxx "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}")
+endif()
 target_link_libraries(cxx ${libraries})
 
 # Setup flags.
-# @LOCALMOD removed append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
-append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+# @LOCALMOD removed append_if(LIBCXX_COMPILE_FLAGS LIBCXX_HAS_FPIC_FLAG -fPIC)
+append_if(LIBCXX_LINK_FLAGS LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
 
 # @LOCALMOD-START
 if ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
@@ -74,10 +81,10 @@
 
 if ( False ) # @LOCALMOD-END
   if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
-    list(APPEND compile_flags "-U__STRICT_ANSI__")
-    list(APPEND link_flags
+    list(APPEND LIBCXX_COMPILE_FLAGS "-U__STRICT_ANSI__")
+    list(APPEND LIBCXX_LINK_FLAGS
       "-compatibility_version 1"
-      "-current_version ${LIBCXX_VERSION}"
+      "-current_version 1"
       "-install_name /usr/lib/libc++.1.dylib"
       "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
@@ -97,7 +104,7 @@
       set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
     endif()
 
-    list(APPEND link_flags
+    list(APPEND LIBCXX_LINK_FLAGS
       "-compatibility_version 1"
       "-install_name /usr/lib/libc++.1.dylib"
       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
@@ -107,12 +114,13 @@
   endif()
 endif()
 
-string(REPLACE ";" " " link_flags "${link_flags}")
+string(REPLACE ";" " " LIBCXX_COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}")
+string(REPLACE ";" " " LIBCXX_LINK_FLAGS "${LIBCXX_LINK_FLAGS}")
 
 set_target_properties(cxx
   PROPERTIES
-    COMPILE_FLAGS "${compile_flags}"
-    LINK_FLAGS    "${link_flags}"
+    COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+    LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
     OUTPUT_NAME   "c++"
     VERSION       "1.0"
     SOVERSION     "1"
diff --git a/src/algorithm.cpp b/src/algorithm.cpp
index 10c4c33..e548856 100644
--- a/src/algorithm.cpp
+++ b/src/algorithm.cpp
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
 #include "algorithm"
 #include "random"
 #include "mutex"
@@ -48,12 +47,16 @@
 
 template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
 
+#ifndef _LIBCPP_HAS_NO_THREADS
 static pthread_mutex_t __rs_mut = PTHREAD_MUTEX_INITIALIZER;
+#endif
 unsigned __rs_default::__c_ = 0;
 
 __rs_default::__rs_default()
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     pthread_mutex_lock(&__rs_mut);
+#endif
     __c_ = 1;
 }
 
@@ -64,8 +67,12 @@
 
 __rs_default::~__rs_default()
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     if (--__c_ == 0)
         pthread_mutex_unlock(&__rs_mut);
+#else
+    --__c_;
+#endif
 }
 
 __rs_default::result_type
diff --git a/src/chrono.cpp b/src/chrono.cpp
index 15a6f46..4569411 100644
--- a/src/chrono.cpp
+++ b/src/chrono.cpp
@@ -46,6 +46,7 @@
     return system_clock::time_point(seconds(t));
 }
 
+#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
 // steady_clock
 
 const bool steady_clock::is_steady;
@@ -108,10 +109,8 @@
 }
 
 #else  // __APPLE__
-// FIXME: We assume that clock_gettime(CLOCK_MONOTONIC) works on
-// non-apple systems.  Instead, we should check _POSIX_TIMERS and
-// _POSIX_MONOTONIC_CLOCK and fall back to something else if those
-// don't exist.
+// FIXME: if _LIBCPP_HAS_NO_MONOTONIC_CLOCK, then clock_gettime isn't going to
+// work. It may be possible to fall back on something else, depending on the system.
 
 // Warning:  If this is not truly steady, then it is non-conforming.  It is
 //  better for it to not exist and have the rest of libc++ use system_clock
@@ -127,6 +126,8 @@
 }
 #endif  // __APPLE__
 
+#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
+
 }
 
 _LIBCPP_END_NAMESPACE_STD
diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp
index 061d138..5fd5fc8 100644
--- a/src/condition_variable.cpp
+++ b/src/condition_variable.cpp
@@ -7,6 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "__config"
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 #include "condition_variable"
 #include "thread"
 #include "system_error"
@@ -79,3 +83,5 @@
 }
 
 _LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/src/debug.cpp b/src/debug.cpp
index d0e8679..60694a3 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -35,6 +35,7 @@
 namespace
 {
 
+#ifndef _LIBCPP_HAS_NO_THREADS
 typedef mutex mutex_type;
 typedef lock_guard<mutex_type> WLock;
 typedef lock_guard<mutex_type> RLock;
@@ -45,6 +46,7 @@
     static mutex_type m;
     return m;
 }
+#endif // !_LIBCPP_HAS_NO_THREADS
 
 }  // unnamed namespace
 
@@ -108,7 +110,9 @@
 void*
 __libcpp_db::__find_c_from_i(void* __i) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     _LIBCPP_ASSERT(i != nullptr, "iterator not found in debug database.");
     return i->__c_ != nullptr ? i->__c_->__c_ : nullptr;
@@ -117,7 +121,9 @@
 void
 __libcpp_db::__insert_ic(void* __i, const void* __c)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     if (__cbeg_ == __cend_)
         return;
     size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
@@ -138,7 +144,9 @@
 __c_node*
 __libcpp_db::__insert_c(void* __c)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
     {
         size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
@@ -184,7 +192,9 @@
 void
 __libcpp_db::__erase_i(void* __i)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     if (__ibeg_ != __iend_)
     {
         size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
@@ -215,7 +225,9 @@
 void
 __libcpp_db::__invalidate_all(void* __c)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     if (__cend_ != __cbeg_)
     {
         size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
@@ -239,17 +251,23 @@
 __c_node*
 __libcpp_db::__find_c_and_lock(void* __c) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     mut().lock();
+#endif
     if (__cend_ == __cbeg_)
     {
+#ifndef _LIBCPP_HAS_NO_THREADS
         mut().unlock();
+#endif
         return nullptr;
     }
     size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
     __c_node* p = __cbeg_[hc];
     if (p == nullptr)
     {
+#ifndef _LIBCPP_HAS_NO_THREADS
         mut().unlock();
+#endif
         return nullptr;
     }
     while (p->__c_ != __c)
@@ -257,7 +275,9 @@
         p = p->__next_;
         if (p == nullptr)
         {
+#ifndef _LIBCPP_HAS_NO_THREADS
             mut().unlock();
+#endif
             return nullptr;
         }
     }
@@ -281,13 +301,17 @@
 void
 __libcpp_db::unlock() const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     mut().unlock();
+#endif
 }
 
 void
 __libcpp_db::__erase_c(void* __c)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     if (__cend_ != __cbeg_)
     {
         size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
@@ -322,7 +346,9 @@
 void
 __libcpp_db::__iterator_copy(void* __i, const void* __i0)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     __i_node* i0 = __find_iterator(__i0);
     __c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
@@ -348,7 +374,9 @@
 bool
 __libcpp_db::__dereferenceable(const void* __i) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     return i != nullptr && i->__c_ != nullptr && i->__c_->__dereferenceable(__i);
 }
@@ -356,7 +384,9 @@
 bool
 __libcpp_db::__decrementable(const void* __i) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     return i != nullptr && i->__c_ != nullptr && i->__c_->__decrementable(__i);
 }
@@ -364,7 +394,9 @@
 bool
 __libcpp_db::__addable(const void* __i, ptrdiff_t __n) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     return i != nullptr && i->__c_ != nullptr && i->__c_->__addable(__i, __n);
 }
@@ -372,7 +404,9 @@
 bool
 __libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     return i != nullptr && i->__c_ != nullptr && i->__c_->__subscriptable(__i, __n);
 }
@@ -380,7 +414,9 @@
 bool
 __libcpp_db::__less_than_comparable(const void* __i, const void* __j) const
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     RLock _(mut());
+#endif
     __i_node* i = __find_iterator(__i);
     __i_node* j = __find_iterator(__j);
     __c_node* ci = i != nullptr ? i->__c_ : nullptr;
@@ -391,7 +427,9 @@
 void
 __libcpp_db::swap(void* c1, void* c2)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     size_t hc = hash<void*>()(c1) % static_cast<size_t>(__cend_ - __cbeg_);
     __c_node* p1 = __cbeg_[hc];
     _LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
@@ -420,7 +458,9 @@
 void
 __libcpp_db::__insert_i(void* __i)
 {
+#ifndef _LIBCPP_HAS_NO_THREADS
     WLock _(mut());
+#endif
     __insert_iterator(__i);
 }
 
diff --git a/src/exception.cpp b/src/exception.cpp
index 3ce6f2e..b5c46c0 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -16,7 +16,7 @@
 #define __has_include(inc) 0
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(LIBCXXRT)
   #include <cxxabi.h>
 
   using namespace __cxxabiv1;
diff --git a/src/future.cpp b/src/future.cpp
index c67dc58..0c5c2c4 100644
--- a/src/future.cpp
+++ b/src/future.cpp
@@ -7,6 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "__config"
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 #include "future"
 #include "string"
 
@@ -298,3 +302,5 @@
 }
 
 _LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/src/ios.cpp b/src/ios.cpp
index e241394..d879beb 100644
--- a/src/ios.cpp
+++ b/src/ios.cpp
@@ -7,8 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
-
+#include "__config"
 #include "ios"
 #include "streambuf"
 #include "istream"
@@ -54,11 +53,9 @@
 __iostream_category::message(int ev) const
 {
     if (ev != static_cast<int>(io_errc::stream)
-#ifdef ELAST
-        && ev <= ELAST
-#elif defined(__linux__)
-        && ev <= 4095
-#endif  // ELAST
+#ifdef _LIBCPP_ELAST
+        && ev <= _LIBCPP_ELAST
+#endif  // _LIBCPP_ELAST
         )
         return __do_message::message(ev);
     return string("unspecified iostream_category error");
@@ -151,12 +148,22 @@
 }
 
 // xalloc
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
 #else
 int ios_base::__xindex_ = 0;
 #endif
 
+template <typename _Tp>
+static size_t __ios_new_cap(size_t __req_size, size_t __current_cap)
+{ // Precondition: __req_size > __current_cap
+	const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
+	if (__req_size < mx/2)
+		return _VSTD::max(2 * __current_cap, __req_size);
+	else
+		return mx;
+}
+
 int
 ios_base::xalloc()
 {
@@ -169,14 +176,8 @@
     size_t req_size = static_cast<size_t>(index)+1;
     if (req_size > __iarray_cap_)
     {
-        size_t newcap;
-        const size_t mx = std::numeric_limits<size_t>::max();
-        if (req_size < mx/2)
-            newcap = _VSTD::max(2 * __iarray_cap_, req_size);
-        else
-            newcap = mx;
-        size_t newsize = newcap * sizeof(long);
-        long* iarray = static_cast<long*>(realloc(__iarray_, newsize));
+        size_t newcap = __ios_new_cap<long>(req_size, __iarray_cap_);
+        long* iarray = static_cast<long*>(realloc(__iarray_, newcap * sizeof(long)));
         if (iarray == 0)
         {
             setstate(badbit);
@@ -185,8 +186,9 @@
             return error;
         }
         __iarray_ = iarray;
-        for (long* p = __iarray_ + __iarray_size_; __iarray_cap_ < newcap; ++__iarray_cap_, ++p)
+        for (long* p = __iarray_ + __iarray_size_; p < __iarray_ + newcap; ++p)
             *p = 0;
+        __iarray_cap_ = newcap;
     }
     __iarray_size_ = max<size_t>(__iarray_size_, req_size);
     return __iarray_[index];
@@ -198,14 +200,8 @@
     size_t req_size = static_cast<size_t>(index)+1;
     if (req_size > __parray_cap_)
     {
-        size_t newcap;
-        const size_t mx = std::numeric_limits<size_t>::max();
-        if (req_size < mx/2)
-            newcap = _VSTD::max(2 * __parray_cap_, req_size);
-        else
-            newcap = mx;
-        size_t newsize = newcap * sizeof(void*);
-        void** parray = static_cast<void**>(realloc(__parray_, newsize));
+        size_t newcap = __ios_new_cap<void *>(req_size, __iarray_cap_);
+        void** parray = static_cast<void**>(realloc(__parray_, newcap * sizeof(void *)));
         if (parray == 0)
         {
             setstate(badbit);
@@ -214,8 +210,9 @@
             return error;
         }
         __parray_ = parray;
-        for (void** p = __parray_ + __parray_size_; __parray_cap_ < newcap; ++__parray_cap_, ++p)
+        for (void** p = __parray_ + __parray_size_; p < __parray_ + newcap; ++p)
             *p = 0;
+        __parray_cap_ = newcap;
     }
     __parray_size_ = max<size_t>(__parray_size_, req_size);
     return __parray_[index];
@@ -229,22 +226,16 @@
     size_t req_size = __event_size_ + 1;
     if (req_size > __event_cap_)
     {
-        size_t newcap;
-        const size_t mx = std::numeric_limits<size_t>::max();
-        if (req_size < mx/2)
-            newcap = _VSTD::max(2 * __event_cap_, req_size);
-        else
-            newcap = mx;
-        size_t newesize = newcap * sizeof(event_callback);
-        event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newesize));
+        size_t newcap = __ios_new_cap<event_callback>(req_size, __event_cap_);
+        event_callback* fns = static_cast<event_callback*>(realloc(__fn_, newcap * sizeof(event_callback)));
         if (fns == 0)
             setstate(badbit);
         __fn_ = fns;
-        size_t newisize = newcap * sizeof(int);
-        int* indxs = static_cast<int *>(realloc(__index_, newisize));
+        int* indxs = static_cast<int *>(realloc(__index_, newcap * sizeof(int)));
         if (indxs == 0)
             setstate(badbit);
         __index_ = indxs;
+        __event_cap_ = newcap;
     }
     __fn_[__event_size_] = fn;
     __index_[__event_size_] = index;
diff --git a/src/locale.cpp b/src/locale.cpp
index 7d99961..191b239 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -7,8 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
-
 // On Solaris, we need to define something to make the C99 parts of localeconv
 // visible.
 #ifdef __sun__
@@ -42,17 +40,6 @@
 #pragma clang diagnostic ignored "-Wsign-conversion"
 #endif
 
-// @LOCALMOD-START Newlib doesn't have the following C extensions for locales.
-#if defined(_NEWLIB_VERSION)
-extern "C" {
-  locale_t duplocale(locale_t) { return NULL; }
-  void freelocale(locale_t) { }
-  locale_t newlocale(int, const char *, locale_t) { return NULL; }
-  locale_t uselocale(locale_t) { return NULL; }
-}
-#endif
- // @LOCALMOD-END
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #ifdef __cloc_defined
diff --git a/src/memory.cpp b/src/memory.cpp
index 666673f..c56d031 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -9,8 +9,10 @@
 
 #define _LIBCPP_BUILDING_MEMORY
 #include "memory"
+#ifndef _LIBCPP_HAS_NO_THREADS
 #include "mutex"
 #include "thread"
+#endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -119,7 +121,7 @@
 
 #endif  // _LIBCPP_NO_RTTI
 
-#if __has_feature(cxx_atomic)
+#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
 
 static const std::size_t __sp_mut_count = 16;
 static pthread_mutex_t mut_back_imp[__sp_mut_count] =
@@ -172,7 +174,7 @@
     return muts[hash<const void*>()(p) & (__sp_mut_count-1)];
 }
 
-#endif // __has_feature(cxx_atomic)
+#endif // __has_feature(cxx_atomic) && !_LIBCPP_HAS_NO_THREADS
 
 void
 declare_reachable(void*)
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 0767897..e56271d 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -14,6 +14,7 @@
 #include "cassert"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef _LIBCPP_HAS_NO_THREADS
 
 const defer_lock_t  defer_lock = {};
 const try_to_lock_t try_to_lock = {};
@@ -206,18 +207,42 @@
     }
 }
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 // If dispatch_once_f ever handles C++ exceptions, and if one can get to it
 // without illegal macros (unexpected macros not beginning with _UpperCase or
 // __lowercase), and if it stops spinning waiting threads, then call_once should
 // call into dispatch_once_f instead of here. Relevant radar this code needs to
 // keep in sync with:  7741191.
 
+#ifndef _LIBCPP_HAS_NO_THREADS
 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t  cv  = PTHREAD_COND_INITIALIZER;
+#endif
 
 void
 __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
 {
+#if defined(_LIBCPP_HAS_NO_THREADS)
+    if (flag == 0)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        try
+        {
+#endif  // _LIBCPP_NO_EXCEPTIONS
+            flag = 1;
+            func(arg);
+            flag = ~0ul;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        }
+        catch (...)
+        {
+            flag = 0ul;
+            throw;
+        }
+#endif  // _LIBCPP_NO_EXCEPTIONS
+    }
+#else // !_LIBCPP_HAS_NO_THREADS
     pthread_mutex_lock(&mut);
     while (flag == 1)
         pthread_cond_wait(&cv, &mut);
@@ -248,6 +273,8 @@
     }
     else
         pthread_mutex_unlock(&mut);
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 }
 
 _LIBCPP_END_NAMESPACE_STD
diff --git a/src/new.cpp b/src/new.cpp
index 3b7c341..a88d4cc 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -17,7 +17,7 @@
 #define __has_include(inc) 0
 #endif
 
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(LIBCXXRT)
     #include <cxxabi.h>
 
     #ifndef _LIBCPPABI_VERSION
@@ -192,8 +192,6 @@
 
 #endif // !__GLIBCXX__
 
-#endif //LIBCXXRT
-
 bad_array_new_length::bad_array_new_length() _NOEXCEPT
 {
 }
@@ -203,6 +201,14 @@
 }
 
 const char*
+bad_array_new_length::what() const _NOEXCEPT
+{
+    return "bad_array_new_length";
+}
+
+#endif //LIBCXXRT
+
+const char*
 bad_array_length::what() const _NOEXCEPT
 {
     return "bad_array_length";
@@ -216,12 +222,6 @@
 {
 }
 
-const char*
-bad_array_new_length::what() const _NOEXCEPT
-{
-    return "bad_array_new_length";
-}
-
 #endif // _LIBCPPABI_VERSION
 
 #ifndef LIBSTDCXX
diff --git a/src/random.cpp b/src/random.cpp
index ab17bd1..15ed65b 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -11,28 +11,27 @@
 // Must be defined before including stdlib.h to enable rand_s().
 #define _CRT_RAND_S
 #include <stdio.h>
-#endif
+#endif // defined(_WIN32)
 
 #include "random"
 #include "system_error"
 
-#ifdef __sun__
+#if defined(__sun__)
 #define rename solaris_headers_are_broken
-#endif
+#endif // defined(__sun__)
 #if !defined(_WIN32)
 #include <fcntl.h>
 #include <unistd.h>
-#endif // defined(_WIN32)
+#endif // !defined(_WIN32)
 #include <errno.h>
-// @LOCALMOD-START
-#if defined(__native_client__)
+#if defined(_LIBCPP_USING_NACL_RANDOM)
 #include <nacl/nacl_random.h>
-#endif
-// @LOCALMOD-END
+#endif // defined(_LIBCPP_USING_NACL_RANDOM)
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 #if defined(_WIN32)
+
 random_device::random_device(const string&)
 {
 }
@@ -50,33 +49,20 @@
         __throw_system_error(err, "random_device rand_s failed.");
     return r;
 }
-#else
+
+#elif defined(_LIBCPP_USING_NACL_RANDOM)
+
 random_device::random_device(const string& __token)
-// @LOCALMOD-START
-#if defined(__native_client__)
 {
     if (__token != "/dev/urandom")
-        __throw_system_error(ENODEV, ("random device not supported " + __token).c_str());
+        __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
     int error = nacl_secure_random_init();
     if (error)
         __throw_system_error(error, ("random device failed to open " + __token).c_str());
 }
-#else
-    : __f_(open(__token.c_str(), O_RDONLY))
-{
-    if (__f_ < 0)
-        __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
-}
-#endif
-// @LOCALMOD-END
 
 random_device::~random_device()
 {
-// @LOCALMOD-START
-#if !defined(__native_client__)
-    close(__f_);
-#endif
-// @LOCALMOD-END
 }
 
 unsigned
@@ -85,15 +71,35 @@
     unsigned r;
     size_t n = sizeof(r);
     char* p = reinterpret_cast<char*>(&r);
-// @LOCALMOD-START
-#if defined(__native_client__)
     size_t bytes_written;
     int error = nacl_secure_random(&r, n, &bytes_written);
     if (error != 0)
         __throw_system_error(error, "random_device failed getting bytes");
     else if (bytes_written != n)
-        __throw_runtime_error("random_device failed obtaining enough bytes");
-#else
+        __throw_runtime_error("random_device failed to obtain enough bytes");
+    return r;
+}
+
+#else // !defined(_WIN32) && !defined(_LIBCPP_USING_NACL_RANDOM)
+
+random_device::random_device(const string& __token)
+    : __f_(open(__token.c_str(), O_RDONLY))
+{
+    if (__f_ < 0)
+        __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
+}
+
+random_device::~random_device()
+{
+    close(__f_);
+}
+
+unsigned
+random_device::operator()()
+{
+    unsigned r;
+    size_t n = sizeof(r);
+    char* p = reinterpret_cast<char*>(&r);
     while (n > 0)
     {
         ssize_t s = read(__f_, p, n);
@@ -108,11 +114,10 @@
         n -= static_cast<size_t>(s);
         p += static_cast<size_t>(s);
     }
-#endif
-// @LOCALMOD-END
     return r;
 }
-#endif // defined(_WIN32)
+
+#endif // defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM)
 
 double
 random_device::entropy() const _NOEXCEPT
diff --git a/src/shared_mutex.cpp b/src/shared_mutex.cpp
index dd78a16..2b78c1f 100644
--- a/src/shared_mutex.cpp
+++ b/src/shared_mutex.cpp
@@ -7,6 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "__config"
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 #define _LIBCPP_BUILDING_SHARED_MUTEX
 #include "shared_mutex"
 
@@ -99,3 +102,5 @@
 
 
 _LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/src/string.cpp b/src/string.cpp
index fde5212..febc532 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -7,8 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
-
 #include "string"
 #include "cstdlib"
 #include "cwchar"
@@ -65,7 +63,7 @@
 V
 as_integer_helper(const string& func, const S& str, size_t* idx, int base, F f)
 {
-    typename S::value_type* ptr;
+    typename S::value_type* ptr = nullptr;
     const typename S::value_type* const p = str.c_str();
     typename remove_reference<decltype(errno)>::type errno_save = errno;
     errno = 0;
@@ -182,7 +180,7 @@
 V
 as_float_helper(const string& func, const S& str, size_t* idx, F f )
 {
-    typename S::value_type* ptr;
+    typename S::value_type* ptr = nullptr;
     const typename S::value_type* const p = str.c_str();
     typename remove_reference<decltype(errno)>::type errno_save = errno;
     errno = 0;
diff --git a/src/support/solaris/xlocale.c b/src/support/solaris/xlocale.c
index 39dd8e3..81750a8 100644
--- a/src/support/solaris/xlocale.c
+++ b/src/support/solaris/xlocale.c
@@ -17,7 +17,7 @@
 #include <limits.h>
 #include <assert.h>
 #include <sys/localedef.h>
-#include "xlocale.h"
+#include "support/solaris/xlocale.h"
 
 static _LC_locale_t *__C_locale;
 
diff --git a/src/system_error.cpp b/src/system_error.cpp
index d5cb2d4..9c8adc4 100644
--- a/src/system_error.cpp
+++ b/src/system_error.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #define _LIBCPP_BUILDING_SYSTEM_ERROR
+#include "__config"
 #include "system_error"
 #include "string"
 #include "cstring"
@@ -65,13 +66,10 @@
 string
 __generic_error_category::message(int ev) const
 {
-#ifdef ELAST
-    if (ev > ELAST)
+#ifdef _LIBCPP_ELAST
+    if (ev > _LIBCPP_ELAST)
       return string("unspecified generic_category error");
-#elif defined(__linux__)
-    if (ev > 4095)
-      return string("unspecified generic_category error");
-#endif  // ELAST
+#endif  // _LIBCPP_ELAST
     return __do_message::message(ev);
 }
 
@@ -100,26 +98,20 @@
 string
 __system_error_category::message(int ev) const
 {
-#ifdef ELAST
-    if (ev > ELAST)
+#ifdef _LIBCPP_ELAST
+    if (ev > _LIBCPP_ELAST)
       return string("unspecified system_category error");
-#elif defined(__linux__)
-    if (ev > 4095)
-      return string("unspecified system_category error");
-#endif  // ELAST
+#endif  // _LIBCPP_ELAST
     return __do_message::message(ev);
 }
 
 error_condition
 __system_error_category::default_error_condition(int ev) const _NOEXCEPT
 {
-#ifdef ELAST
-    if (ev > ELAST)
+#ifdef _LIBCPP_ELAST
+    if (ev > _LIBCPP_ELAST)
       return error_condition(ev, system_category());
-#elif defined(__linux__)
-    if (ev > 4095)
-      return error_condition(ev, system_category());
-#endif  // ELAST
+#endif  // _LIBCPP_ELAST
     return error_condition(ev, generic_category());
 }
 
diff --git a/src/thread.cpp b/src/thread.cpp
index 91b39d6..6a18e2c 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -7,6 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "__config"
+#ifndef _LIBCPP_HAS_NO_THREADS
+
 #include "thread"
 #include "exception"
 #include "vector"
@@ -225,3 +228,5 @@
 }
 
 _LIBCPP_END_NAMESPACE_STD
+
+#endif // !_LIBCPP_HAS_NO_THREADS
diff --git a/src/valarray.cpp b/src/valarray.cpp
index e4c9ed0..2d8db52 100644
--- a/src/valarray.cpp
+++ b/src/valarray.cpp
@@ -7,8 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
-
 #include "valarray"
 
 _LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4810b2c..7236dec 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,7 +14,7 @@
     set(LIT_EXECUTABLE "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
   endif()
 
-  set(LIT_ARGS_DEFAULT "-sv")
+  set(LIT_ARGS_DEFAULT "-sv --show-unsupported --show-xfail")
   if (MSVC OR XCODE)
     set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
   endif()
@@ -28,7 +28,6 @@
   set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR})
   set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
   pythonize_bool(LIBCXX_ENABLE_SHARED)
-  pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG)
 
   set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
 
diff --git a/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
index fe67854..0cf06bb 100644
--- a/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
+++ b/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp
@@ -28,31 +28,26 @@
     int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
     const unsigned sa = sizeof(ia)/sizeof(ia[0]);
     int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
-    assert(std::mismatch(input_iterator<const int*>(ia),
-                         input_iterator<const int*>(ia + sa),
-                         input_iterator<const int*>(ib)) ==
-                         (std::pair<input_iterator<const int*>,
-                                    input_iterator<const int*> >(
-                            input_iterator<const int*>(ia+3),
-                            input_iterator<const int*>(ib+3))));
+    const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+
+	typedef input_iterator<const int*> II;
+	typedef random_access_iterator<const int*>  RAI;
+
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib))
+    		== (std::pair<II, II>(II(ia+3), II(ib+3))));
+
+    assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib))
+    		== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
 
 #ifdef HAS_FOUR_ITERATOR_VERSION
-    assert(std::mismatch(input_iterator<const int*>(ia),
-                         input_iterator<const int*>(ia + sa),
-                         input_iterator<const int*>(ib),
-                         input_iterator<const int*>(ib + sa)) ==
-                         (std::pair<input_iterator<const int*>,
-                                    input_iterator<const int*> >(
-                            input_iterator<const int*>(ia+3),
-                            input_iterator<const int*>(ib+3))));
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+sb))
+    		== (std::pair<II, II>(II(ia+3), II(ib+3))));
 
-    assert(std::mismatch(input_iterator<const int*>(ia),
-                         input_iterator<const int*>(ia + sa),
-                         input_iterator<const int*>(ib),
-                         input_iterator<const int*>(ib + 2)) ==
-                         (std::pair<input_iterator<const int*>,
-                                    input_iterator<const int*> >(
-                            input_iterator<const int*>(ia+2),
-                            input_iterator<const int*>(ib+2))));
+    assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib+sb))
+    		== (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
+
+
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib+2))
+    		== (std::pair<II, II>(II(ia+2), II(ib+2))));
 #endif
 }
diff --git a/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp b/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
index 202a1b7..ce0326c 100644
--- a/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
+++ b/test/algorithms/alg.nonmodifying/mismatch/mismatch_pred.pass.cpp
@@ -20,43 +20,52 @@
 #include <cassert>
 
 #include "test_iterators.h"
+#include "counting_predicates.hpp"
 
 #if _LIBCPP_STD_VER > 11
 #define HAS_FOUR_ITERATOR_VERSION
 #endif
 
-
 int main()
 {
     int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
     const unsigned sa = sizeof(ia)/sizeof(ia[0]);
     int ib[] = {0, 1, 2, 3, 0, 1, 2, 3};
-    assert(std::mismatch(input_iterator<const int*>(ia),
-                         input_iterator<const int*>(ia + sa),
-                         input_iterator<const int*>(ib),
-                         std::equal_to<int>()) ==
-                         (std::pair<input_iterator<const int*>,
-                                    input_iterator<const int*> >(
-                            input_iterator<const int*>(ia+3),
-                            input_iterator<const int*>(ib+3))));
+    const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+    
+	typedef input_iterator<const int*> II;
+	typedef random_access_iterator<const int*>  RAI;
+	typedef std::equal_to<int> EQ;
+
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib), EQ())
+            == (std::pair<II, II>(II(ia+3), II(ib+3))));
+    assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), EQ())
+            == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
+
+    binary_counting_predicate<EQ, int> bcp((EQ()));
+    assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), std::ref(bcp))
+            == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
+	assert(bcp.count() > 0 && bcp.count() < sa);
+	bcp.reset();
+		
 #ifdef HAS_FOUR_ITERATOR_VERSION
-    assert(std::mismatch(input_iterator<const int*>(ia),
-                         input_iterator<const int*>(ia + sa),
-                         input_iterator<const int*>(ib),
-                         input_iterator<const int*>(ib + sa),
-                         std::equal_to<int>()) ==
-                         (std::pair<input_iterator<const int*>,
-                                    input_iterator<const int*> >(
-                            input_iterator<const int*>(ia+3),
-                            input_iterator<const int*>(ib+3))));
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), EQ())
+            == (std::pair<II, II>(II(ia+3), II(ib+3))));
+    assert(std::mismatch(RAI(ia), RAI(ia + sa), RAI(ib), RAI(ib + sb), EQ())
+            == (std::pair<RAI, RAI>(RAI(ia+3), RAI(ib+3))));
+
+    assert(std::mismatch(II(ia), II(ia + sa), II(ib), II(ib + sb), std::ref(bcp))
+            == (std::pair<II, II>(II(ia+3), II(ib+3))));
+	assert(bcp.count() > 0 && bcp.count() < std::min(sa, sb));
 #endif
 
-    assert(std::mismatch(ia, ia + sa, ib, std::equal_to<int>()) ==
+    assert(std::mismatch(ia, ia + sa, ib, EQ()) ==
            (std::pair<int*,int*>(ia+3,ib+3)));
+
 #ifdef HAS_FOUR_ITERATOR_VERSION
-    assert(std::mismatch(ia, ia + sa, ib, ib + sa, std::equal_to<int>()) ==
+    assert(std::mismatch(ia, ia + sa, ib, ib + sb, EQ()) ==
            (std::pair<int*,int*>(ia+3,ib+3)));
-    assert(std::mismatch(ia, ia + sa, ib, ib + 2, std::equal_to<int>()) ==
+    assert(std::mismatch(ia, ia + sa, ib, ib + 2, EQ()) ==
            (std::pair<int*,int*>(ia+2,ib+2)));
 #endif
 }
diff --git a/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp b/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
index 65e1d38..aec060c 100644
--- a/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
+++ b/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp b/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
index 8c2abc0..4f3b0e3 100644
--- a/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
+++ b/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/atomic_flag_clear.pass.cpp b/test/atomics/atomics.flag/atomic_flag_clear.pass.cpp
index 12be67c..64093d6 100644
--- a/test/atomics/atomics.flag/atomic_flag_clear.pass.cpp
+++ b/test/atomics/atomics.flag/atomic_flag_clear.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp b/test/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
index f1065dc..e1a9349 100644
--- a/test/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
+++ b/test/atomics/atomics.flag/atomic_flag_clear_explicit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp b/test/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
index e3934d8..ae82df9 100644
--- a/test/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
+++ b/test/atomics/atomics.flag/atomic_flag_test_and_set.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp b/test/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
index 83ee78d..1548506 100644
--- a/test/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
+++ b/test/atomics/atomics.flag/atomic_flag_test_and_set_explicit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/clear.pass.cpp b/test/atomics/atomics.flag/clear.pass.cpp
index 171f038..65051af 100644
--- a/test/atomics/atomics.flag/clear.pass.cpp
+++ b/test/atomics/atomics.flag/clear.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/default.pass.cpp b/test/atomics/atomics.flag/default.pass.cpp
index 5c077b0..45f5e70 100644
--- a/test/atomics/atomics.flag/default.pass.cpp
+++ b/test/atomics/atomics.flag/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/init.pass.cpp b/test/atomics/atomics.flag/init.pass.cpp
index 8a67e14..c90509d 100644
--- a/test/atomics/atomics.flag/init.pass.cpp
+++ b/test/atomics/atomics.flag/init.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.flag/test_and_set.pass.cpp b/test/atomics/atomics.flag/test_and_set.pass.cpp
index 2405275..210ba20 100644
--- a/test/atomics/atomics.flag/test_and_set.pass.cpp
+++ b/test/atomics/atomics.flag/test_and_set.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.lockfree/lockfree.pass.cpp b/test/atomics/atomics.lockfree/lockfree.pass.cpp
index 467f561..a975a69 100644
--- a/test/atomics/atomics.lockfree/lockfree.pass.cpp
+++ b/test/atomics/atomics.lockfree/lockfree.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.order/kill_dependency.pass.cpp b/test/atomics/atomics.order/kill_dependency.pass.cpp
index 1beeb08..0f0bafc 100644
--- a/test/atomics/atomics.order/kill_dependency.pass.cpp
+++ b/test/atomics/atomics.order/kill_dependency.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.order/memory_order.pass.cpp b/test/atomics/atomics.order/memory_order.pass.cpp
index 8289304..e734a4c 100644
--- a/test/atomics/atomics.order/memory_order.pass.cpp
+++ b/test/atomics/atomics.order/memory_order.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.generic/address.pass.cpp b/test/atomics/atomics.types.generic/address.pass.cpp
index af9826f..3b9f3ce 100644
--- a/test/atomics/atomics.types.generic/address.pass.cpp
+++ b/test/atomics/atomics.types.generic/address.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test case crashes clang.
 
 // <atomic>
 
@@ -70,6 +73,8 @@
 #include <type_traits>
 #include <cassert>
 
+#include <cmpxchg_loop.h>
+
 template <class A, class T>
 void
 do_test()
@@ -93,7 +98,7 @@
     assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
     assert(obj == T(3));
     T x = obj;
-    assert(obj.compare_exchange_weak(x, T(2)) == true);
+    assert(cmpxchg_weak_loop(obj, x, T(2)) == true);
     assert(obj == T(2));
     assert(x == T(3));
     assert(obj.compare_exchange_weak(x, T(1)) == false);
diff --git a/test/atomics/atomics.types.generic/bool.pass.cpp b/test/atomics/atomics.types.generic/bool.pass.cpp
index 80e5665..dd851e8 100644
--- a/test/atomics/atomics.types.generic/bool.pass.cpp
+++ b/test/atomics/atomics.types.generic/bool.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
@@ -53,6 +55,8 @@
 #include <new>
 #include <cassert>
 
+#include <cmpxchg_loop.h>
+
 int main()
 {
     {
@@ -64,6 +68,7 @@
         std::atomic_init(&obj, true);
         assert(obj == true);
         bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
         obj.store(false);
         assert(obj == false);
         obj.store(true, std::memory_order_release);
@@ -75,7 +80,7 @@
         assert(obj.exchange(true, std::memory_order_relaxed) == false);
         assert(obj == true);
         bool x = obj;
-        assert(obj.compare_exchange_weak(x, false) == true);
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
         assert(obj == false);
         assert(x == true);
         assert(obj.compare_exchange_weak(x, true,
@@ -84,9 +89,9 @@
         assert(x == false);
         obj.store(true);
         x = true;
-        assert(obj.compare_exchange_weak(x, false,
-                                         std::memory_order_seq_cst,
-                                         std::memory_order_seq_cst) == true);
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
         assert(obj == false);
         assert(x == true);
         x = true;
@@ -119,6 +124,7 @@
         std::atomic_init(&obj, true);
         assert(obj == true);
         bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
         obj.store(false);
         assert(obj == false);
         obj.store(true, std::memory_order_release);
@@ -130,7 +136,7 @@
         assert(obj.exchange(true, std::memory_order_relaxed) == false);
         assert(obj == true);
         bool x = obj;
-        assert(obj.compare_exchange_weak(x, false) == true);
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
         assert(obj == false);
         assert(x == true);
         assert(obj.compare_exchange_weak(x, true,
@@ -139,9 +145,9 @@
         assert(x == false);
         obj.store(true);
         x = true;
-        assert(obj.compare_exchange_weak(x, false,
-                                         std::memory_order_seq_cst,
-                                         std::memory_order_seq_cst) == true);
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
         assert(obj == false);
         assert(x == true);
         x = true;
@@ -174,6 +180,7 @@
         std::atomic_init(&obj, true);
         assert(obj == true);
         bool b0 = obj.is_lock_free();
+        (void)b0; // to placate scan-build
         obj.store(false);
         assert(obj == false);
         obj.store(true, std::memory_order_release);
@@ -185,7 +192,7 @@
         assert(obj.exchange(true, std::memory_order_relaxed) == false);
         assert(obj == true);
         bool x = obj;
-        assert(obj.compare_exchange_weak(x, false) == true);
+        assert(cmpxchg_weak_loop(obj, x, false) == true);
         assert(obj == false);
         assert(x == true);
         assert(obj.compare_exchange_weak(x, true,
@@ -194,9 +201,9 @@
         assert(x == false);
         obj.store(true);
         x = true;
-        assert(obj.compare_exchange_weak(x, false,
-                                         std::memory_order_seq_cst,
-                                         std::memory_order_seq_cst) == true);
+        assert(cmpxchg_weak_loop(obj, x, false,
+                                 std::memory_order_seq_cst,
+                                 std::memory_order_seq_cst) == true);
         assert(obj == false);
         assert(x == true);
         x = true;
diff --git a/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp b/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
index eac5177..a7874b9 100644
--- a/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
+++ b/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.generic/integral.pass.cpp b/test/atomics/atomics.types.generic/integral.pass.cpp
index 26caa50..f9c7583 100644
--- a/test/atomics/atomics.types.generic/integral.pass.cpp
+++ b/test/atomics/atomics.types.generic/integral.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
@@ -88,6 +90,8 @@
 #include <new>
 #include <cassert>
 
+#include <cmpxchg_loop.h>
+
 template <class A, class T>
 void
 do_test()
@@ -110,7 +114,7 @@
     assert(obj.exchange(T(3), std::memory_order_relaxed) == T(2));
     assert(obj == T(3));
     T x = obj;
-    assert(obj.compare_exchange_weak(x, T(2)) == true);
+    assert(cmpxchg_weak_loop(obj, x, T(2)) == true);
     assert(obj == T(2));
     assert(x == T(3));
     assert(obj.compare_exchange_weak(x, T(1)) == false);
diff --git a/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp b/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp
index c622d6e..e8fae85 100644
--- a/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp
+++ b/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp b/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp
index 49ec069..f2bf4db 100644
--- a/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp
+++ b/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp
@@ -54,17 +54,17 @@
 #include <chrono> // for nanoseconds
 
 struct NotTriviallyCopyable {
-	NotTriviallyCopyable ( int i ) : i_(i) {}
-	NotTriviallyCopyable ( const NotTriviallyCopyable &rhs) : i_(rhs.i_) {}
-	int i_;
-	};
+    NotTriviallyCopyable ( int i ) : i_(i) {}
+    NotTriviallyCopyable ( const NotTriviallyCopyable &rhs) : i_(rhs.i_) {}
+    int i_;
+    };
 
 template <class T>
 void test ( T t ) {
-	std::atomic<T> t0(t);
-	}
+    std::atomic<T> t0(t);
+    }
 
 int main()
 {
-	test(NotTriviallyCopyable(42));
+    test(NotTriviallyCopyable(42));
 }
diff --git a/test/atomics/atomics.types.generic/trivially_copyable.pass.cpp b/test/atomics/atomics.types.generic/trivially_copyable.pass.cpp
index 8cdd087..e6e9bcc 100644
--- a/test/atomics/atomics.types.generic/trivially_copyable.pass.cpp
+++ b/test/atomics/atomics.types.generic/trivially_copyable.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
@@ -54,18 +56,18 @@
 #include <chrono> // for nanoseconds
 
 struct TriviallyCopyable {
-	TriviallyCopyable ( int i ) : i_(i) {}
-	int i_;
-	};
+    TriviallyCopyable ( int i ) : i_(i) {}
+    int i_;
+    };
 
 template <class T>
 void test ( T t ) {
-	std::atomic<T> t0(t);
-	}
+    std::atomic<T> t0(t);
+    }
 
 int main()
 {
-	test(TriviallyCopyable(42));
-	test(std::this_thread::get_id());
-	test(std::chrono::nanoseconds(2));
+    test(TriviallyCopyable(42));
+    test(std::this_thread::get_id());
+    test(std::chrono::nanoseconds(2));
 }
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
index fd5102b..f1cc993 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
 
 // <atomic>
 
@@ -55,7 +58,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
index f2610a3..f667ab7 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 38
 
 // <atomic>
 
@@ -62,7 +65,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
index a3f95a4..175c445 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
 
 // <atomic>
 
@@ -21,6 +24,8 @@
 #include <type_traits>
 #include <cassert>
 
+#include <cmpxchg_loop.h>
+
 template <class T>
 void
 test()
@@ -30,7 +35,7 @@
         A a;
         T t(T(1));
         std::atomic_init(&a, t);
-        assert(std::atomic_compare_exchange_weak(&a, &t, T(2)) == true);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2)) == true);
         assert(a == T(2));
         assert(t == T(1));
         assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
@@ -42,7 +47,7 @@
         volatile A a;
         T t(T(1));
         std::atomic_init(&a, t);
-        assert(std::atomic_compare_exchange_weak(&a, &t, T(2)) == true);
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2)) == true);
         assert(a == T(2));
         assert(t == T(1));
         assert(std::atomic_compare_exchange_weak(&a, &t, T(3)) == false);
@@ -55,7 +60,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
index 2f3e996..46f80bf 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 38
 
 // <atomic>
 
@@ -24,6 +27,8 @@
 #include <type_traits>
 #include <cassert>
 
+#include <cmpxchg_loop.h>
+
 template <class T>
 void
 test()
@@ -33,7 +38,7 @@
         A a;
         T t(T(1));
         std::atomic_init(&a, t);
-        assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(2),
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2),
                std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
         assert(a == T(2));
         assert(t == T(1));
@@ -47,7 +52,7 @@
         volatile A a;
         T t(T(1));
         std::atomic_init(&a, t);
-        assert(std::atomic_compare_exchange_weak_explicit(&a, &t, T(2),
+        assert(c_cmpxchg_weak_loop(&a, &t, T(2),
                std::memory_order_seq_cst, std::memory_order_seq_cst) == true);
         assert(a == T(2));
         assert(t == T(1));
@@ -62,7 +67,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
index 4264943..525e74a 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... fails assertion line 31
 
 // <atomic>
 
@@ -40,7 +43,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
index 0f3add5..9fe4ac8 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_exchange_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 32
 
 // <atomic>
 
@@ -42,7 +45,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
index 9ce60ad..3408def 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
 
 // <atomic>
 
@@ -75,7 +78,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
     A(const A& a) : i(a.i) {}
     A(const volatile A& a) : i(a.i) {}
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
index a2a1a44..9977bd4 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
 
 // <atomic>
 
@@ -79,7 +82,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
     A(const A& a) : i(a.i) {}
     A(const volatile A& a) : i(a.i) {}
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
index 01d2cc6..4c7c043 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
index abfb83d..d83bbf2 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_and_explicit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
index 43b6c4f..acf6d43 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
index 21078bb..72685e4 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_or_explicit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
index d33b81e..ed8b541 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
 
 // <atomic>
 
@@ -75,7 +78,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
     A(const A& a) : i(a.i) {}
     A(const volatile A& a) : i(a.i) {}
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
index 886a65f..e6c92ea 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... test crashes clang
 
 // <atomic>
 
@@ -80,7 +83,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
     A(const A& a) : i(a.i) {}
     A(const volatile A& a) : i(a.i) {}
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
index 78120a7..fc6b97b 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
index 0a0cd15..58772aa 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_xor_explicit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
index f0d9a24..137b6f6 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_init.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
 
 // <atomic>
 
@@ -38,7 +41,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
index 4071989..18a1605 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_is_lock_free.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
index b239886..66918c7 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 34
 
 // <atomic>
 
@@ -38,7 +41,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
index 3072dd5..5f402a9 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_load_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
 
 // <atomic>
 
@@ -38,7 +41,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
index f9044bf..2b9582b 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
 
 // <atomic>
 
@@ -38,7 +41,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
index 18038ae..8fe0c7d 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_store_explicit.pass.cpp
@@ -6,6 +6,9 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
+//  ... assertion fails line 31
 
 // <atomic>
 
@@ -38,7 +41,7 @@
 {
     int i;
 
-    explicit A(int d = 0) : i(d) {}
+    explicit A(int d = 0) noexcept {i=d;}
 
     friend bool operator==(const A& x, const A& y)
         {return x.i == y.i;}
diff --git a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
index 6758c7b..5fed691 100644
--- a/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
+++ b/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/atomics/libcpp-has-no-threads.fail.cpp b/test/atomics/libcpp-has-no-threads.fail.cpp
new file mode 100644
index 0000000..fe95e6a
--- /dev/null
+++ b/test/atomics/libcpp-has-no-threads.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// Test that including <atomic> fails to compile when _LIBCPP_HAS_NO_THREADS
+// is defined.
+
+#ifndef _LIBCPP_HAS_NO_THREADS
+#define _LIBCPP_HAS_NO_THREADS
+#endif
+
+#include <atomic>
+
+int main()
+{
+}
diff --git a/test/atomics/libcpp-has-no-threads.pass.cpp b/test/atomics/libcpp-has-no-threads.pass.cpp
new file mode 100644
index 0000000..9c0cccb
--- /dev/null
+++ b/test/atomics/libcpp-has-no-threads.pass.cpp
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+// XFAIL: libcpp-has-no-threads
+
+#ifdef _LIBCPP_HAS_NO_THREADS
+#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
+ 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
+#endif
+
+int main()
+{
+}
diff --git a/test/atomics/version.pass.cpp b/test/atomics/version.pass.cpp
index 85c4270..fae2736 100644
--- a/test/atomics/version.pass.cpp
+++ b/test/atomics/version.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <atomic>
 
diff --git a/test/containers/associative/map/map.ops/count.pass.cpp b/test/containers/associative/map/map.ops/count.pass.cpp
index 6628e3d..9668055 100644
--- a/test/containers/associative/map/map.ops/count.pass.cpp
+++ b/test/containers/associative/map/map.ops/count.pass.cpp
@@ -17,6 +17,7 @@
 #include <cassert>
 
 #include "min_allocator.h"
+#include "private_constructor.hpp"
 
 int main()
 {
@@ -96,4 +97,77 @@
     }
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::pair<const int, double> V;
+    typedef std::map<int, double, std::less <>> M;
+    typedef M::size_type R;
+
+    V ar[] =
+    {
+        V(5, 5),
+        V(6, 6),
+        V(7, 7),
+        V(8, 8),
+        V(9, 9),
+        V(10, 10),
+        V(11, 11),
+        V(12, 12)
+    };
+    const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.count(5);
+    assert(r == 1);
+    r = m.count(6);
+    assert(r == 1);
+    r = m.count(7);
+    assert(r == 1);
+    r = m.count(8);
+    assert(r == 1);
+    r = m.count(9);
+    assert(r == 1);
+    r = m.count(10);
+    assert(r == 1);
+    r = m.count(11);
+    assert(r == 1);
+    r = m.count(12);
+    assert(r == 1);
+    r = m.count(4);
+    assert(r == 0);
+    }
+
+    {
+    typedef PrivateConstructor PC;
+    typedef std::map<PC, double, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m [ PC::make(5)  ] = 5;
+    m [ PC::make(6)  ] = 6;
+    m [ PC::make(7)  ] = 7;
+    m [ PC::make(8)  ] = 8;
+    m [ PC::make(9)  ] = 9;
+    m [ PC::make(10) ] = 10;
+    m [ PC::make(11) ] = 11;
+    m [ PC::make(12) ] = 12;
+
+    R r = m.count(5);
+    assert(r == 1);
+    r = m.count(6);
+    assert(r == 1);
+    r = m.count(7);
+    assert(r == 1);
+    r = m.count(8);
+    assert(r == 1);
+    r = m.count(9);
+    assert(r == 1);
+    r = m.count(10);
+    assert(r == 1);
+    r = m.count(11);
+    assert(r == 1);
+    r = m.count(12);
+    assert(r == 1);
+    r = m.count(4);
+    assert(r == 0);
+    }
+#endif
 }
diff --git a/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp b/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index ebae10e..33821d3 100644
--- a/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/test/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -71,6 +71,7 @@
         assert(next(m.begin(), 5)->second == 2);
 
         i = m.erase(3);
+        assert(i == 3);
         assert(m.size() == 3);
         assert(next(m.begin(), 0)->first == 1);
         assert(next(m.begin(), 0)->second == 1);
@@ -135,6 +136,7 @@
         assert(next(m.begin(), 5)->second == 2);
 
         i = m.erase(3);
+        assert(i == 3);
         assert(m.size() == 3);
         assert(next(m.begin(), 0)->first == 1);
         assert(next(m.begin(), 0)->second == 1);
diff --git a/test/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/containers/associative/multimap/multimap.ops/count.pass.cpp
index 34c0413..2f172d1 100644
--- a/test/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/test/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -17,6 +17,7 @@
 #include <cassert>
 
 #include "min_allocator.h"
+#include "private_constructor.hpp"
 
 int main()
 {
@@ -89,4 +90,70 @@
     }
     }
 #endif
+
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef std::multimap<int, double, std::less<>> M;
+    typedef M::size_type R;
+    V ar[] =
+    {
+        V(5, 1),
+        V(5, 2),
+        V(5, 3),
+        V(7, 1),
+        V(7, 2),
+        V(7, 3),
+        V(9, 1),
+        V(9, 2),
+        V(9, 3)
+    };
+    const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 3);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 3);
+    r = m.count(10);
+    assert(r == 0);
+    }
+
+    {
+    typedef PrivateConstructor PC;
+    typedef std::multimap<PC, double, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(5), 3 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(7), 3 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 1 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 2 ));
+    m.insert ( std::make_pair<PC, double> ( PC::make(9), 3 ));
+
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 3);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 3);
+    r = m.count(10);
+    assert(r == 0);
+    }
+#endif
 }
diff --git a/test/containers/associative/multiset/count.pass.cpp b/test/containers/associative/multiset/count.pass.cpp
index 12af167..93bd6f8 100644
--- a/test/containers/associative/multiset/count.pass.cpp
+++ b/test/containers/associative/multiset/count.pass.cpp
@@ -17,6 +17,7 @@
 #include <cassert>
 
 #include "min_allocator.h"
+#include "private_constructor.hpp"
 
 int main()
 {
@@ -90,4 +91,70 @@
     }
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    {
+    typedef int V;
+    typedef std::multiset<int, std::less<>> M;
+    typedef M::size_type R;
+    V ar[] =
+    {
+        5,
+        5,
+        5,
+        5,
+        7,
+        7,
+        7,
+        9,
+        9
+    };
+    const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 4);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 2);
+    r = m.count(10);
+    assert(r == 0);
+    }
+
+    {
+    typedef PrivateConstructor V;
+    typedef std::multiset<V, std::less<>> M;
+    typedef M::size_type R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 9 ));
+
+    R r = m.count(4);
+    assert(r == 0);
+    r = m.count(5);
+    assert(r == 4);
+    r = m.count(6);
+    assert(r == 0);
+    r = m.count(7);
+    assert(r == 3);
+    r = m.count(8);
+    assert(r == 0);
+    r = m.count(9);
+    assert(r == 2);
+    r = m.count(10);
+    assert(r == 0);
+    }
+#endif
 }
diff --git a/test/containers/associative/set/count.pass.cpp b/test/containers/associative/set/count.pass.cpp
index a2dc177..32fe0b8 100644
--- a/test/containers/associative/set/count.pass.cpp
+++ b/test/containers/associative/set/count.pass.cpp
@@ -17,6 +17,7 @@
 #include <cassert>
 
 #include "min_allocator.h"
+#include "private_constructor.hpp"
 
 int main()
 {
@@ -92,4 +93,76 @@
         assert(r == 0);
     }
 #endif
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef int V;
+        typedef std::set<int, std::less<>> M;
+        typedef M::size_type R;
+        V ar[] =
+        {
+            5,
+            6,
+            7,
+            8,
+            9,
+            10,
+            11,
+            12
+        };
+        const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+        R r = m.count(5);
+        assert(r == 1);
+        r = m.count(6);
+        assert(r == 1);
+        r = m.count(7);
+        assert(r == 1);
+        r = m.count(8);
+        assert(r == 1);
+        r = m.count(9);
+        assert(r == 1);
+        r = m.count(10);
+        assert(r == 1);
+        r = m.count(11);
+        assert(r == 1);
+        r = m.count(12);
+        assert(r == 1);
+        r = m.count(4);
+        assert(r == 0);
+    }
+    {
+    typedef PrivateConstructor V;
+    typedef std::set<V, std::less<>> M;
+        typedef M::size_type R;
+
+    M m;
+    m.insert ( V::make ( 5 ));
+    m.insert ( V::make ( 6 ));
+    m.insert ( V::make ( 7 ));
+    m.insert ( V::make ( 8 ));
+    m.insert ( V::make ( 9 ));
+    m.insert ( V::make ( 10 ));
+    m.insert ( V::make ( 11 ));
+    m.insert ( V::make ( 12 ));
+
+    R r = m.count(5);
+    assert(r == 1);
+    r = m.count(6);
+    assert(r == 1);
+    r = m.count(7);
+    assert(r == 1);
+    r = m.count(8);
+    assert(r == 1);
+    r = m.count(9);
+    assert(r == 1);
+    r = m.count(10);
+    assert(r == 1);
+    r = m.count(11);
+    assert(r == 1);
+    r = m.count(12);
+    assert(r == 1);
+    r = m.count(4);
+    assert(r == 0);
+    }
+#endif
+
 }
diff --git a/test/containers/sequences/array/array.data/data.pass.cpp b/test/containers/sequences/array/array.data/data.pass.cpp
index ea91357..08e4fd3 100644
--- a/test/containers/sequences/array/array.data/data.pass.cpp
+++ b/test/containers/sequences/array/array.data/data.pass.cpp
@@ -30,5 +30,6 @@
         typedef std::array<T, 0> C;
         C c = {};
         T* p = c.data();
+        (void)p; // to placate scan-build
     }
 }
diff --git a/test/containers/sequences/array/array.data/data_const.pass.cpp b/test/containers/sequences/array/array.data/data_const.pass.cpp
index 93acb71..8eb9762 100644
--- a/test/containers/sequences/array/array.data/data_const.pass.cpp
+++ b/test/containers/sequences/array/array.data/data_const.pass.cpp
@@ -30,5 +30,6 @@
         typedef std::array<T, 0> C;
         const C c = {};
         const T* p = c.data();
+        (void)p; // to placate scan-build
     }
 }
diff --git a/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp b/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
index fb3765d..0b348e6 100644
--- a/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
+++ b/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp
@@ -70,7 +70,7 @@
         typedef input_iterator<const T*> I;
         c.assign(I(std::begin(t0)), I(std::end(t0)));
         int n = 0;
-        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n)
+        for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, (void) ++n)
             assert(*i == 10+n);
         assert(n == 4);
     }
diff --git a/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp b/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
index ae381e6..18d4cae 100644
--- a/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
+++ b/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
@@ -18,14 +18,14 @@
 #include "min_allocator.h"
 
 struct S {
-	S(int i) : i_(new int(i)) {}
-	S(const S &rhs) : i_(new int(*rhs.i_)) {}
-	S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
-	~S () { delete i_; i_ = NULL; }
-	bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
-	int get () const { return *i_; }
-	int *i_;
-	};
+    S(int i) : i_(new int(i)) {}
+    S(const S &rhs) : i_(new int(*rhs.i_)) {}
+    S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
+    ~S () { delete i_; i_ = NULL; }
+    bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
+    int get () const { return *i_; }
+    int *i_;
+    };
 
 
 int main()
@@ -98,10 +98,10 @@
     c.remove(c.front());
     C::const_iterator it = c.begin();
     for(int *ip = std::begin(t2); ip != std::end(t2); ++ip, ++it) {
-	    assert ( it != c.end());
+        assert ( it != c.end());
         assert ( *ip == it->get());
-	    }
-	assert ( it == c.end ());
+        }
+    assert ( it == c.end ());
     }
 #if __cplusplus >= 201103L
     {
diff --git a/test/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp b/test/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
index 625004b..d69deac 100644
--- a/test/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
@@ -12,6 +12,8 @@
 // template <InputIterator Iter>
 //   iterator insert(const_iterator position, Iter first, Iter last);
 
+// UNSUPPORTED: asan, msan
+
 #if _LIBCPP_DEBUG >= 1
 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
 #endif
diff --git a/test/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp b/test/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
index ce2d386..a552e1f 100644
--- a/test/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -11,6 +11,8 @@
 
 // iterator insert(const_iterator position, size_type n, const value_type& x);
 
+// UNSUPPORTED: asan, msan
+
 #if _LIBCPP_DEBUG >= 1
 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
 #endif
diff --git a/test/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp b/test/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
index 1b097e3..093ad42 100644
--- a/test/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
+++ b/test/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
@@ -11,6 +11,8 @@
 
 // iterator insert(const_iterator position, const value_type& x);
 
+// UNSUPPORTED: asan, msan
+
 #if _LIBCPP_DEBUG >= 1
 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
 #endif
diff --git a/test/containers/sequences/list/list.ops/remove.pass.cpp b/test/containers/sequences/list/list.ops/remove.pass.cpp
index 106c052..f580c94 100644
--- a/test/containers/sequences/list/list.ops/remove.pass.cpp
+++ b/test/containers/sequences/list/list.ops/remove.pass.cpp
@@ -17,14 +17,14 @@
 #include "min_allocator.h"
 
 struct S {
-	S(int i) : i_(new int(i)) {}
-	S(const S &rhs) : i_(new int(*rhs.i_)) {}
-	S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
-	~S () { delete i_; i_ = NULL; }
-	bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
-	int get () const { return *i_; }
-	int *i_;
-	};
+    S(int i) : i_(new int(i)) {}
+    S(const S &rhs) : i_(new int(*rhs.i_)) {}
+    S& operator = (const S &rhs) { *i_ = *rhs.i_; return *this; }
+    ~S () { delete i_; i_ = NULL; }
+    bool operator == (const S &rhs) const { return *i_ == *rhs.i_; }
+    int get () const { return *i_; }
+    int *i_;
+    };
 
 
 int main()
@@ -52,10 +52,10 @@
     c.remove(c.front());
     std::list<S>::const_iterator it = c.begin();
     for(int *ip = a2; ip < a2+5; ++ip, ++it) {
-	    assert ( it != c.end());
+        assert ( it != c.end());
         assert ( *ip == it->get());
-	    }
-	assert ( it == c.end ());
+        }
+    assert ( it == c.end ());
     }
 #if __cplusplus >= 201103L
     {
diff --git a/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp b/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
index c49ef9b..e51f8b5 100644
--- a/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
+++ b/test/containers/sequences/vector.bool/insert_iter_iter_iter.pass.cpp
@@ -33,7 +33,7 @@
             assert(v[j] == 0);
         for (int k = 0; k < N; ++j, ++k)
             assert(v[j] == a[k]);
-        for (; j < 105; ++j)
+        for (; j < v.size(); ++j)
             assert(v[j] == 0);
     }
     {
@@ -52,6 +52,43 @@
         for (; j < 105; ++j)
             assert(v[j] == 0);
     }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        size_t sz = v.size();
+        bool a[] = {1, 0, 0, 1, 1};
+        const unsigned N = sizeof(a)/sizeof(a[0]);
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
+                                        forward_iterator<const bool*>(a+N));
+        assert(v.size() == sz + N);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (int k = 0; k < N; ++j, ++k)
+            assert(v[j] == a[k]);
+        for (; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        v.pop_back(); v.pop_back(); v.pop_back();
+        size_t sz = v.size();
+        bool a[] = {1, 0, 0, 1, 1};
+        const unsigned N = sizeof(a)/sizeof(a[0]);
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const bool*>(a),
+                                        forward_iterator<const bool*>(a+N));
+        assert(v.size() == sz + N);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (int k = 0; k < N; ++j, ++k)
+            assert(v[j] == a[k]);
+        for (; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
 #if __cplusplus >= 201103L
     {
         std::vector<bool, min_allocator<bool>> v(100);
@@ -66,7 +103,7 @@
             assert(v[j] == 0);
         for (int k = 0; k < N; ++j, ++k)
             assert(v[j] == a[k]);
-        for (; j < 105; ++j)
+        for (; j < v.size(); ++j)
             assert(v[j] == 0);
     }
     {
@@ -82,7 +119,7 @@
             assert(v[j] == 0);
         for (int k = 0; k < N; ++j, ++k)
             assert(v[j] == a[k]);
-        for (; j < 105; ++j)
+        for (; j < v.size(); ++j)
             assert(v[j] == 0);
     }
 #endif
diff --git a/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp b/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
index f9cb65c..710ad48 100644
--- a/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
+++ b/test/containers/sequences/vector.bool/insert_iter_size_value.pass.cpp
@@ -29,7 +29,38 @@
             assert(v[j] == 0);
         for (; j < 15; ++j)
             assert(v[j] == 1);
-        for (++j; j < 105; ++j)
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        size_t sz = v.size();
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+        assert(v.size() == sz + 5);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (; j < 15; ++j)
+            assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        v.pop_back(); v.pop_back();
+        size_t sz = v.size();
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+        assert(v.size() == sz + 5);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (; j < 15; ++j)
+            assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
             assert(v[j] == 0);
     }
 #if __cplusplus >= 201103L
@@ -43,7 +74,7 @@
             assert(v[j] == 0);
         for (; j < 15; ++j)
             assert(v[j] == 1);
-        for (++j; j < 105; ++j)
+        for (++j; j < v.size(); ++j)
             assert(v[j] == 0);
     }
 #endif
diff --git a/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp b/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp
index 1213985..51c4626 100644
--- a/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp
+++ b/test/containers/sequences/vector.bool/insert_iter_value.pass.cpp
@@ -28,7 +28,36 @@
         for (j = 0; j < 10; ++j)
             assert(v[j] == 0);
         assert(v[j] == 1);
-        for (++j; j < 101; ++j)
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        size_t sz = v.size();
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
+        assert(v.size() == sz + 1);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<bool> v(100);
+        while(v.size() < v.capacity()) v.push_back(false);
+        v.pop_back(); v.pop_back();
+        size_t sz = v.size();
+        std::vector<bool>::iterator i = v.insert(v.cbegin() + 10, 1);
+        assert(v.size() == sz + 1);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
             assert(v[j] == 0);
     }
 #if __cplusplus >= 201103L
@@ -41,7 +70,7 @@
         for (j = 0; j < 10; ++j)
             assert(v[j] == 0);
         assert(v[j] == 1);
-        for (++j; j < 101; ++j)
+        for (++j; j < v.size(); ++j)
             assert(v[j] == 0);
     }
 #endif
diff --git a/test/containers/sequences/vector.bool/resize_size.pass.cpp b/test/containers/sequences/vector.bool/resize_size.pass.cpp
index 77d54e5..f75720c 100644
--- a/test/containers/sequences/vector.bool/resize_size.pass.cpp
+++ b/test/containers/sequences/vector.bool/resize_size.pass.cpp
@@ -27,6 +27,10 @@
         v.resize(200);
         assert(v.size() == 200);
         assert(v.capacity() >= 200);
+        v.reserve(400);
+        v.resize(300);  // check the case when resizing and we already have room
+        assert(v.size() == 300);
+        assert(v.capacity() >= 400);
     }
 #if __cplusplus >= 201103L
     {
@@ -37,6 +41,10 @@
         v.resize(200);
         assert(v.size() == 200);
         assert(v.capacity() >= 200);
+        v.reserve(400);
+        v.resize(300);  // check the case when resizing and we already have room
+        assert(v.size() == 300);
+        assert(v.capacity() >= 400);
     }
 #endif
 }
diff --git a/test/containers/sequences/vector/asan_throw.pass.cc b/test/containers/sequences/vector/asan_throw.pass.cc
new file mode 100644
index 0000000..a1dce4a
--- /dev/null
+++ b/test/containers/sequences/vector/asan_throw.pass.cc
@@ -0,0 +1,198 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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 asan vector annotations with a class that throws in a CTOR.
+
+#include <vector>
+#include <cassert>
+
+#include "asan_testing.h"
+
+class X {
+public:
+  X(const X &x) { Init(x.a); }
+  X(char arg) { Init(arg); }
+  X() { Init(42); }
+  X &operator=(const X &x) {
+    Init(x.a);
+    return *this;
+  }
+  void Init(char arg) {
+    if (arg == 42)
+      throw 0;
+    if (arg == 66)
+      arg = 42;
+    a = arg;
+  }
+  char get() const { return a; }
+  void set(char arg) { a = arg; }
+
+private:
+  char a;
+};
+
+void test_push_back() {
+  std::vector<X> v;
+  v.reserve(2);
+  v.push_back(X(2));
+  assert(v.size() == 1);
+  try {
+    v.push_back(X(66));
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 1);
+  }
+  assert(v.size() == 1);
+  assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_emplace_back() {
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+  std::vector<X> v;
+  v.reserve(2);
+  v.push_back(X(2));
+  assert(v.size() == 1);
+  try {
+    v.emplace_back(42);
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 1);
+  }
+  assert(v.size() == 1);
+  assert(is_contiguous_container_asan_correct(v));
+#endif // _LIBCPP_HAS_NO_VARIADICS
+}
+
+void test_insert_range() {
+  std::vector<X> v;
+  v.reserve(4);
+  v.push_back(X(1));
+  v.push_back(X(2));
+  assert(v.size() == 2);
+  assert(v.capacity() >= 4);
+  try {
+    char a[2] = {21, 42};
+    v.insert(v.end(), a, a + 2);
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 3);
+  }
+  assert(v.size() == 3);
+  assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_insert() {
+  std::vector<X> v;
+  v.reserve(3);
+  v.insert(v.end(), X(1));
+  v.insert(v.begin(), X(2));
+  assert(v.size() == 2);
+  try {
+    v.insert(v.end(), X(66));
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 2);
+  }
+  assert(v.size() == 2);
+  assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_emplace() {
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+  std::vector<X> v;
+  v.reserve(3);
+  v.insert(v.end(), X(1));
+  v.insert(v.begin(), X(2));
+  assert(v.size() == 2);
+  try {
+    v.emplace(v.end(), 42);
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 2);
+  }
+  assert(v.size() == 2);
+  assert(is_contiguous_container_asan_correct(v));
+#endif // _LIBCPP_HAS_NO_VARIADICS
+}
+
+void test_insert_range2() {
+  std::vector<X> v;
+  v.reserve(4);
+  v.insert(v.end(), X(1));
+  v.insert(v.begin(), X(2));
+  assert(v.size() == 2);
+  assert(v.capacity() >= 4);
+  try {
+    char a[2] = {10, 42};
+    v.insert(v.begin(), a, a + 2);
+    assert(0);
+  } catch (int e) {
+    assert(v.size() <= 4);
+    assert(is_contiguous_container_asan_correct(v));
+    return;
+  }
+  assert(0);
+}
+
+void test_insert_n() {
+  std::vector<X> v;
+  v.reserve(10);
+  v.insert(v.end(), X(1));
+  v.insert(v.begin(), X(2));
+  assert(v.size() == 2);
+  try {
+    v.insert(v.begin(), 1, X(66));
+    assert(0);
+  } catch (int e) {
+    assert(v.size() <= 3);
+    assert(is_contiguous_container_asan_correct(v));
+    return;
+  }
+  assert(0);
+}
+
+void test_resize() {
+  std::vector<X> v;
+  v.reserve(3);
+  v.push_back(X(0));
+  try {
+    v.resize(3);
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 1);
+  }
+  assert(v.size() == 1);
+  assert(is_contiguous_container_asan_correct(v));
+}
+
+void test_resize_param() {
+  std::vector<X> v;
+  v.reserve(3);
+  v.push_back(X(0));
+  try {
+    v.resize(3, X(66));
+    assert(0);
+  } catch (int e) {
+    assert(v.size() == 1);
+  }
+  assert(v.size() == 1);
+  assert(is_contiguous_container_asan_correct(v));
+}
+
+int main() {
+  test_push_back();
+  test_emplace_back();
+  test_insert_range();
+  test_insert();
+  test_emplace();
+  test_insert_range2();
+  test_insert_n();
+  test_resize();
+  test_resize_param();
+}
diff --git a/test/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp b/test/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
index cf24a87..782437b 100644
--- a/test/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
+++ b/test/containers/sequences/vector/vector.modifiers/insert_iter_iter_iter.pass.cpp
@@ -60,6 +60,42 @@
             assert(v[j] == 0);
     }
     {
+        std::vector<int> v(100);
+        while(v.size() < v.capacity()) v.push_back(0); // force reallocation
+        size_t sz = v.size();
+        int a[] = {1, 2, 3, 4, 5};
+        const unsigned N = sizeof(a)/sizeof(a[0]);
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+                                        forward_iterator<const int*>(a+N));
+        assert(v.size() == sz + N);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (int k = 0; k < N; ++j, ++k)
+            assert(v[j] == a[k]);
+        for (; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<int> v(100);
+        v.reserve(128); // force no reallocation
+        size_t sz = v.size();
+        int a[] = {1, 2, 3, 4, 5};
+        const unsigned N = sizeof(a)/sizeof(a[0]);
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, forward_iterator<const int*>(a),
+                                        forward_iterator<const int*>(a+N));
+        assert(v.size() == sz + N);
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (int k = 0; k < N; ++j, ++k)
+            assert(v[j] == a[k]);
+        for (; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
         std::vector<int, stack_allocator<int, 308> > v(100);
         int a[] = {1, 2, 3, 4, 5};
         const int N = sizeof(a)/sizeof(a[0]);
diff --git a/test/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp b/test/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
index 42effc7..6997284 100644
--- a/test/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
+++ b/test/containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp
@@ -38,6 +38,38 @@
             assert(v[j] == 0);
     }
     {
+        std::vector<int> v(100);
+        while(v.size() < v.capacity()) v.push_back(0); // force reallocation
+        size_t sz = v.size();
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+        assert(v.size() == sz + 5);
+        assert(is_contiguous_container_asan_correct(v)); 
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (; j < 15; ++j)
+            assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<int> v(100);
+        v.reserve(128); // force no reallocation
+        size_t sz = v.size();
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 5, 1);
+        assert(v.size() == sz + 5);
+        assert(is_contiguous_container_asan_correct(v)); 
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        for (; j < 15; ++j)
+            assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
         std::vector<int, stack_allocator<int, 300> > v(100);
         std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 5, 1);
         assert(v.size() == 105);
diff --git a/test/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp b/test/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
index feb74c0..782e752 100644
--- a/test/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
+++ b/test/containers/sequences/vector/vector.modifiers/insert_iter_value.pass.cpp
@@ -37,6 +37,37 @@
             assert(v[j] == 0);
     }
     {
+        std::vector<int> v(100);
+        while(v.size() < v.capacity()) v.push_back(0); // force reallocation
+        size_t sz = v.size();
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 1);
+        assert(v.size() == sz + 1);
+        assert(is_contiguous_container_asan_correct(v)); 
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
+        std::vector<int> v(100);
+        while(v.size() < v.capacity()) v.push_back(0);
+        v.pop_back(); v.pop_back(); // force no reallocation
+        size_t sz = v.size();
+        std::vector<int>::iterator i = v.insert(v.cbegin() + 10, 1);
+        assert(v.size() == sz + 1);
+        assert(is_contiguous_container_asan_correct(v)); 
+        assert(i == v.begin() + 10);
+        int j;
+        for (j = 0; j < 10; ++j)
+            assert(v[j] == 0);
+        assert(v[j] == 1);
+        for (++j; j < v.size(); ++j)
+            assert(v[j] == 0);
+    }
+    {
         std::vector<int, stack_allocator<int, 300> > v(100);
         std::vector<int, stack_allocator<int, 300> >::iterator i = v.insert(v.cbegin() + 10, 1);
         assert(v.size() == 101);
diff --git a/test/depr/depr.c.headers/locale_h.pass.cpp b/test/depr/depr.c.headers/locale_h.pass.cpp
index eff9b2b..6ecf5a8 100644
--- a/test/depr/depr.c.headers/locale_h.pass.cpp
+++ b/test/depr/depr.c.headers/locale_h.pass.cpp
@@ -43,6 +43,6 @@
 int main()
 {
     lconv lc;
-    static_assert((std::is_same<__typeof__(setlocale(0, "")), char*>::value), "");
-    static_assert((std::is_same<__typeof__(localeconv()), lconv*>::value), "");
+    static_assert((std::is_same<decltype(setlocale(0, "")), char*>::value), "");
+    static_assert((std::is_same<decltype(localeconv()), lconv*>::value), "");
 }
diff --git a/test/depr/depr.c.headers/setjmp_h.pass.cpp b/test/depr/depr.c.headers/setjmp_h.pass.cpp
index 2a8abe3..36f4253 100644
--- a/test/depr/depr.c.headers/setjmp_h.pass.cpp
+++ b/test/depr/depr.c.headers/setjmp_h.pass.cpp
@@ -15,6 +15,6 @@
 int main()
 {
     jmp_buf jb;
-    static_assert((std::is_same<__typeof__(longjmp(jb, 0)), void>::value),
-                  "std::is_same<__typeof__(longjmp(jb, 0)), void>::value");
+    static_assert((std::is_same<decltype(longjmp(jb, 0)), void>::value),
+                  "std::is_same<decltype(longjmp(jb, 0)), void>::value");
 }
diff --git a/test/depr/depr.c.headers/stdarg_h.pass.cpp b/test/depr/depr.c.headers/stdarg_h.pass.cpp
index 2c18c5d..7a60902 100644
--- a/test/depr/depr.c.headers/stdarg_h.pass.cpp
+++ b/test/depr/depr.c.headers/stdarg_h.pass.cpp
@@ -15,8 +15,10 @@
 #error va_arg not defined
 #endif
 
-#ifndef va_copy
-#error va_copy not defined
+#if __cplusplus >= 201103L
+#  ifndef va_copy
+#    error va_copy is not defined when c++ >= 11
+#  endif
 #endif
 
 #ifndef va_end
diff --git a/test/depr/depr.c.headers/tgmath_h.pass.cpp b/test/depr/depr.c.headers/tgmath_h.pass.cpp
index c4c9e85..a2ef814 100644
--- a/test/depr/depr.c.headers/tgmath_h.pass.cpp
+++ b/test/depr/depr.c.headers/tgmath_h.pass.cpp
@@ -19,4 +19,5 @@
 {
     std::complex<double> cd;
     double x = sin(1.0);
+    (void)x; // to placate scan-build
 }
diff --git a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
index 78343f8..5ea4988 100644
--- a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.cons/default.pass.cpp
@@ -24,4 +24,5 @@
     std::string s("dog");
     out << i << ' ' << d << ' ' << s << std::ends;
     assert(out.str() == std::string("123 4.5 dog"));
+    out.freeze(false);
 }
diff --git a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.pass.cpp b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.pass.cpp
index 97869f6..a60c7cb 100644
--- a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/freeze.pass.cpp
@@ -29,5 +29,6 @@
         out << 'a';
         out << char(0);
         assert(out.str() == std::string("a"));
+        out.freeze(false);
     }
 }
diff --git a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
index 9a5542a..9a7160f 100644
--- a/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.ostrstream/depr.ostrstream.members/str.pass.cpp
@@ -22,5 +22,6 @@
         std::ostrstream out;
         out << 123 << ' ' << 4.5 << ' ' << "dog" << std::ends;
         assert(out.str() == std::string("123 4.5 dog"));
+        out.freeze(false);
     }
 }
diff --git a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
index 374f430..2ec5e7f 100644
--- a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.cons/default.pass.cpp
@@ -31,4 +31,5 @@
     assert(i == 123);
     assert(d == 4.5);
     assert(strcmp(s.c_str(), "dog") == 0);
+    inout.freeze(false);
 }
diff --git a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.pass.cpp b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.pass.cpp
index 525073c..4734338 100644
--- a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/freeze.pass.cpp
@@ -29,5 +29,6 @@
         out << 'a';
         out << char(0);
         assert(out.str() == std::string("a"));
+        out.freeze(false);
     }
 }
diff --git a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
index 4ac1c44..5c273dc 100644
--- a/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.strstream/depr.strstream.oper/str.pass.cpp
@@ -22,5 +22,6 @@
         std::strstream out;
         out << 123 << ' ' << 4.5 << ' ' << "dog" << std::ends;
         assert(out.str() == std::string("123 4.5 dog"));
+        out.freeze(false);
     }
 }
diff --git a/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.pass.cpp b/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.pass.cpp
index 03e58cb..d96f0f7 100644
--- a/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/pcount.pass.cpp
@@ -27,5 +27,6 @@
         assert(sb.pcount() == 2);
         assert(sb.str() == std::string("a"));
         assert(sb.pcount() == 2);
+        sb.freeze(false);
     }
 }
diff --git a/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp b/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
index dce29c9..27de56f 100644
--- a/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
+++ b/test/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/str.pass.cpp
@@ -23,5 +23,6 @@
         assert(sb.sputc('a') == 'a');
         assert(sb.sputc(0) == 0);
         assert(sb.str() == std::string("a"));
+        sb.freeze(false);
     }
 }
diff --git a/test/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp b/test/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
index e99514a..0a2dd6d 100644
--- a/test/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
+++ b/test/experimental/string.view/string.view.modifiers/remove_prefix.pass.cpp
@@ -28,13 +28,11 @@
         sv1.remove_prefix ( 1 );
         assert ( sv1.size() == (len - 1));
         assert ( sv1.data() == (s + 1));
+        sv1.remove_prefix ( len - 1 );
     }
     
-    sv1.remove_prefix ( len - 1 );
     assert ( sv1.size() == 0 );
-
-    SV sv2 ( s );
-    sv2.remove_prefix ( len << 1 );
+    sv1.remove_prefix ( 0 );
     assert ( sv1.size() == 0 ); 
     }
 }
@@ -72,7 +70,6 @@
     static_assert ( test_ce ( 5, 0 ) == 5, "" );
     static_assert ( test_ce ( 5, 1 ) == 4, "" );
     static_assert ( test_ce ( 5, 5 ) == 0, "" );
-    static_assert ( test_ce ( 5, 9 ) == 0, "" );
     static_assert ( test_ce ( 9, 3 ) == 6, "" );
     }
 #endif
diff --git a/test/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp b/test/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
index 5baaab0..9dd5988 100644
--- a/test/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
+++ b/test/experimental/string.view/string.view.modifiers/remove_suffix.pass.cpp
@@ -27,13 +27,11 @@
         sv1.remove_suffix ( 1 );
         assert ( sv1.size() == (len - 1));
         assert ( sv1.data() == s);
+        sv1.remove_suffix ( len - 1 );
         }
         
-    sv1.remove_suffix ( len - 1 );
     assert ( sv1.size() == 0 );
-
-    SV sv2 ( s );
-    sv2.remove_suffix ( len << 1 );
+    sv1.remove_suffix ( 0 );
     assert ( sv1.size() == 0 ); 
     }
 
@@ -72,7 +70,6 @@
     static_assert ( test_ce ( 5, 0 ) == 5, "" );
     static_assert ( test_ce ( 5, 1 ) == 4, "" );
     static_assert ( test_ce ( 5, 5 ) == 0, "" );
-    static_assert ( test_ce ( 5, 9 ) == 0, "" );
     static_assert ( test_ce ( 9, 3 ) == 6, "" );
     }
 #endif
diff --git a/test/experimental/string.view/string.view.ops/to_string.pass.cpp b/test/experimental/string.view/string.view.ops/to_string.pass.cpp
index e69cb95..6387ac2 100644
--- a/test/experimental/string.view/string.view.ops/to_string.pass.cpp
+++ b/test/experimental/string.view/string.view.ops/to_string.pass.cpp
@@ -24,8 +24,8 @@
 void test ( const CharT *s ) {
     typedef std::basic_string<CharT> String ;
     {
-    std::experimental::basic_string_view<CharT> sv1 ( s );
-    String                                      str1 = (String) sv1;
+    const std::experimental::basic_string_view<CharT> sv1 ( s );
+    String                                            str1 = (String) sv1;
     
     assert ( sv1.size() == str1.size ());
     assert ( std::char_traits<CharT>::compare ( sv1.data(), str1.data(),  sv1.size()) == 0 );
@@ -38,8 +38,8 @@
     }
 
     {
-    std::experimental::basic_string_view<CharT> sv1;
-    String                                      str1 = (String) sv1;
+    const std::experimental::basic_string_view<CharT> sv1;
+    String                                            str1 = (String) sv1;
 
     assert ( sv1.size() == str1.size ());
     assert ( std::char_traits<CharT>::compare ( sv1.data(), str1.data(), sv1.size()) == 0 );
diff --git a/test/input.output/iostream.format/ext.manip/get_money.pass.cpp b/test/input.output/iostream.format/ext.manip/get_money.pass.cpp
index cdd762a..1ea1d78 100644
--- a/test/input.output/iostream.format/ext.manip/get_money.pass.cpp
+++ b/test/input.output/iostream.format/ext.manip/get_money.pass.cpp
@@ -11,6 +11,8 @@
 
 // template <class moneyT> T7 get_money(moneyT& mon, bool intl = false);
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <iomanip>
 #include <cassert>
 
diff --git a/test/input.output/iostream.format/ext.manip/get_time.pass.cpp b/test/input.output/iostream.format/ext.manip/get_time.pass.cpp
index 6866552..17ff642 100644
--- a/test/input.output/iostream.format/ext.manip/get_time.pass.cpp
+++ b/test/input.output/iostream.format/ext.manip/get_time.pass.cpp
@@ -43,7 +43,7 @@
         std::istream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         std::tm t = {0};
-        is >> std::get_time(&t, "%c");
+        is >> std::get_time(&t, "%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);
         assert(t.tm_hour == 23);
@@ -59,7 +59,7 @@
         std::wistream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         std::tm t = {0};
-        is >> std::get_time(&t, L"%c");
+        is >> std::get_time(&t, L"%a %b %d %H:%M:%S %Y");
         assert(t.tm_sec == 59);
         assert(t.tm_min == 55);
         assert(t.tm_hour == 23);
diff --git a/test/input.output/iostream.format/ext.manip/put_money.pass.cpp b/test/input.output/iostream.format/ext.manip/put_money.pass.cpp
index 8d15dd9..a00cf13 100644
--- a/test/input.output/iostream.format/ext.manip/put_money.pass.cpp
+++ b/test/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -11,6 +11,8 @@
 
 // template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl = false);
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <iomanip>
 #include <cassert>
 
diff --git a/test/input.output/iostream.format/ext.manip/put_time.pass.cpp b/test/input.output/iostream.format/ext.manip/put_time.pass.cpp
index d64ca07..52a98a1 100644
--- a/test/input.output/iostream.format/ext.manip/put_time.pass.cpp
+++ b/test/input.output/iostream.format/ext.manip/put_time.pass.cpp
@@ -62,7 +62,8 @@
         t.tm_mon = 11;
         t.tm_year = 161;
         t.tm_wday = 6;
-        os << std::put_time(&t, "%c");
+        t.tm_isdst = 0;
+        os << std::put_time(&t, "%a %b %d %H:%M:%S %Y");
         assert(sb.str() == "Sat Dec 31 23:55:59 2061");
     }
     {
@@ -77,7 +78,7 @@
         t.tm_mon = 11;
         t.tm_year = 161;
         t.tm_wday = 6;
-        os << std::put_time(&t, L"%c");
+        os << std::put_time(&t, L"%a %b %d %H:%M:%S %Y");
         assert(sb.str() == L"Sat Dec 31 23:55:59 2061");
     }
 }
diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
index 59f381c..61db67c 100644
--- a/test/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
+++ b/test/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp
@@ -53,12 +53,12 @@
         testbuf<char> sb(" 123456789");
         std::istream is(&sb);
         assert(is.sync() == 0);
-        assert(sync_called = 1);
+        assert(sync_called == 1);
     }
     {
         testbuf<wchar_t> sb(L" 123456789");
         std::wistream is(&sb);
         assert(is.sync() == 0);
-        assert(sync_called = 2);
+        assert(sync_called == 2);
     }
 }
diff --git a/test/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
index 6e20640..e57ad55 100644
--- a/test/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
+++ b/test/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp
@@ -34,6 +34,24 @@
         assert(i == 456);
     }
     {
+        std::istringstream s1("Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+        std::string s;
+        s1 >> s;
+
+        std::istringstream s2 = std::move(s1);
+        s2 >> s;
+        assert(s == "Bbbbb");
+
+        std::istringstream s3;
+        s3 = std::move(s2);
+        s3 >> s;
+        assert(s == "Cccccccccc");
+
+        s1 = std::move(s3);
+        s1 >> s;
+        assert(s == "Dddddddddddddddddd");
+    }
+    {
         std::wistringstream ss0(L" 123 456");
         std::wistringstream ss;
         ss = std::move(ss0);
@@ -46,5 +64,23 @@
         ss >> i;
         assert(i == 456);
     }
+    {
+        std::wistringstream s1(L"Aaaaa Bbbbb Cccccccccc Dddddddddddddddddd");
+        std::wstring s;
+        s1 >> s;
+
+        std::wistringstream s2 = std::move(s1);
+        s2 >> s;
+        assert(s == L"Bbbbb");
+
+        std::wistringstream s3;
+        s3 = std::move(s2);
+        s3 >> s;
+        assert(s == L"Cccccccccc");
+
+        s1 = std::move(s3);
+        s1 >> s;
+        assert(s == L"Dddddddddddddddddd");
+    }
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }
diff --git a/test/iterators/iterator.container/data.pass.cpp b/test/iterators/iterator.container/data.pass.cpp
new file mode 100644
index 0000000..75ba950
--- /dev/null
+++ b/test/iterators/iterator.container/data.pass.cpp
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+// template <class C> constexpr auto data(C& c) -> decltype(c.data());               // C++17
+// template <class C> constexpr auto data(const C& c) -> decltype(c.data());         // C++17
+// template <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept;           // C++17
+// template <class E> constexpr const E* data(initializer_list<E> il) noexcept;      // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::data(c)   == c.data());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c )
+{
+    assert ( std::data(c)   == c.begin());
+}
+
+template<typename C>
+void test_container( C& c )
+{
+    assert ( std::data(c)   == c.data());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c)
+{
+    assert ( std::data(c)   == c.begin());
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert ( std::data(array) == &array[0]);
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif
diff --git a/test/iterators/iterator.container/empty.pass.cpp b/test/iterators/iterator.container/empty.pass.cpp
new file mode 100644
index 0000000..196a0e3
--- /dev/null
+++ b/test/iterators/iterator.container/empty.pass.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+// template <class C> constexpr auto empty(const C& c) -> decltype(c.empty());       // C++17
+// template <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept;  // C++17
+// template <class E> constexpr bool empty(initializer_list<E> il) noexcept;         // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <list>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::empty(c)   == c.empty());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c )
+{
+    assert ( std::empty(c)   == (c.size() == 0));
+}
+
+template<typename C>
+void test_container( C& c )
+{
+    assert ( std::empty(c)   == c.empty());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c )
+{
+    assert ( std::empty(c)   == (c.size() == 0));
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert (!std::empty(array));
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::list<int>   l; l.push_back(2);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( l );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( l );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif
diff --git a/test/iterators/iterator.container/size.pass.cpp b/test/iterators/iterator.container/size.pass.cpp
new file mode 100644
index 0000000..f8da9bf
--- /dev/null
+++ b/test/iterators/iterator.container/size.pass.cpp
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+// template <class C> constexpr auto size(const C& c) -> decltype(c.size());         // C++17
+// template <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17
+
+#if __cplusplus <= 201402L
+int main () {}
+#else
+
+
+#include <__config>
+
+#include <iterator>
+#include <cassert>
+#include <vector>
+#include <array>
+#include <list>
+#include <initializer_list>
+
+template<typename C>
+void test_const_container( const C& c )
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename T>
+void test_const_container( const std::initializer_list<T>& c)
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename C>
+void test_container( C& c)
+{
+    assert ( std::size(c)   == c.size());
+}
+    
+template<typename T>
+void test_container( std::initializer_list<T>& c )
+{
+    assert ( std::size(c)   == c.size());
+}
+
+template<typename T, size_t Sz>
+void test_const_array( const T (&array)[Sz] )
+{
+    assert ( std::size(array) == Sz );
+}
+
+int main()
+{
+    std::vector<int> v; v.push_back(1);
+    std::list<int>   l; l.push_back(2);
+    std::array<int, 1> a; a[0] = 3;
+    std::initializer_list<int> il = { 4 };
+    
+    test_container ( v );
+    test_container ( l );
+    test_container ( a );
+    test_container ( il );
+
+    test_const_container ( v );
+    test_const_container ( l );
+    test_const_container ( a );
+    test_const_container ( il );
+    
+    static constexpr int arrA [] { 1, 2, 3 };
+    test_const_array ( arrA );
+}
+
+#endif
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
index 63f847f..052d88f 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array.pass.cpp
@@ -7,7 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new[]
+// test operator new[]
+// NOTE: asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
index 60bc7c4..259f5b0 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow.pass.cpp
@@ -7,7 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new [] (nothrow)
+// test operator new [] (nothrow)
+// NOTE: asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
+
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
index 9bf6e8a..3e3a00c 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
@@ -7,7 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new [] nothrow by replacing only operator new
+// test operator new [] nothrow by replacing only operator new
+
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
index 959bc45..acf972b 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
@@ -7,7 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new[] replacement by replacing only operator new
+// test operator new[] replacement by replacing only operator new
+
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
index 4d219e3..3ba71dd 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.single/new.pass.cpp
@@ -7,7 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new
+// test operator new
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
index c54d14e..c76bfa0 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow.pass.cpp
@@ -7,7 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new (nothrow)
+// test operator new (nothrow)
+
+// asan and msan will not call the new handler.
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
index ed3c035..f2dbb98 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
@@ -7,7 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new nothrow by replacing only operator new
+// test operator new nothrow by replacing only operator new
+
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/test/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
index 7646097..2d411b9 100644
--- a/test/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
+++ b/test/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
@@ -7,7 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
- // test operator new replacement
+// test operator new replacement
+
+// UNSUPPORTED: asan, msan
 
 #include <new>
 #include <cstddef>
diff --git a/test/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp b/test/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
index 9b11e82..af93e78 100644
--- a/test/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
+++ b/test/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
@@ -13,7 +13,7 @@
 
 #include <limits>
 
-#if (defined(__i386__) || defined(__x86_64__)) || defined(__pnacl__) // @LOCALMOD
+#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__)
 static const bool integral_types_trap = true;
 #else
 static const bool integral_types_trap = false;
diff --git a/test/language.support/support.runtime/csetjmp.pass.cpp b/test/language.support/support.runtime/csetjmp.pass.cpp
index a54f67b..dc034ce 100644
--- a/test/language.support/support.runtime/csetjmp.pass.cpp
+++ b/test/language.support/support.runtime/csetjmp.pass.cpp
@@ -19,6 +19,6 @@
 int main()
 {
     std::jmp_buf jb;
-    static_assert((std::is_same<__typeof__(std::longjmp(jb, 0)), void>::value),
-                  "std::is_same<__typeof__(std::longjmp(jb, 0)), void>::value");
+    static_assert((std::is_same<decltype(std::longjmp(jb, 0)), void>::value),
+                  "std::is_same<decltype(std::longjmp(jb, 0)), void>::value");
 }
diff --git a/test/language.support/support.runtime/cstdarg.pass.cpp b/test/language.support/support.runtime/cstdarg.pass.cpp
index 00baf80..059ad2f 100644
--- a/test/language.support/support.runtime/cstdarg.pass.cpp
+++ b/test/language.support/support.runtime/cstdarg.pass.cpp
@@ -15,8 +15,10 @@
 #error va_arg not defined
 #endif
 
-#ifndef va_copy
-#error va_copy not defined
+#if __cplusplus >= 201103L
+#  ifndef va_copy
+#    error va_copy is not defined when c++ >= 11
+#  endif
 #endif
 
 #ifndef va_end
diff --git a/test/language.support/support.start.term/quick_exit.pass.cpp b/test/language.support/support.start.term/quick_exit.pass.cpp
index 1945a1b..bcfdbb7 100644
--- a/test/language.support/support.start.term/quick_exit.pass.cpp
+++ b/test/language.support/support.start.term/quick_exit.pass.cpp
@@ -7,17 +7,17 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// XFAIL: apple-darwin
 
 // test quick_exit and at_quick_exit
 
 #include <cstdlib>
-#include <type_traits>
 
 void f() {}
 
 int main()
 {
+#ifdef _LIBCPP_HAS_QUICK_EXIT
     std::at_quick_exit(f);
-    quick_exit(0);
+    std::quick_exit(0);
+#endif
 }
diff --git a/test/language.support/support.start.term/quick_exit_check1.fail.cpp b/test/language.support/support.start.term/quick_exit_check1.fail.cpp
new file mode 100644
index 0000000..8b97293
--- /dev/null
+++ b/test/language.support/support.start.term/quick_exit_check1.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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 referencing at_quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
+// results in a compile error.
+
+#include <cstdlib>
+
+void f() {}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_QUICK_EXIT
+    std::at_quick_exit(f);
+#else
+#error
+#endif
+}
diff --git a/test/language.support/support.start.term/quick_exit_check2.fail.cpp b/test/language.support/support.start.term/quick_exit_check2.fail.cpp
new file mode 100644
index 0000000..3959141
--- /dev/null
+++ b/test/language.support/support.start.term/quick_exit_check2.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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 referencing quick_exit when _LIBCPP_HAS_QUICK_EXIT is not defined
+// results in a compile error.
+
+#include <cstdlib>
+
+void f() {}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_QUICK_EXIT
+    std::quick_exit(0);
+#else
+#error
+#endif
+}
diff --git a/test/language.support/support.types/nullptr_t.pass.cpp b/test/language.support/support.types/nullptr_t.pass.cpp
index 6c15fef..4d7c8b0 100644
--- a/test/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/language.support/support.types/nullptr_t.pass.cpp
@@ -18,42 +18,62 @@
     A(std::nullptr_t) {}
 };
 
+template <class T>
+void test_conversions()
+{
+    {
+        T p = 0;
+        assert(p == nullptr);
+    }
+    {
+        T p = nullptr;
+        assert(p == nullptr);
+        assert(nullptr == p);
+        assert(!(p != nullptr));
+        assert(!(nullptr != p));
+    }
+}
+
+template <class T>
+void test_comparisons()
+{
+    T p = nullptr;
+    assert(p == nullptr);
+    assert(p <= nullptr);
+    assert(p >= nullptr);
+    assert(!(p != nullptr));
+    assert(!(p < nullptr));
+    assert(!(p > nullptr));
+    assert(nullptr == p);
+    assert(nullptr <= p);
+    assert(nullptr >= p);
+    assert(!(nullptr != p));
+    assert(!(nullptr < p));
+    assert(!(nullptr > p));
+}
+
+
 int main()
 {
     static_assert(sizeof(std::nullptr_t) == sizeof(void*),
                   "sizeof(std::nullptr_t) == sizeof(void*)");
-    A* p = 0;
-    assert(p == nullptr);
-    void (A::*pmf)() = 0;
-#ifdef __clang__
-    // GCC 4.2 can't handle this
-    assert(pmf == nullptr);
-#endif
-    int A::*pmd = 0;
-    assert(pmd == nullptr);
-    A a1(nullptr);
-    A a2(0);
-    bool b = nullptr;
-    assert(!b);
-    assert(nullptr == nullptr);
-    assert(nullptr <= nullptr);
-    assert(nullptr >= nullptr);
-    assert(!(nullptr != nullptr));
-    assert(!(nullptr < nullptr));
-    assert(!(nullptr > nullptr));
-    A* a = nullptr;
-    assert(a == nullptr);
-    assert(a <= nullptr);
-    assert(a >= nullptr);
-    assert(!(a != nullptr));
-    assert(!(a < nullptr));
-    assert(!(a > nullptr));
-    assert(nullptr == a);
-    assert(nullptr <= a);
-    assert(nullptr >= a);
-    assert(!(nullptr != a));
-    assert(!(nullptr < a));
-    assert(!(nullptr > a));
-    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
-    assert(i == 0);
+
+    {
+        test_conversions<std::nullptr_t>();
+        test_conversions<void*>();
+        test_conversions<A*>();
+        test_conversions<void(*)()>();
+        test_conversions<void(A::*)()>();
+        test_conversions<int A::*>();
+    }
+    {
+        test_comparisons<std::nullptr_t>();
+        test_comparisons<void*>();
+        test_comparisons<A*>();
+        test_comparisons<void(*)()>();
+    }
+    {
+        bool b = nullptr;
+        assert(!b);
+    }
 }
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
new file mode 100644
index 0000000..92bd879
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// typedef decltype(nullptr) nullptr_t;
+
+#include <cstddef>
+
+int main()
+{
+    std::ptrdiff_t i = static_cast<std::ptrdiff_t>(nullptr);
+}
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
new file mode 100644
index 0000000..34c7a93
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// NOTE: nullptr_t emulation cannot handle a reinterpret_cast to an
+// integral type
+// XFAIL: c++98, c++03
+
+// typedef decltype(nullptr) nullptr_t;
+
+
+#include <cstddef>
+#include <cassert>
+
+int main()
+{
+    std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
+    assert(i == 0);
+}
diff --git a/test/lit.cfg b/test/lit.cfg
index dc0ca5c..62a8a28 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -28,29 +28,19 @@
       FOO.fail.cpp - Negative test case which is expected to fail compilation.
     """
 
-    def __init__(self, cxx_under_test, cpp_flags, ld_flags, exec_env):
+    def __init__(self, cxx_under_test, use_verify_for_fail,
+                 cpp_flags, ld_flags, exec_env,
+                 # @LOCALMOD
+                 exe_suffix, shell_prefix):
         self.cxx_under_test = cxx_under_test
+        self.use_verify_for_fail = use_verify_for_fail
         self.cpp_flags = list(cpp_flags)
         self.ld_flags = list(ld_flags)
         self.exec_env = dict(exec_env)
-
-    def execute_command(self, command, in_dir=None):
-        kwargs = {
-            'stdin' :subprocess.PIPE,
-            'stdout':subprocess.PIPE,
-            'stderr':subprocess.PIPE,
-        }
-        if in_dir:
-            kwargs['cwd'] = in_dir
-        p = subprocess.Popen(command, **kwargs)
-        out,err = p.communicate()
-        exitCode = p.wait()
-
-        # Detect Ctrl-C in subprocess.
-        if exitCode == -signal.SIGINT:
-            raise KeyboardInterrupt
-
-        return out, err, exitCode
+        # @LOCALMOD-START
+        self.exe_suffix = exe_suffix
+        self.shell_prefix = shell_prefix
+        # @LOCALMOD-END
 
     def execute(self, test, lit_config):
         while True:
@@ -64,6 +54,8 @@
     def _execute(self, test, lit_config):
         # Extract test metadata from the test file.
         requires = []
+        unsupported = []
+        use_verify = False
         with open(test.getSourcePath()) as f:
             for ln in f:
                 if 'XFAIL:' in ln:
@@ -72,6 +64,11 @@
                 elif 'REQUIRES:' in ln:
                     items = ln[ln.index('REQUIRES:') + 9:].split(',')
                     requires.extend([s.strip() for s in items])
+                elif 'UNSUPPORTED:' in ln:
+                    items = ln[ln.index('UNSUPPORTED:') + 12:].split(',')
+                    unsupported.extend([s.strip() for s in items])
+                elif 'USE_VERIFY' in ln and self.use_verify_for_fail:
+                    use_verify = True
                 elif not ln.strip().startswith("//") and ln.strip():
                     # Stop at the first non-empty line that is not a C++
                     # comment.
@@ -89,10 +86,52 @@
                     "Test requires the following features: %s" % (
                       ', '.join(missing_required_features),))
 
-        # Evaluate the test.
-        return self._evaluate_test(test, lit_config)
+        unsupported_features = [f for f in unsupported
+                             if f in test.config.available_features]
+        if unsupported_features:
+            return (lit.Test.UNSUPPORTED,
+                    "Test is unsupported with the following features: %s" % (
+                       ', '.join(unsupported_features),))
 
-    def _evaluate_test(self, test, lit_config):
+        # Evaluate the test.
+        return self._evaluate_test(test, use_verify, lit_config)
+
+    def _build(self, exec_path, source_path, compile_only=False,
+               use_verify=False):
+        cmd = [self.cxx_under_test, '-o', exec_path,
+               source_path] + self.cpp_flags
+
+        if compile_only:
+            cmd += ['-c']
+        else:
+            cmd += self.ld_flags
+
+        if use_verify:
+            cmd += ['-Xclang', '-verify']
+
+        out, err, rc = lit.util.executeCommand(cmd)
+        return cmd, out, err, rc
+
+    def _clean(self, exec_path):
+        os.remove(exec_path)
+
+    def _run(self, exec_path, lit_config, in_dir=None):
+        cmd = []
+        if self.exec_env:
+            cmd.append('env')
+            cmd.extend('%s=%s' % (name, value)
+                       for name,value in self.exec_env.items())
+        cmd.append(exec_path)
+        # @LOCALMOD-START
+        if self.shell_prefix:
+            cmd = self.shell_prefix + cmd
+        # @LOCALMOD-END
+        if lit_config.useValgrind:
+            cmd = lit_config.valgrindArgs + cmd
+        out, err, exitCode = lit.util.executeCommand(cmd, cwd=in_dir)
+        return cmd, out, err, exitCode
+
+    def _evaluate_test(self, test, use_verify, lit_config):
         name = test.path_in_suite[-1]
         source_path = test.getSourcePath()
         source_dir = os.path.dirname(source_path)
@@ -103,15 +142,16 @@
 
         # If this is a compile (failure) test, build it and check for failure.
         if expected_compile_fail:
-            cmd = [self.cxx_under_test, '-c',
-                   '-o', '/dev/null', source_path] + self.cpp_flags
-            out, err, exitCode = self.execute_command(cmd)
-            if exitCode == 1:
+            cmd, out, err, rc = self._build('/dev/null', source_path,
+                                            compile_only=True,
+                                            use_verify=use_verify)
+            expected_rc = 0 if use_verify else 1
+            if rc == expected_rc:
                 return lit.Test.PASS, ""
             else:
                 report = """Command: %s\n""" % ' '.join(["'%s'" % a
                                                          for a in cmd])
-                report += """Exit Code: %d\n""" % exitCode
+                report += """Exit Code: %d\n""" % rc
                 if out:
                     report += """Standard Output:\n--\n%s--""" % out
                 if err:
@@ -121,20 +161,18 @@
         else:
             # @LOCALMOD-START
             exec_file = tempfile.NamedTemporaryFile(
-                suffix=exe_suffix, delete=False)
+                suffix=self.exe_suffix, delete=False)
             # @LOCALMOD-END
             exec_path = exec_file.name
             exec_file.close()
 
             try:
-                compile_cmd = [self.cxx_under_test, '-o', exec_path,
-                       source_path] + self.cpp_flags + self.ld_flags
-                cmd = compile_cmd
-                out, err, exitCode = self.execute_command(cmd)
-                if exitCode != 0:
+                cmd, out, err, rc = self._build(exec_path, source_path)
+                compile_cmd = cmd
+                if rc != 0:
                     report = """Command: %s\n""" % ' '.join(["'%s'" % a
                                                              for a in cmd])
-                    report += """Exit Code: %d\n""" % exitCode
+                    report += """Exit Code: %d\n""" % rc
                     if out:
                         report += """Standard Output:\n--\n%s--""" % out
                     if err:
@@ -142,25 +180,14 @@
                     report += "\n\nCompilation failed unexpectedly!"
                     return lit.Test.FAIL, report
 
-                cmd = []
-                if self.exec_env:
-                    cmd.append('env')
-                    cmd.extend('%s=%s' % (name, value)
-                               for name,value in self.exec_env.items())
-                cmd.append(exec_path)
-                # @LOCALMOD-START
-                if shell_prefix:
-                  cmd = shell_prefix + cmd
-                # @LOCALMOD-END
-                if lit_config.useValgrind:
-                    cmd = lit_config.valgrindArgs + cmd
-                out, err, exitCode = self.execute_command(cmd, source_dir)
-                if exitCode != 0:
+                cmd, out, err, rc = self._run(exec_path, lit_config,
+                                              source_dir)
+                if rc != 0:
                     report = """Compiled With: %s\n""" % \
                         ' '.join(["'%s'" % a for a in compile_cmd])
                     report += """Command: %s\n""" % \
                         ' '.join(["'%s'" % a for a in cmd])
-                    report += """Exit Code: %d\n""" % exitCode
+                    report += """Exit Code: %d\n""" % rc
                     if out:
                         report += """Standard Output:\n--\n%s--""" % out
                     if err:
@@ -169,11 +196,361 @@
                     return lit.Test.FAIL, report
             finally:
                 try:
-                    os.remove(exec_path)
+                    # Note that cleanup of exec_file happens in `_clean()`. If
+                    # you override this, cleanup is your reponsibility.
+                    self._clean(exec_path)
                 except:
                     pass
         return lit.Test.PASS, ""
 
+
+class Configuration(object):
+    def __init__(self, lit_config, config):
+        self.lit_config = lit_config
+        self.config = config
+        # @LOCALMOD-START
+        self.exe_suffix = None
+        self.shell_prefix = None
+        # @LOCALMOD-END
+        self.cxx = None
+        self.src_root = None
+        self.obj_root = None
+        self.env = {}
+        self.compile_flags = ['-nostdinc++']
+        self.link_flags = ['-nodefaultlibs']
+        self.use_system_lib = False
+        self.use_clang_verify = False
+
+        if platform.system() not in ('Darwin', 'FreeBSD', 'Linux'):
+            self.lit_config.fatal("unrecognized system")
+
+    def get_lit_conf(self, name, default=None):
+        val = self.lit_config.params.get(name, None)
+        if val is None:
+            val = getattr(self.config, name, None)
+            if val is None:
+                val = default
+        return val
+
+    def get_lit_bool(self, name):
+        conf = self.get_lit_conf(name)
+        if conf is None:
+            return None
+        if conf.lower() in ('1', 'true'):
+            return True
+        if conf.lower() in ('', '0', 'false'):
+            return False
+        self.lit_config.fatal(
+            "parameter '{}' should be true or false".format(name))
+
+    def configure(self):
+        # @LOCALMOD
+        self.configure_exe_wrappers()
+        self.configure_cxx()
+        self.configure_triple()
+        self.configure_src_root()
+        self.configure_obj_root()
+        self.configure_use_system_lib()
+        self.configure_use_clang_verify()
+        self.configure_env()
+        self.configure_std_flag()
+        self.configure_compile_flags()
+        self.configure_link_flags()
+        self.configure_sanitizer()
+        self.configure_features()
+        # @LOCALMOD-START -- filter out nostdinc++ and nodefaultlibs if needed.
+        if self.use_system_lib:
+            self.compile_flags = [flag for flag in self.compile_flags
+                                  if flag != '-nostdinc++']
+            self.link_flags = [flag for flag in self.link_flags
+                               if flag != '-nodefaultlibs']
+        # @LOCALMOD-END
+        # Print the final compile and link flags.
+        self.lit_config.note('Using compile flags: %s' % self.compile_flags)
+        self.lit_config.note('Using link flags: %s' % self.link_flags)
+        # Print as list to prevent "set([...])" from being printed.
+        self.lit_config.note('Using available_features: %s' %
+                             list(self.config.available_features))
+
+    def get_test_format(self):
+        return LibcxxTestFormat(
+            self.cxx,
+            self.use_clang_verify,
+            cpp_flags=self.compile_flags,
+            ld_flags=self.link_flags,
+            exec_env=self.env,
+            # @LOCALMOD
+            exe_suffix=self.exe_suffix,
+            shell_prefix=self.shell_prefix)
+
+    # @LOCALMOD-START
+    def configure_exe_wrappers(self):
+        # Allow customizing the resulting executable's suffix
+        # as well as an wrapper around how to run the executable
+        # via a shell_prefix.
+        self.exe_suffix = self.get_lit_conf('exe_suffix', 'exe')
+        self.shell_prefix = self.get_lit_conf('shell_prefix', None)
+        if self.shell_prefix:
+            self.shell_prefix = shlex.split(self.shell_prefix)
+    # @LOCALMOD-END
+
+    def configure_cxx(self):
+        # Gather various compiler parameters.
+        self.cxx = self.get_lit_conf('cxx_under_test')
+
+        # If no specific cxx_under_test was given, attempt to infer it as
+        # clang++.
+        if self.cxx is None:
+            clangxx = lit.util.which('clang++',
+                                     self.config.environment['PATH'])
+            if clangxx:
+                self.cxx = clangxx
+                self.lit_config.note(
+                    "inferred cxx_under_test as: %r" % self.cxx)
+        if not self.cxx:
+            self.lit_config.fatal('must specify user parameter cxx_under_test '
+                                  '(e.g., --param=cxx_under_test=clang++)')
+
+    def configure_src_root(self):
+        self.src_root = self.get_lit_conf(
+            'libcxx_src_root', os.path.dirname(self.config.test_source_root))
+
+    def configure_obj_root(self):
+        self.obj_root = self.get_lit_conf('libcxx_obj_root', self.src_root)
+
+    def configure_use_system_lib(self):
+        # This test suite supports testing against either the system library or
+        # the locally built one; the former mode is useful for testing ABI
+        # compatibility between the current headers and a shipping dynamic
+        # library.
+        self.use_system_lib = self.get_lit_bool('use_system_lib')
+        if self.use_system_lib is None:
+            # Default to testing against the locally built libc++ library.
+            self.use_system_lib = False
+            self.lit_config.note(
+                "inferred use_system_lib as: %r" % self.use_system_lib)
+
+    def configure_use_clang_verify(self):
+        '''If set, run clang with -verify on failing tests.'''
+        self.use_clang_verify = self.get_lit_bool('use_clang_verify')
+        if self.use_clang_verify is None:
+            # TODO: Default this to True when using clang.
+            self.use_clang_verify = False
+            self.lit_config.note(
+                "inferred use_clang_verify as: %r" % self.use_clang_verify)
+
+    def configure_features(self):
+        additional_features = self.get_lit_conf('additional_features')
+        if additional_features:
+            for f in additional_features.split(','):
+                self.config.available_features.add(f.strip())
+
+        # Figure out which of the required locales we support
+        locales = {
+            'Darwin': {
+                'en_US.UTF-8': 'en_US.UTF-8',
+                'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
+                'fr_FR.UTF-8': 'fr_FR.UTF-8',
+                'fr_CA.ISO8859-1': 'cs_CZ.ISO8859-1',
+                'ru_RU.UTF-8': 'ru_RU.UTF-8',
+                'zh_CN.UTF-8': 'zh_CN.UTF-8',
+            },
+            'FreeBSD': {
+                'en_US.UTF-8': 'en_US.UTF-8',
+                'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
+                'fr_FR.UTF-8': 'fr_FR.UTF-8',
+                'fr_CA.ISO8859-1': 'fr_CA.ISO8859-1',
+                'ru_RU.UTF-8': 'ru_RU.UTF-8',
+                'zh_CN.UTF-8': 'zh_CN.UTF-8',
+            },
+            'Linux': {
+                'en_US.UTF-8': 'en_US.UTF-8',
+                'cs_CZ.ISO8859-2': 'cs_CZ.ISO-8859-2',
+                'fr_FR.UTF-8': 'fr_FR.UTF-8',
+                'fr_CA.ISO8859-1': 'fr_CA.ISO-8859-1',
+                'ru_RU.UTF-8': 'ru_RU.UTF-8',
+                'zh_CN.UTF-8': 'zh_CN.UTF-8',
+            },
+            'Windows': {
+                'en_US.UTF-8': 'English_United States.1252',
+                'cs_CZ.ISO8859-2': 'Czech_Czech Republic.1250',
+                'fr_FR.UTF-8': 'French_France.1252',
+                'fr_CA.ISO8859-1': 'French_Canada.1252',
+                'ru_RU.UTF-8': 'Russian_Russia.1251',
+                'zh_CN.UTF-8': 'Chinese_China.936',
+            },
+        }
+
+        default_locale = locale.setlocale(locale.LC_ALL)
+        for feature, loc in locales[platform.system()].items():
+            try:
+                locale.setlocale(locale.LC_ALL, loc)
+                self.config.available_features.add('locale.{0}'.format(feature))
+            except:
+                self.lit_config.warning('The locale {0} is not supported by '
+                                        'your platform. Some tests will be '
+                                        'unsupported.'.format(loc))
+        locale.setlocale(locale.LC_ALL, default_locale)
+
+        # Write an "available feature" that combines the triple when
+        # use_system_lib is enabled. This is so that we can easily write XFAIL
+        # markers for tests that are known to fail with versions of libc++ as
+        # were shipped with a particular triple.
+        if self.use_system_lib:
+            self.config.available_features.add(
+                'with_system_lib=%s' % self.config.target_triple)
+
+        if 'libcpp-has-no-threads' in self.config.available_features:
+            self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
+
+        if 'libcpp-has-no-monotonic-clock' in self.config.available_features:
+            self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
+
+        # Some linux distributions have different locale data than others.
+        # Insert the distributions name and name-version into the available
+        # features to allow tests to XFAIL on them.
+        if sys.platform.startswith('linux'):
+            name, ver, _ = platform.linux_distribution()
+            name = name.lower().strip()
+            ver = ver.lower().strip()
+            self.config.available_features.add(name)
+            self.config.available_features.add('%s-%s' % (name, ver))
+
+    def configure_compile_flags(self):
+        # Configure extra compiler flags.
+        self.compile_flags += ['-I' + self.src_root + '/include',
+                               '-I' + self.src_root + '/test/support']
+        if sys.platform.startswith('linux'):
+            self.compile_flags += ['-D__STDC_FORMAT_MACROS',
+                                   '-D__STDC_LIMIT_MACROS',
+                                   '-D__STDC_CONSTANT_MACROS']
+
+    def configure_link_flags(self):
+        # Configure library search paths
+        abi_library_path = self.get_lit_conf('abi_library_path', '')
+        self.link_flags += ['-L' + self.obj_root + '/lib']
+        if not self.use_system_lib:
+            self.link_flags += ['-Wl,-rpath', '-Wl,' + self.obj_root + '/lib']
+        if abi_library_path:
+            self.link_flags += ['-L' + abi_library_path,
+                                '-Wl,-rpath', '-Wl,' + abi_library_path]
+        # Configure libraries
+        self.link_flags += ['-lc++']
+        link_flags_str = self.get_lit_conf('link_flags')
+        if link_flags_str is None:
+            cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
+            if cxx_abi == 'libstdc++':
+                self.link_flags += ['-lstdc++']
+            elif cxx_abi == 'libsupc++':
+                self.link_flags += ['-lsupc++']
+            elif cxx_abi == 'libcxxabi':
+                self.link_flags += ['-lc++abi']
+            elif cxx_abi == 'libcxxrt':
+                self.link_flags += ['-lcxxrt']
+            elif cxx_abi == 'none':
+                pass
+            else:
+                self.lit_config.fatal(
+                    'C++ ABI setting %s unsupported for tests' % cxx_abi)
+
+            if sys.platform == 'darwin':
+                self.link_flags += ['-lSystem']
+            elif sys.platform.startswith('linux'):
+                self.link_flags += ['-lgcc_eh', '-lc', '-lm', '-lpthread',
+                                    '-lrt', '-lgcc_s']
+            elif sys.platform.startswith('freebsd'):
+                self.link_flags += ['-lc', '-lm', '-pthread', '-lgcc_s']
+            else:
+                self.lit_config.fatal("unrecognized system: %r" % sys.platform)
+
+        if link_flags_str:
+            self.link_flags += shlex.split(link_flags_str)
+
+
+    def configure_std_flag(self):
+        # Try and get the std version from the command line. Fall back to
+        # default given in lit.site.cfg is not present. If default is not
+        # present then force c++11.
+        std = self.get_lit_conf('std')
+        if std is None:
+            std = 'c++11'
+            self.lit_config.note('using default std: \'-std=c++11\'')
+        self.compile_flags += ['-std={0}'.format(std)]
+        self.config.available_features.add(std)
+
+    def configure_sanitizer(self):
+        san = self.get_lit_conf('llvm_use_sanitizer', '').strip()
+        if san:
+            # Search for llvm-symbolizer along the compiler path first
+            # and then along the PATH env variable.
+            symbolizer_search_paths = os.environ.get('PATH', '')
+            cxx_path = lit.util.which(self.cxx)
+            if cxx_path is not None:
+                symbolizer_search_paths = os.path.dirname(cxx_path) + \
+                                          os.pathsep + symbolizer_search_paths
+            llvm_symbolizer = lit.util.which('llvm-symbolizer',
+                                             symbolizer_search_paths)
+            # Setup the sanitizer compile flags
+            self.compile_flags += ['-g', '-fno-omit-frame-pointer']
+            if sys.platform.startswith('linux'):
+                self.link_flags += ['-ldl']
+            if san == 'Address':
+                self.compile_flags += ['-fsanitize=address']
+                if llvm_symbolizer is not None:
+                    self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
+                self.config.available_features.add('asan')
+            elif san == 'Memory' or san == 'MemoryWithOrigins':
+                self.compile_flags += ['-fsanitize=memory']
+                if san == 'MemoryWithOrigins':
+                    self.compile_flags += ['-fsanitize-memory-track-origins']
+                if llvm_symbolizer is not None:
+                    self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
+                self.config.available_features.add('msan')
+            elif san == 'Undefined':
+                self.compile_flags += ['-fsanitize=undefined',
+                                       '-fno-sanitize=vptr,function',
+                                       '-fno-sanitize-recover', '-O3']
+                self.config.available_features.add('ubsan')
+            elif san == 'Thread':
+                self.compile_flags += ['-fsanitize=thread']
+                self.config.available_features.add('tsan')
+            else:
+                self.lit_config.fatal('unsupported value for '
+                                      'libcxx_use_san: {0}'.format(san))
+
+    def configure_triple(self):
+        # Get or infer the target triple.
+        self.config.target_triple = self.get_lit_conf('target_triple')
+        # If no target triple was given, try to infer it from the compiler
+        # under test.
+        if not self.config.target_triple:
+            target_triple = lit.util.capture(
+                [self.cxx, '-dumpmachine']).strip()
+            # Drop sub-major version components from the triple, because the
+            # current XFAIL handling expects exact matches for feature checks.
+            # Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
+            # The 5th group handles triples greater than 3 parts
+            # (ex x86_64-pc-linux-gnu).
+            target_triple = re.sub(r'([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)',
+                                   r'\1-\2-\3\5', target_triple)
+            # linux-gnu is needed in the triple to properly identify linuxes
+            # that use GLIBC. Handle redhat and opensuse triples as special
+            # cases and append the missing `-gnu` portion.
+            if target_triple.endswith('redhat-linux') or \
+               target_triple.endswith('suse-linux'):
+                target_triple += '-gnu'
+            self.config.target_triple = target_triple
+            self.lit_config.note(
+                "inferred target_triple as: %r" % self.config.target_triple)
+
+    def configure_env(self):
+        # Configure extra linker parameters.
+        if sys.platform == 'darwin':
+            if not self.use_system_lib:
+                self.env['DYLD_LIBRARY_PATH'] = os.path.join(self.obj_root,
+                                                             'lib')
+
+
 # name: The name of this test suite.
 config.name = 'libc++'
 
@@ -183,182 +560,11 @@
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
-# Figure out which of the required locales we support
-locales = {
-    'Darwin': {
-        'en_US.UTF-8': 'en_US.UTF-8',
-        'cs_CZ.ISO8859-2': 'cs_CZ.ISO8859-2',
-        'fr_FR.UTF-8': 'fr_FR.UTF-8',
-        'fr_CA.ISO8859-1': 'cs_CZ.ISO8859-1',
-        'ru_RU.UTF-8': 'ru_RU.UTF-8',
-        'zh_CN.UTF-8': 'zh_CN.UTF-8',
-    },
-    'Linux': {
-        'en_US.UTF-8': 'en_US.UTF-8',
-        'cs_CZ.ISO8859-2': 'cs_CZ.ISO-8859-2',
-        'fr_FR.UTF-8': 'fr_FR.UTF-8',
-        'fr_CA.ISO8859-1': 'fr_CA.ISO-8859-1',
-        'ru_RU.UTF-8': 'ru_RU.UTF-8',
-        'zh_CN.UTF-8': 'zh_CN.UTF-8',
-    },
-    'Windows': {
-        'en_US.UTF-8': 'English_United States.1252',
-        'cs_CZ.ISO8859-2': 'Czech_Czech Republic.1250',
-        'fr_FR.UTF-8': 'French_France.1252',
-        'fr_CA.ISO8859-1': 'French_Canada.1252',
-        'ru_RU.UTF-8': 'Russian_Russia.1251',
-        'zh_CN.UTF-8': 'Chinese_China.936',
-    },
-}
+cfg_variant = getattr(config, 'configuration_variant', '')
+if cfg_variant:
+    print 'Using configuration variant: %s' % cfg_variant
 
-for feature, loc in locales[platform.system()].items():
-    try:
-        locale.setlocale(locale.LC_ALL, loc)
-        config.available_features.add('locale.{}'.format(feature))
-    except:
-        lit_config.warning('The locale {} is not supported by your platform. '
-                           'Some tests will be unsupported.'.format(loc))
-
-# Gather various compiler parameters.
-cxx_under_test = lit_config.params.get('cxx_under_test', None)
-if cxx_under_test is None:
-    cxx_under_test = getattr(config, 'cxx_under_test', None)
-
-    # If no specific cxx_under_test was given, attempt to infer it as clang++.
-    if cxx_under_test is None:
-        clangxx = lit.util.which('clang++', config.environment['PATH'])
-        if clangxx is not None:
-            cxx_under_test = clangxx
-    lit_config.note("inferred cxx_under_test as: %r" % (cxx_under_test,))
-if cxx_under_test is None:
-    lit_config.fatal('must specify user parameter cxx_under_test '
-                     '(e.g., --param=cxx_under_test=clang++)')
-
-libcxx_src_root = lit_config.params.get('libcxx_src_root', None)
-if libcxx_src_root is None:
-    libcxx_src_root = getattr(config, 'libcxx_src_root', None)
-    if libcxx_src_root is None:
-        libcxx_src_root = os.path.dirname(config.test_source_root)
-
-libcxx_obj_root = lit_config.params.get('libcxx_obj_root', None)
-if libcxx_obj_root is None:
-    libcxx_obj_root = getattr(config, 'libcxx_obj_root', None)
-    if libcxx_obj_root is None:
-        libcxx_obj_root = libcxx_src_root
-
-cxx_has_stdcxx0x_flag_str = lit_config.params.get('cxx_has_stdcxx0x_flag', None)
-if cxx_has_stdcxx0x_flag_str is not None:
-    if cxx_has_stdcxx0x_flag_str.lower() in ('1', 'true'):
-        cxx_has_stdcxx0x_flag = True
-    elif cxx_has_stdcxx0x_flag_str.lower() in ('', '0', 'false'):
-        cxx_has_stdcxx0x_flag = False
-    else:
-        lit_config.fatal(
-            'user parameter cxx_has_stdcxx0x_flag_str should be 0 or 1')
-else:
-    cxx_has_stdcxx0x_flag = getattr(config, 'cxx_has_stdcxx0x_flag', True)
-
-# This test suite supports testing against either the system library or the
-# locally built one; the former mode is useful for testing ABI compatibility
-# between the current headers and a shipping dynamic library.
-use_system_lib_str = lit_config.params.get('use_system_lib', None)
-if use_system_lib_str is not None:
-    if use_system_lib_str.lower() in ('1', 'true'):
-        use_system_lib = True
-    elif use_system_lib_str.lower() in ('', '0', 'false'):
-        use_system_lib = False
-    else:
-        lit_config.fatal('user parameter use_system_lib should be 0 or 1')
-else:
-    # Default to testing against the locally built libc++ library.
-    use_system_lib = False
-    lit_config.note("inferred use_system_lib as: %r" % (use_system_lib,))
-
-link_flags = []
-link_flags_str = lit_config.params.get('link_flags', None)
-if link_flags_str is None:
-    link_flags_str = getattr(config, 'link_flags', None)
-    if link_flags_str is None:
-      cxx_abi = getattr(config, 'cxx_abi', 'libcxxabi')
-      if cxx_abi == 'libstdc++':
-        link_flags += ['-lstdc++']
-      elif cxx_abi == 'libsupc++':
-        link_flags += ['-lsupc++']
-      elif cxx_abi == 'libcxxabi':
-        link_flags += ['-lc++abi']
-      elif cxx_abi == 'none':
-        pass
-      else:
-        lit_config.fatal('C++ ABI setting %s unsupported for tests' % cxx_abi)
-
-      if sys.platform == 'darwin':
-        link_flags += ['-lSystem']
-      elif sys.platform == 'linux2':
-        link_flags += [ '-lgcc_eh', '-lc', '-lm', '-lpthread',
-              '-lrt', '-lgcc_s']
-      else:
-        lit_config.fatal("unrecognized system")
-
-      lit_config.note("inferred link_flags as: %r" % (link_flags,))
-if not link_flags_str is None:
-    link_flags += shlex.split(link_flags_str)
-
-# Configure extra compiler flags.
-include_paths = ['-I' + libcxx_src_root + '/include',
-    '-I' + libcxx_src_root + '/test/support']
-library_paths = ['-L' + libcxx_obj_root + '/lib']
-compile_flags = []
-if cxx_has_stdcxx0x_flag:
-    compile_flags += ['-std=c++0x']
-
-# Configure extra linker parameters.
-exec_env = {}
-if sys.platform == 'darwin':
-    if not use_system_lib:
-        exec_env['DYLD_LIBRARY_PATH'] = os.path.join(libcxx_obj_root, 'lib')
-elif sys.platform == 'linux2':
-    if not use_system_lib:
-        link_flags += ['-Wl,-R', libcxx_obj_root + '/lib']
-    compile_flags += ['-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
-        '-D__STDC_CONSTANT_MACROS']
-else:
-    lit_config.fatal("unrecognized system")
-
-config.test_format = LibcxxTestFormat(
-    cxx_under_test,
-    # @LOCALMOD-START
-    cpp_flags = (([] if use_system_lib else ['-nostdinc++']) +
-                 compile_flags + include_paths),
-    ld_flags = (([] if use_system_lib else ['-nodefaultlibs', '-lc++']) +
-                library_paths + link_flags),
-    # @LOCALMOD-END
-    exec_env = exec_env)
-
-# Get or infer the target triple.
-config.target_triple = lit_config.params.get('target_triple', None)
-# If no target triple was given, try to infer it from the compiler under test.
-if config.target_triple is None:
-    config.target_triple = lit.util.capture(
-        [cxx_under_test, '-dumpmachine']).strip()
-    lit_config.note("inferred target_triple as: %r" % (config.target_triple,))
-
-# @LOCALMOD-START
-# Executable suffix.
-exe_suffix = lit_config.params.get('exe_suffix', "exe")
-
-# Prefix the executable command with a shell.
-shell_prefix = lit_config.params.get('shell_prefix', None)
-if shell_prefix:
-  shell_prefix = shlex.split(shell_prefix)
-# @LOCALMOD-END
-
-# Write an "available feature" that combines the triple when use_system_lib is
-# enabled. This is so that we can easily write XFAIL markers for tests that are
-# known to fail with versions of libc++ as were shipped with a particular
-# triple.
-if use_system_lib:
-    # Drop sub-major version components from the triple, because the current
-    # XFAIL handling expects exact matches for feature checks.
-    sanitized_triple = re.sub(r"([^-]+)-([^-]+)-([^-.]+).*", r"\1-\2-\3",
-                              config.target_triple)
-    config.available_features.add('with_system_lib=%s' % (sanitized_triple,))
+# Construct an object of the type named `<VARIANT>Configuration`.
+configuration = globals()['%sConfiguration' % cfg_variant](lit_config, config)
+configuration.configure()
+config.test_format = configuration.get_test_format()
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 1a73dff..43fdb7d 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -1,11 +1,13 @@
 @AUTO_GEN_COMMENT@
 config.cxx_under_test        = "@LIBCXX_COMPILER@"
-config.cxx_has_stdcxx0x_flag = @LIBCXX_HAS_STDCXX0X_FLAG@
+config.std                   = "@LIBCXX_STD_VERSION@"
 config.libcxx_src_root       = "@LIBCXX_SOURCE_DIR@"
 config.libcxx_obj_root       = "@LIBCXX_BINARY_DIR@"
 config.python_executable     = "@PYTHON_EXECUTABLE@"
 config.enable_shared         = @LIBCXX_ENABLE_SHARED@
 config.cxx_abi               = "@LIBCXX_CXX_ABI_LIBNAME@"
+config.llvm_use_sanitizer    = "@LLVM_USE_SANITIZER@"
+config.abi_library_path      = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
diff --git a/test/localization/c.locales/clocale.pass.cpp b/test/localization/c.locales/clocale.pass.cpp
index 8774865..3b3e933 100644
--- a/test/localization/c.locales/clocale.pass.cpp
+++ b/test/localization/c.locales/clocale.pass.cpp
@@ -43,6 +43,6 @@
 int main()
 {
     std::lconv lc;
-    static_assert((std::is_same<__typeof__(std::setlocale(0, "")), char*>::value), "");
-    static_assert((std::is_same<__typeof__(std::localeconv()), std::lconv*>::value), "");
+    static_assert((std::is_same<decltype(std::setlocale(0, "")), char*>::value), "");
+    static_assert((std::is_same<decltype(std::localeconv()), std::lconv*>::value), "");
 }
diff --git a/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp b/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
index d644125..69af9ac 100644
--- a/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
+++ b/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
@@ -18,6 +18,11 @@
 //     has any difference from "C" collation.  But I do believe I'm picking
 //     up the OS's collation files.
 
+// TODO investigation needed.
+// Glibc seems to collate files differently from the way Apple's C library does
+// it.
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <string>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp b/test/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
index 20a7d48..8971412 100644
--- a/test/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
+++ b/test/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp
@@ -13,6 +13,8 @@
 
 // string_type transform(const charT* low, const charT* high) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <string>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp b/test/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
index 6d9e1cd..f7c957b 100644
--- a/test/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
@@ -13,6 +13,8 @@
 
 // ~ctype();
 
+// UNSUPPORTED: asan, msan
+
 #include <locale>
 #include <cassert>
 #include <new>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
index 0ade80a..509e52a 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
@@ -13,6 +13,8 @@
 
 // bool is(mask m, charT c) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <type_traits>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp
index 39f6071..a993466 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/is_many.pass.cpp
@@ -13,6 +13,8 @@
 
 // const charT* do_is(const charT* low, const charT* high, mask* vec) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <string>
 #include <vector>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
index 98bd6dc..904ced3 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_1.pass.cpp
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.en_US.UTF-8
-// REQUIRES: locale.fr_CA.UTF-8
+// REQUIRES: locale.fr_CA.ISO8859-1
 
 // <locale>
 
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
index 0162a6f..6f25b9c 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/narrow_many.pass.cpp
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.en_US.UTF-8
-// REQUIRES: locale.fr_CA.UTF-8
+// REQUIRES: locale.fr_CA.ISO8859-1
 
 // <locale>
 
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp
index ab08794..25b2c3e 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp
@@ -13,6 +13,8 @@
 
 // const charT* scan_is(mask m, const charT* low, const charT* high) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <string>
 #include <vector>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp
index 126fc5a..270ae1f 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/scan_not.pass.cpp
@@ -13,6 +13,8 @@
 
 // const charT* scan_not(mask m, const charT* low, const charT* high) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <string>
 #include <vector>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
index 8f84195..f957149 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
@@ -15,6 +15,7 @@
 
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
 
 #include <locale>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
index 1f48076..9579f4d 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
@@ -15,6 +15,7 @@
 
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
 
 #include <locale>
 #include <string>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
index d215791..9b09e81 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
@@ -15,6 +15,7 @@
 
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
 
 #include <locale>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
index c3c32e7..87e9b97 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
@@ -15,6 +15,7 @@
 
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
+// XFAIL: linux
 
 #include <locale>
 #include <string>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
index ed56dd3..320e08d 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
@@ -15,6 +15,8 @@
 
 // I doubt this test is portable
 
+// XFAIL: linux
+
 #include <locale>
 #include <cassert>
 #include <limits.h>
diff --git a/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp b/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
index c522762..b46ae32 100644
--- a/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+++ b/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
@@ -15,6 +15,8 @@
 
 // I doubt this test is portable
 
+// XFAIL: linux
+
 #include <locale>
 #include <string>
 #include <vector>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
index edd9015..0f034fa 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
@@ -14,6 +14,8 @@
 // iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
 //               ios_base::iostate& err, long double& v) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
index 44cec76..ec563fe 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
@@ -9,6 +9,12 @@
 //
 // XFAIL: apple-darwin
 
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux
+
 // REQUIRES: locale.ru_RU.UTF-8
 
 // <locale>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
index 374443a..07a33f7 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
@@ -16,6 +16,9 @@
 // iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
 //               ios_base::iostate& err, long double& v) const;
 
+// TODO For zh_CN GLIBC puts the negative sign after the currency symbol.
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
index 29c5266..b9099f4 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
@@ -14,6 +14,8 @@
 // iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
 //               ios_base::iostate& err, string_type& v) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
index 8614807..db193ea 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
@@ -14,6 +14,8 @@
 // iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
 //               long double units) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
index 1f335e4..54bfcfb 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -9,6 +9,12 @@
 //
 // XFAIL: apple-darwin
 
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux
+
 // REQUIRES: locale.ru_RU.UTF-8
 
 // <locale>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
index 242701e..633e188 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
@@ -16,6 +16,9 @@
 // iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
 //               long double units) const;
 
+// TODO For zh_CN GLIBC puts the negative sign after the currency symbol.
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
index 13c6ef7..659f948 100644
--- a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
@@ -14,6 +14,8 @@
 // iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
 //               const string_type& units) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 #include <locale>
 #include <ios>
 #include <streambuf>
diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
index 16d403d..8270377 100644
--- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
@@ -7,13 +7,16 @@
 //
 //===----------------------------------------------------------------------===//
 
-// <locale>
-
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_FR.UTF-8
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+// Russia uses ',' for the decimal separator. GLIBC returns '.'
+// XFAIL: linux
+
+// <locale>
+
 // class moneypunct_byname<charT, International>
 
 // charT decimal_point() const;
diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
index b7e16c6..a878283 100644
--- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
+++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
@@ -18,6 +18,12 @@
 
 // charT thousands_sep() const;
 
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <limits>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp b/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
index 2010dca..9359612 100644
--- a/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ b/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -13,6 +13,9 @@
 
 // iter_type put(iter_type s, ios_base& iob, char_type fill, long double v) const;
 
+// TODO GLIBC uses a different string for positive and negative NAN numbers.
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <ios>
 #include <cassert>
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
index 77ee5b3..9a06157 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
@@ -12,6 +12,10 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+// GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009"
+// GLIBC also failes on the zh_CN test.
+// XFAIL: linux
+
 // <locale>
 
 // class time_get_byname<charT, InputIterator>
@@ -79,6 +83,7 @@
         assert(t.tm_year == 109);
         assert(err == std::ios_base::eofbit);
     }
+
     {
         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
         const char in[] = "2009/06/10";
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
index 7d0034d..170f33a 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
@@ -12,6 +12,10 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+// GLIBC Expects "10/06/2009" for fr_FR as opposed to "10.06.2009"
+// GLIBC also failes on the zh_CN test.
+// XFAIL: linux
+
 // <locale>
 
 // class time_get_byname<charT, InputIterator>
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
index a924cef..a442ae5 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
@@ -12,6 +12,12 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+// NOTE: debian and opensuse use old locale data for ru_RU.UTF-8 abreviated
+// months. This locale data was changed in glibc 2.14.
+// Debian uses glibc 2.13 as of 20/11/2014
+// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
+// XFAIL: debian, opensuse
+
 // <locale>
 
 // class time_get_byname<charT, InputIterator>
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
index 009dc49..631a500 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
@@ -12,6 +12,12 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+// NOTE: debian and opensuse use bad locale data for ru_RU.UTF-8 abreviated
+// months. This locale data was fixed in glibc 2.14.
+// Debian uses glibc 2.13 as of 20/11/2014
+// OpenSuse uses glibc 2.19 with old locale data as of 20/11/2014
+// XFAIL: debian, opensuse
+
 // <locale>
 
 // class time_get_byname<charT, InputIterator>
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
index 536859e..72b6327 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
@@ -19,6 +19,9 @@
 // iter_type get(iter_type s, iter_type end, ios_base& f,
 //               ios_base::iostate& err, tm *t, char format, char modifier = 0) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
index 36c8a8e..ae8bce2 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -19,6 +19,9 @@
 // iter_type get(iter_type s, iter_type end, ios_base& f,
 //               ios_base::iostate& err, tm *t, char format, char modifier = 0) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
index db070be..09055ad 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
@@ -20,6 +20,9 @@
 // get_weekday(iter_type s, iter_type end, ios_base& str,
 //             ios_base::iostate& err, tm* t) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
index ac607ba..31135a3 100644
--- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
@@ -20,6 +20,9 @@
 // get_weekday(iter_type s, iter_type end, ios_base& str,
 //             ios_base::iostate& err, tm* t) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp b/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
index ff3bb82..3e7538d 100644
--- a/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
@@ -24,6 +24,9 @@
 //     ~time_put_byname();
 // };
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp b/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
index 577655f..427d7c5 100644
--- a/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
+++ b/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
@@ -14,6 +14,9 @@
 // iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
 //               char format, char modifier = 0) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
diff --git a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
index b49eca4..d5112a9 100644
--- a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+++ b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
@@ -16,6 +16,9 @@
 
 // string grouping() const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 
diff --git a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
index 80b440a..b1bd03f 100644
--- a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
+++ b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
@@ -16,6 +16,9 @@
 
 // char_type thousands_sep() const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <locale>
 #include <cassert>
 
diff --git a/test/localization/locale.stdcvt/codecvt_utf16.pass.cpp b/test/localization/locale.stdcvt/codecvt_utf16.pass.cpp
index 0569e4d..7e38021 100644
--- a/test/localization/locale.stdcvt/codecvt_utf16.pass.cpp
+++ b/test/localization/locale.stdcvt/codecvt_utf16.pass.cpp
@@ -17,6 +17,8 @@
 //     // unspecified
 // };
 
+// UNSUPPORTED: asan, msan
+
 // Not a portable test
 
 #include <codecvt>
diff --git a/test/localization/locale.stdcvt/codecvt_utf8.pass.cpp b/test/localization/locale.stdcvt/codecvt_utf8.pass.cpp
index 4232f59..cc06e95 100644
--- a/test/localization/locale.stdcvt/codecvt_utf8.pass.cpp
+++ b/test/localization/locale.stdcvt/codecvt_utf8.pass.cpp
@@ -17,6 +17,8 @@
 //     // unspecified
 // };
 
+// UNSUPPORTED: asan, msan
+
 // Not a portable test
 
 #include <codecvt>
diff --git a/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp b/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
index 6935c3e..3649f15 100644
--- a/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
+++ b/test/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
@@ -14,6 +14,8 @@
 // wbuffer_convert(streambuf *bytebuf = 0, Codecvt *pcvt = new Codecvt,
 //                 state_type state = state_type());
 
+// UNSUPPORTED: asan, msan
+
 #include <locale>
 #include <codecvt>
 #include <sstream>
diff --git a/test/localization/locales/locale/locale.cons/assign.pass.cpp b/test/localization/locales/locale/locale.cons/assign.pass.cpp
index 4aca354..75ce9b5 100644
--- a/test/localization/locales/locale/locale.cons/assign.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/assign.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp b/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp
index 8b4509b..01857a4 100644
--- a/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp
@@ -9,6 +9,7 @@
 
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/copy.pass.cpp b/test/localization/locales/locale/locale.cons/copy.pass.cpp
index 7dd7cf4..629c9e6 100644
--- a/test/localization/locales/locale/locale.cons/copy.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/copy.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.fr_FR.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/default.pass.cpp b/test/localization/locales/locale/locale.cons/default.pass.cpp
index 0d46a76..25db9bb 100644
--- a/test/localization/locales/locale/locale.cons/default.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/default.pass.cpp
@@ -11,6 +11,8 @@
 
 // locale() throw();
 
+// UNSUPPORTED: asan, msan
+
 #include <locale>
 #include <new>
 #include <cassert>
diff --git a/test/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/test/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
index 6bd1f63..eaadbb9 100644
--- a/test/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp
@@ -9,6 +9,7 @@
 
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp b/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
index f7349aa..8b83bc0 100644
--- a/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/test/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
index 05d87a4..05f0619 100644
--- a/test/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp
@@ -9,6 +9,7 @@
 
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/test/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
index 34718c8..66be76d 100644
--- a/test/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: locale.ru_RU.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.cons/string.pass.cpp b/test/localization/locales/locale/locale.cons/string.pass.cpp
index 6c80df0..32c3507 100644
--- a/test/localization/locales/locale/locale.cons/string.pass.cpp
+++ b/test/localization/locales/locale/locale.cons/string.pass.cpp
@@ -9,6 +9,7 @@
 
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
+// UNSUPPORTED: msan, asan
 
 // <locale>
 
diff --git a/test/localization/locales/locale/locale.members/combine.pass.cpp b/test/localization/locales/locale/locale.members/combine.pass.cpp
index 8d74da0..8f189c7 100644
--- a/test/localization/locales/locale/locale.members/combine.pass.cpp
+++ b/test/localization/locales/locale/locale.members/combine.pass.cpp
@@ -11,6 +11,8 @@
 
 // template <class Facet> locale combine(const locale& other) const;
 
+// UNSUPPORTED: asan, msan
+
 #include <locale>
 #include <new>
 #include <cassert>
diff --git a/test/numerics/c.math/cmath.pass.cpp b/test/numerics/c.math/cmath.pass.cpp
index 973bea0..0b0d862 100644
--- a/test/numerics/c.math/cmath.pass.cpp
+++ b/test/numerics/c.math/cmath.pass.cpp
@@ -24,11 +24,88 @@
     operator T () { return T(N); }
 };
 
+// See PR21083
+// Ambiguous is a user-defined type that defines its own overloads of cmath
+// functions. When the std overloads are candidates too (by using or adl),
+// they should not interfere.
+struct Ambiguous : std::true_type { // ADL
+    operator float () { return 0.f; }
+    operator double () { return 0.; }
+};
+Ambiguous abs(Ambiguous){ return Ambiguous(); }
+Ambiguous acos(Ambiguous){ return Ambiguous(); }
+Ambiguous asin(Ambiguous){ return Ambiguous(); }
+Ambiguous atan(Ambiguous){ return Ambiguous(); }
+Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ceil(Ambiguous){ return Ambiguous(); }
+Ambiguous cos(Ambiguous){ return Ambiguous(); }
+Ambiguous cosh(Ambiguous){ return Ambiguous(); }
+Ambiguous exp(Ambiguous){ return Ambiguous(); }
+Ambiguous fabs(Ambiguous){ return Ambiguous(); }
+Ambiguous floor(Ambiguous){ return Ambiguous(); }
+Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); }
+Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); }
+Ambiguous log(Ambiguous){ return Ambiguous(); }
+Ambiguous log10(Ambiguous){ return Ambiguous(); }
+Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); }
+Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous sin(Ambiguous){ return Ambiguous(); }
+Ambiguous sinh(Ambiguous){ return Ambiguous(); }
+Ambiguous sqrt(Ambiguous){ return Ambiguous(); }
+Ambiguous tan(Ambiguous){ return Ambiguous(); }
+Ambiguous tanh(Ambiguous){ return Ambiguous(); }
+Ambiguous signbit(Ambiguous){ return Ambiguous(); }
+Ambiguous fpclassify(Ambiguous){ return Ambiguous(); }
+Ambiguous isfinite(Ambiguous){ return Ambiguous(); }
+Ambiguous isnormal(Ambiguous){ return Ambiguous(); }
+Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous acosh(Ambiguous){ return Ambiguous(); }
+Ambiguous asinh(Ambiguous){ return Ambiguous(); }
+Ambiguous atanh(Ambiguous){ return Ambiguous(); }
+Ambiguous cbrt(Ambiguous){ return Ambiguous(); }
+Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous erf(Ambiguous){ return Ambiguous(); }
+Ambiguous erfc(Ambiguous){ return Ambiguous(); }
+Ambiguous exp2(Ambiguous){ return Ambiguous(); }
+Ambiguous expm1(Ambiguous){ return Ambiguous(); }
+Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
+Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous llrint(Ambiguous){ return Ambiguous(); }
+Ambiguous llround(Ambiguous){ return Ambiguous(); }
+Ambiguous log1p(Ambiguous){ return Ambiguous(); }
+Ambiguous log2(Ambiguous){ return Ambiguous(); }
+Ambiguous logb(Ambiguous){ return Ambiguous(); }
+Ambiguous lrint(Ambiguous){ return Ambiguous(); }
+Ambiguous lround(Ambiguous){ return Ambiguous(); }
+Ambiguous nearbyint(Ambiguous){ return Ambiguous(); }
+Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); }
+Ambiguous rint(Ambiguous){ return Ambiguous(); }
+Ambiguous round(Ambiguous){ return Ambiguous(); }
+Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); }
+Ambiguous tgamma(Ambiguous){ return Ambiguous(); }
+Ambiguous trunc(Ambiguous){ return Ambiguous(); }
+
 void test_abs()
 {
     static_assert((std::is_same<decltype(std::abs((float)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::abs((double)0)), double>::value), "");
     static_assert((std::is_same<decltype(std::abs((long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(abs(Ambiguous())), Ambiguous>::value), "");
     assert(std::abs(-1.) == 1);
 }
 
@@ -47,6 +124,7 @@
     static_assert((std::is_same<decltype(std::acos((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::acosf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::acosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acos(Ambiguous())), Ambiguous>::value), "");
     assert(std::acos(1) == 0);
 }
 
@@ -65,6 +143,7 @@
     static_assert((std::is_same<decltype(std::asin((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::asinf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::asinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asin(Ambiguous())), Ambiguous>::value), "");
     assert(std::asin(0) == 0);
 }
 
@@ -83,6 +162,7 @@
     static_assert((std::is_same<decltype(std::atan((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atanf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atan(Ambiguous())), Ambiguous>::value), "");
     assert(std::atan(0) == 0);
 }
 
@@ -105,6 +185,7 @@
     static_assert((std::is_same<decltype(std::atan2f(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atan2l(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atan2((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::atan2(0,1) == 0);
 }
 
@@ -123,6 +204,7 @@
     static_assert((std::is_same<decltype(std::ceil((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::ceilf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::ceill(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(ceil(Ambiguous())), Ambiguous>::value), "");
     assert(std::ceil(0) == 0);
 }
 
@@ -141,6 +223,7 @@
     static_assert((std::is_same<decltype(std::cos((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::cosf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::cosl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cos(Ambiguous())), Ambiguous>::value), "");
     assert(std::cos(0) == 1);
 }
 
@@ -159,6 +242,7 @@
     static_assert((std::is_same<decltype(std::cosh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::coshf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::coshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cosh(Ambiguous())), Ambiguous>::value), "");
     assert(std::cosh(0) == 1);
 }
 
@@ -177,6 +261,7 @@
     static_assert((std::is_same<decltype(std::exp((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::expf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::expl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp(Ambiguous())), Ambiguous>::value), "");
     assert(std::exp(0) == 1);
 }
 
@@ -195,6 +280,7 @@
     static_assert((std::is_same<decltype(std::fabs((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fabsf(0.0f)), float>::value), "");
     static_assert((std::is_same<decltype(std::fabsl(0.0L)), long double>::value), "");
+    static_assert((std::is_same<decltype(fabs(Ambiguous())), Ambiguous>::value), "");
     assert(std::fabs(-1) == 1);
 }
 
@@ -213,6 +299,7 @@
     static_assert((std::is_same<decltype(std::floor((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::floorf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::floorl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(floor(Ambiguous())), Ambiguous>::value), "");
     assert(std::floor(1) == 1);
 }
 
@@ -235,6 +322,7 @@
     static_assert((std::is_same<decltype(std::fmodf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmodl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmod((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmod(1.5,1) == .5);
 }
 
@@ -254,6 +342,7 @@
     static_assert((std::is_same<decltype(std::frexp((long double)0, &ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::frexpf(0, &ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::frexpl(0, &ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(frexp(Ambiguous(), &ip)), Ambiguous>::value), "");
     assert(std::frexp(0, &ip) == 0);
 }
 
@@ -273,6 +362,7 @@
     static_assert((std::is_same<decltype(std::ldexp((long double)0, ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::ldexpf(0, ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::ldexpl(0, ip)), long double>::value), "");
+    static_assert((std::is_same<decltype(ldexp(Ambiguous(), ip)), Ambiguous>::value), "");
     assert(std::ldexp(1, ip) == 2);
 }
 
@@ -291,6 +381,7 @@
     static_assert((std::is_same<decltype(std::log((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::logf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::logl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log(Ambiguous())), Ambiguous>::value), "");
     assert(std::log(1) == 0);
 }
 
@@ -309,6 +400,7 @@
     static_assert((std::is_same<decltype(std::log10((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log10f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log10l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log10(Ambiguous())), Ambiguous>::value), "");
     assert(std::log10(1) == 0);
 }
 
@@ -319,6 +411,7 @@
     static_assert((std::is_same<decltype(std::modf((long double)0, (long double*)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::modff(0, (float*)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::modfl(0, (long double*)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous>::value), "");
     double i;
     assert(std::modf(1., &i) == 0);
 }
@@ -345,6 +438,7 @@
 //     static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
 //     static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
 //     static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
+    static_assert((std::is_same<decltype(pow(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::pow(1,1) == 1);
 //     assert(std::pow(Value<int,1>(), Value<float,1>())  == 1);
 //     assert(std::pow(1.0f, Value<double,1>()) == 1);
@@ -367,6 +461,7 @@
     static_assert((std::is_same<decltype(std::sin((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sinf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sinl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sin(Ambiguous())), Ambiguous>::value), "");
     assert(std::sin(0) == 0);
 }
 
@@ -385,6 +480,7 @@
     static_assert((std::is_same<decltype(std::sinh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sinhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sinh(Ambiguous())), Ambiguous>::value), "");
     assert(std::sinh(0) == 0);
 }
 
@@ -403,6 +499,7 @@
     static_assert((std::is_same<decltype(std::sqrt((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::sqrtf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::sqrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(sqrt(Ambiguous())), Ambiguous>::value), "");
     assert(std::sqrt(4) == 2);
 }
 
@@ -421,6 +518,7 @@
     static_assert((std::is_same<decltype(std::tan((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tanf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tanl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tan(Ambiguous())), Ambiguous>::value), "");
     assert(std::tan(0) == 0);
 }
 
@@ -439,6 +537,7 @@
     static_assert((std::is_same<decltype(std::tanh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tanhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tanh(Ambiguous())), Ambiguous>::value), "");
     assert(std::tanh(0) == 0);
 }
 
@@ -451,6 +550,7 @@
     static_assert((std::is_same<decltype(std::signbit((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::signbit(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::signbit((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(signbit(Ambiguous())), Ambiguous>::value), "");
     assert(std::signbit(-1.0) == true);
 }
 
@@ -463,6 +563,7 @@
     static_assert((std::is_same<decltype(std::fpclassify((double)0)), int>::value), "");
     static_assert((std::is_same<decltype(std::fpclassify(0)), int>::value), "");
     static_assert((std::is_same<decltype(std::fpclassify((long double)0)), int>::value), "");
+    static_assert((std::is_same<decltype(fpclassify(Ambiguous())), Ambiguous>::value), "");
     assert(std::fpclassify(-1.0) == FP_NORMAL);
 }
 
@@ -475,6 +576,7 @@
     static_assert((std::is_same<decltype(std::isfinite((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isfinite(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isfinite((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isfinite(Ambiguous())), Ambiguous>::value), "");
     assert(std::isfinite(-1.0) == true);
 }
 
@@ -487,6 +589,7 @@
     static_assert((std::is_same<decltype(std::isnormal((double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isnormal(0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isnormal((long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isnormal(Ambiguous())), Ambiguous>::value), "");
     assert(std::isnormal(-1.0) == true);
 }
 
@@ -505,6 +608,7 @@
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isgreater(-1.0, 0.F) == false);
 }
 
@@ -523,6 +627,7 @@
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isgreaterequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isgreaterequal(-1.0, 0.F) == false);
 }
 
@@ -541,6 +646,7 @@
     static_assert((std::is_same<decltype(std::isless((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isless((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isless((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isless(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isless(-1.0, 0.F) == true);
 }
 
@@ -559,6 +665,7 @@
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessequal((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::islessequal(-1.0, 0.F) == true);
 }
 
@@ -577,6 +684,7 @@
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::islessgreater((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::islessgreater(-1.0, 0.F) == true);
 }
 
@@ -595,6 +703,7 @@
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (float)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (double)0)), bool>::value), "");
     static_assert((std::is_same<decltype(std::isunordered((long double)0, (long double)0)), bool>::value), "");
+    static_assert((std::is_same<decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::isunordered(-1.0, 0.F) == false);
 }
 
@@ -613,6 +722,7 @@
     static_assert((std::is_same<decltype(std::acosh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::acoshf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::acoshl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(acosh(Ambiguous())), Ambiguous>::value), "");
     assert(std::acosh(1) == 0);
 }
 
@@ -631,6 +741,7 @@
     static_assert((std::is_same<decltype(std::asinh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::asinhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::asinhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(asinh(Ambiguous())), Ambiguous>::value), "");
     assert(std::asinh(0) == 0);
 }
 
@@ -649,6 +760,7 @@
     static_assert((std::is_same<decltype(std::atanh((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::atanhf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::atanhl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(atanh(Ambiguous())), Ambiguous>::value), "");
     assert(std::atanh(0) == 0);
 }
 
@@ -667,6 +779,7 @@
     static_assert((std::is_same<decltype(std::cbrt((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::cbrtf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::cbrtl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(cbrt(Ambiguous())), Ambiguous>::value), "");
     assert(std::cbrt(1) == 1);
 }
 
@@ -689,6 +802,7 @@
     static_assert((std::is_same<decltype(std::copysignf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::copysignl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::copysign((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::copysign(1,1) == 1);
 }
 
@@ -707,6 +821,7 @@
     static_assert((std::is_same<decltype(std::erf((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::erff(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::erfl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erf(Ambiguous())), Ambiguous>::value), "");
     assert(std::erf(0) == 0);
 }
 
@@ -725,6 +840,7 @@
     static_assert((std::is_same<decltype(std::erfc((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::erfcf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::erfcl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(erfc(Ambiguous())), Ambiguous>::value), "");
     assert(std::erfc(0) == 1);
 }
 
@@ -743,6 +859,7 @@
     static_assert((std::is_same<decltype(std::exp2((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::exp2f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::exp2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(exp2(Ambiguous())), Ambiguous>::value), "");
     assert(std::exp2(1) == 2);
 }
 
@@ -761,6 +878,7 @@
     static_assert((std::is_same<decltype(std::expm1((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::expm1f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::expm1l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(expm1(Ambiguous())), Ambiguous>::value), "");
     assert(std::expm1(0) == 0);
 }
 
@@ -783,6 +901,7 @@
     static_assert((std::is_same<decltype(std::fdimf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fdiml(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fdim((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fdim(1,0) == 1);
 }
 
@@ -820,6 +939,7 @@
 
     static_assert((std::is_same<decltype(std::fmaf(0,0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmal(0,0,0)), long double>::value), "");
+    static_assert((std::is_same<decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fma(1,1,1) == 2);
 }
 
@@ -842,6 +962,7 @@
     static_assert((std::is_same<decltype(std::fmaxf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fmaxl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmax((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmax(1,0) == 1);
 }
 
@@ -864,6 +985,7 @@
     static_assert((std::is_same<decltype(std::fminf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::fminl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::fmin((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::fmin(1,0) == 0);
 }
 
@@ -886,6 +1008,7 @@
     static_assert((std::is_same<decltype(std::hypotf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::hypotl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::hypot((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::hypot(3,4) == 5);
 }
 
@@ -904,6 +1027,7 @@
     static_assert((std::is_same<decltype(std::ilogb((long double)0)), int>::value), "");
     static_assert((std::is_same<decltype(std::ilogbf(0)), int>::value), "");
     static_assert((std::is_same<decltype(std::ilogbl(0)), int>::value), "");
+    static_assert((std::is_same<decltype(ilogb(Ambiguous())), Ambiguous>::value), "");
     assert(std::ilogb(1) == 0);
 }
 
@@ -922,6 +1046,7 @@
     static_assert((std::is_same<decltype(std::lgamma((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::lgammaf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::lgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(lgamma(Ambiguous())), Ambiguous>::value), "");
     assert(std::lgamma(1) == 0);
 }
 
@@ -940,6 +1065,7 @@
     static_assert((std::is_same<decltype(std::llrint((long double)0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llrintf(0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llrintl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llrint(Ambiguous())), Ambiguous>::value), "");
     assert(std::llrint(1) == 1LL);
 }
 
@@ -958,6 +1084,7 @@
     static_assert((std::is_same<decltype(std::llround((long double)0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llroundf(0)), long long>::value), "");
     static_assert((std::is_same<decltype(std::llroundl(0)), long long>::value), "");
+    static_assert((std::is_same<decltype(llround(Ambiguous())), Ambiguous>::value), "");
     assert(std::llround(1) == 1LL);
 }
 
@@ -976,6 +1103,7 @@
     static_assert((std::is_same<decltype(std::log1p((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log1pf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log1pl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log1p(Ambiguous())), Ambiguous>::value), "");
     assert(std::log1p(0) == 0);
 }
 
@@ -994,6 +1122,7 @@
     static_assert((std::is_same<decltype(std::log2((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::log2f(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::log2l(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(log2(Ambiguous())), Ambiguous>::value), "");
     assert(std::log2(1) == 0);
 }
 
@@ -1012,6 +1141,7 @@
     static_assert((std::is_same<decltype(std::logb((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::logbf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::logbl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(logb(Ambiguous())), Ambiguous>::value), "");
     assert(std::logb(1) == 0);
 }
 
@@ -1030,6 +1160,7 @@
     static_assert((std::is_same<decltype(std::lrint((long double)0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lrintf(0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lrintl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lrint(Ambiguous())), Ambiguous>::value), "");
     assert(std::lrint(1) == 1L);
 }
 
@@ -1048,6 +1179,7 @@
     static_assert((std::is_same<decltype(std::lround((long double)0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lroundf(0)), long>::value), "");
     static_assert((std::is_same<decltype(std::lroundl(0)), long>::value), "");
+    static_assert((std::is_same<decltype(lround(Ambiguous())), Ambiguous>::value), "");
     assert(std::lround(1) == 1L);
 }
 
@@ -1073,6 +1205,7 @@
     static_assert((std::is_same<decltype(std::nearbyint((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nearbyintf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nearbyintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nearbyint(Ambiguous())), Ambiguous>::value), "");
     assert(std::nearbyint(1) == 1);
 }
 
@@ -1095,6 +1228,7 @@
     static_assert((std::is_same<decltype(std::nextafterf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nextafterl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
 }
 
@@ -1113,6 +1247,7 @@
     static_assert((std::is_same<decltype(std::nexttoward((long double)0, (long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::nexttowardf(0, (long double)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::nexttowardl(0, (long double)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
 }
 
@@ -1135,6 +1270,7 @@
     static_assert((std::is_same<decltype(std::remainderf(0,0)), float>::value), "");
     static_assert((std::is_same<decltype(std::remainderl(0,0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::remainder((int)0, (int)0)), double>::value), "");
+    static_assert((std::is_same<decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::remainder(0.5,1) == 0.5);
 }
 
@@ -1158,6 +1294,7 @@
     static_assert((std::is_same<decltype(std::remquof(0,0, &ip)), float>::value), "");
     static_assert((std::is_same<decltype(std::remquol(0,0, &ip)), long double>::value), "");
     static_assert((std::is_same<decltype(std::remquo((int)0, (int)0, &ip)), double>::value), "");
+    static_assert((std::is_same<decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous>::value), "");
     assert(std::remquo(0.5,1, &ip) == 0.5);
 }
 
@@ -1176,6 +1313,7 @@
     static_assert((std::is_same<decltype(std::rint((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::rintf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::rintl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(rint(Ambiguous())), Ambiguous>::value), "");
     assert(std::rint(1) == 1);
 }
 
@@ -1194,6 +1332,7 @@
     static_assert((std::is_same<decltype(std::round((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::roundf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::roundl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(round(Ambiguous())), Ambiguous>::value), "");
     assert(std::round(1) == 1);
 }
 
@@ -1212,6 +1351,7 @@
     static_assert((std::is_same<decltype(std::scalbln((long double)0, (long)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::scalblnf(0, (long)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::scalblnl(0, (long)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::scalbln(1, 1) == 2);
 }
 
@@ -1230,6 +1370,7 @@
     static_assert((std::is_same<decltype(std::scalbn((long double)0, (int)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::scalbnf(0, (int)0)), float>::value), "");
     static_assert((std::is_same<decltype(std::scalbnl(0, (int)0)), long double>::value), "");
+    static_assert((std::is_same<decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous>::value), "");
     assert(std::scalbn(1, 1) == 2);
 }
 
@@ -1248,6 +1389,7 @@
     static_assert((std::is_same<decltype(std::tgamma((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::tgammaf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::tgammal(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(tgamma(Ambiguous())), Ambiguous>::value), "");
     assert(std::tgamma(1) == 1);
 }
 
@@ -1266,6 +1408,7 @@
     static_assert((std::is_same<decltype(std::trunc((long double)0)), long double>::value), "");
     static_assert((std::is_same<decltype(std::truncf(0)), float>::value), "");
     static_assert((std::is_same<decltype(std::truncl(0)), long double>::value), "");
+    static_assert((std::is_same<decltype(trunc(Ambiguous())), Ambiguous>::value), "");
     assert(std::trunc(1) == 1);
 }
 
diff --git a/test/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp b/test/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp
index 3bab0df..29cb787 100644
--- a/test/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp
+++ b/test/numerics/numarray/template.mask.array/mask.array.assign/mask_array.pass.cpp
@@ -18,6 +18,7 @@
 
 int main()
 {
+    {
     int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
     const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
     bool b1[N1] = {true,  false, false, true,  true,  false,
@@ -48,4 +49,18 @@
     assert(v1[13] == 13);
     assert(v1[14] == 14);
     assert(v1[15] == 15);
+    }
+    // Test return value of assignment
+    {
+    int a1[] = {0, 1, 2};
+    int a2[] = {3, 4, 5};
+    bool b1[] = {true, false, true};
+    std::valarray<int> v1(a1, 3);
+    std::valarray<int> v2(a2, 3);
+    std::valarray<bool> const vb1(b1, 3);
+    std::mask_array<int> m1 = v1[vb1];
+    std::mask_array<int> const m2 = v2[vb1];
+    std::mask_array<int> const & r = (m1 = m2);
+    assert(&r == &m1);
+    }
 }
diff --git a/test/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp b/test/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
index b2b111a..72275e0 100644
--- a/test/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
+++ b/test/numerics/numarray/template.slice.array/slice.arr.assign/slice_array.pass.cpp
@@ -18,6 +18,7 @@
 
 int main()
 {
+    {
     int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
     int a2[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12};
     std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
@@ -40,4 +41,15 @@
     assert(v1[13] == -11);
     assert(v1[14] == 14);
     assert(v1[15] == 15);
+    }
+    // Test return value of assignment.
+    {
+    int a1[] = {0, 1, 2};
+    int a2[] = {3, 4, 3};
+    std::valarray<int> v1(a1, 3);
+    std::slice_array<int> s1 = v1[std::slice(1, 1, 1)];
+    std::slice_array<int> s2 = v1[std::slice(0, 1, 1)];
+    std::slice_array<int> const & s3 = (s1 = s2);
+    assert(&s1 == &s3);
+    }
 }
diff --git a/test/numerics/rand/rand.device/ctor.pass.cpp b/test/numerics/rand/rand.device/ctor.pass.cpp
index dfa546b..2d9bc2f 100644
--- a/test/numerics/rand/rand.device/ctor.pass.cpp
+++ b/test/numerics/rand/rand.device/ctor.pass.cpp
@@ -11,39 +11,75 @@
 
 // class random_device;
 
-// explicit random_device(const string& token = "/dev/urandom");
+// explicit random_device(const string& token = implementation-defined);
+
+// For the following ctors, the standard states: "The semantics and default
+// value of the token parameter are implementation-defined". Implementations
+// therefore aren't required to accept any string, but the default shouldn't
+// throw.
 
 #include <random>
 #include <cassert>
 #include <unistd.h>
 
-int main()
-{
-    try
-    {
-        std::random_device r("wrong file");
-        assert(false);
-    }
-    catch (const std::system_error& e)
-    {
-    }
-    {
-        std::random_device r;
-    }
-    {
-        int ec;
-        ec = close(STDIN_FILENO);
-        assert(!ec);
-        ec = close(STDOUT_FILENO);
-        assert(!ec);
-        ec = close(STDERR_FILENO);
-        assert(!ec);
-        std::random_device r;
-    }
-    {
-        std::random_device r("/dev/urandom");;
-    }
-    {
-        std::random_device r("/dev/random");;
-    }
+bool is_valid_random_device(const std::string &token) {
+#if defined(_WIN32)
+  return true;
+#elif defined(_LIBCPP_USING_NACL_RANDOM)
+  return token == "/dev/urandom";
+#else  // !defined(_WIN32) && !defined(_LIBCPP_USING_NACL_RANDOM)
+  // Not an exhaustive list: they're the only tokens that are tested below.
+  return token == "/dev/urandom" || token == "/dev/random";
+#endif // defined(_WIN32) || defined(_LIBCPP_USING_NACL_RANDOM)
+}
+
+void check_random_device_valid(const std::string &token) {
+  std::random_device r(token);
+}
+
+void check_random_device_invalid(const std::string &token) {
+  try {
+    std::random_device r(token);
+    assert(false);
+  } catch (const std::system_error &e) {
+  }
+}
+
+int main() {
+  { std::random_device r; }
+
+  {
+    int ec;
+    ec = close(STDIN_FILENO);
+    assert(!ec);
+    ec = close(STDOUT_FILENO);
+    assert(!ec);
+    ec = close(STDERR_FILENO);
+    assert(!ec);
+    std::random_device r;
+  }
+
+  {
+    std::string token = "wrong file";
+    if (is_valid_random_device(token))
+      check_random_device_valid(token);
+    else
+      check_random_device_invalid(token);
+  }
+
+  {
+    std::string token = "/dev/urandom";
+    if (is_valid_random_device(token))
+      check_random_device_valid(token);
+    else
+      check_random_device_invalid(token);
+  }
+
+  {
+    std::string token = "/dev/random";
+    if (is_valid_random_device(token))
+      check_random_device_valid(token);
+    else
+      check_random_device_invalid(token);
+  }
 }
diff --git a/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp b/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
index 3bfd2af..85ff2ac 100644
--- a/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
+++ b/test/numerics/rand/rand.dis/rand.dist.bern/rand.dist.bern.bin/eval.pass.cpp
@@ -322,6 +322,17 @@
         assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
     }
     {
+        const int N = 100000;
+        std::mt19937 gen1;
+        std::mt19937 gen2;
+
+        std::binomial_distribution<>         dist1(5, 0.1);
+        std::binomial_distribution<unsigned> dist2(5, 0.1);
+
+        for(int i = 0; i < N; ++i)
+            assert(dist1(gen1) == dist2(gen2));
+    }
+    {
         typedef std::binomial_distribution<> D;
         typedef std::mt19937 G;
         G g;
diff --git a/test/re/re.alg/re.alg.match/basic.pass.cpp b/test/re/re.alg/re.alg.match/basic.pass.cpp
index d63817d..4139cea 100644
--- a/test/re/re.alg/re.alg.match/basic.pass.cpp
+++ b/test/re/re.alg/re.alg.match/basic.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.match/ecma.pass.cpp b/test/re/re.alg/re.alg.match/ecma.pass.cpp
index 67df410..3854056 100644
--- a/test/re/re.alg/re.alg.match/ecma.pass.cpp
+++ b/test/re/re.alg/re.alg.match/ecma.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.match/extended.pass.cpp b/test/re/re.alg/re.alg.match/extended.pass.cpp
index 733c16e..c54825d 100644
--- a/test/re/re.alg/re.alg.match/extended.pass.cpp
+++ b/test/re/re.alg/re.alg.match/extended.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.match/lookahead_capture.pass.cpp b/test/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
index 78e1e65..949739b 100644
--- a/test/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
+++ b/test/re/re.alg/re.alg.match/lookahead_capture.pass.cpp
@@ -27,10 +27,10 @@
 int main()
 {
     {
-        std::regex re{"^(?=(.))a$"};
+        std::regex re("^(?=(.))a$");
         assert(re.mark_count() == 1);
 
-        std::string s{"a"};
+        std::string s("a");
         std::smatch m;
         assert(std::regex_match(s, m, re));
         assert(m.size() == 2);
@@ -39,10 +39,10 @@
     }
 
     {
-        std::regex re{"^(a)(?=(.))(b)$"};
+        std::regex re("^(a)(?=(.))(b)$");
         assert(re.mark_count() == 3);
 
-        std::string s{"ab"};
+        std::string s("ab");
         std::smatch m;
         assert(std::regex_match(s, m, re));
         assert(m.size() == 4);
@@ -53,10 +53,10 @@
     }
 
     {
-        std::regex re{"^(.)(?=(.)(?=.(.)))(...)$"};
+        std::regex re("^(.)(?=(.)(?=.(.)))(...)$");
         assert(re.mark_count() == 4);
 
-        std::string s{"abcd"};
+        std::string s("abcd");
         std::smatch m;
         assert(std::regex_match(s, m, re));
         assert(m.size() == 5);
@@ -68,10 +68,10 @@
     }
 
     {
-        std::regex re{"^(a)(?!([^b]))(.c)$"};
+        std::regex re("^(a)(?!([^b]))(.c)$");
         assert(re.mark_count() == 3);
 
-        std::string s{"abc"};
+        std::string s("abc");
         std::smatch m;
         assert(std::regex_match(s, m, re));
         assert(m.size() == 4);
@@ -82,10 +82,10 @@
     }
 
     {
-        std::regex re{"^(?!((b)))(?=(.))(?!(abc)).b$"};
+        std::regex re("^(?!((b)))(?=(.))(?!(abc)).b$");
         assert(re.mark_count() == 4);
 
-        std::string s{"ab"};
+        std::string s("ab");
         std::smatch m;
         assert(std::regex_match(s, m, re));
         assert(m.size() == 5);
diff --git a/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp b/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
index 6a45418..0b4c694 100644
--- a/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
+++ b/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp
@@ -25,9 +25,9 @@
 void
 test1()
 {
-    std::string re{"\\{a\\}"};
-    std::string target{"{a}"};
-    std::regex regex{re};
+    std::string re("\\{a\\}");
+    std::string target("{a}");
+    std::regex regex(re);
     std::smatch smatch;
     assert((std::regex_match(target, smatch, regex)));
 }
@@ -35,9 +35,9 @@
 void
 test2()
 {
-    std::string re{"\\{a\\}"};
-    std::string target{"{a}"};
-    std::regex regex{re, std::regex::extended};
+    std::string re("\\{a\\}");
+    std::string target("{a}");
+    std::regex regex(re, std::regex::extended);
     std::smatch smatch;
     assert((std::regex_match(target, smatch, regex)));
 }
@@ -45,9 +45,9 @@
 void
 test3()
 {
-    std::string re{"\\{a\\}"};
-    std::string target{"{a}"};
-    std::regex regex{re, std::regex::awk};
+    std::string re("\\{a\\}");
+    std::string target("{a}");
+    std::regex regex(re, std::regex::awk);
     std::smatch smatch;
     assert((std::regex_match(target, smatch, regex)));
 }
@@ -55,9 +55,9 @@
 void
 test4()
 {
-    std::string re{"\\{a\\}"};
-    std::string target{"{a}"};
-    std::regex regex{re, std::regex::egrep};
+    std::string re("\\{a\\}");
+    std::string target("{a}");
+    std::regex regex(re, std::regex::egrep);
     std::smatch smatch;
     assert((std::regex_match(target, smatch, regex)));
 }
diff --git a/test/re/re.alg/re.alg.search/awk.pass.cpp b/test/re/re.alg/re.alg.search/awk.pass.cpp
index 74c25c1..521e98b 100644
--- a/test/re/re.alg/re.alg.search/awk.pass.cpp
+++ b/test/re/re.alg/re.alg.search/awk.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.search/backup.pass.cpp b/test/re/re.alg/re.alg.search/backup.pass.cpp
index 6bfad42..7da5860 100644
--- a/test/re/re.alg/re.alg.search/backup.pass.cpp
+++ b/test/re/re.alg/re.alg.search/backup.pass.cpp
@@ -26,10 +26,10 @@
     // This regex_iterator uses regex_search(__wrap_iter<_Iter> __first, ...)
     // Test for http://llvm.org/bugs/show_bug.cgi?id=16240 fixed in r185273.
     {
-        std::string s{"aaaa a"};
-        std::regex re{"\\ba"};
-        std::sregex_iterator it{s.begin(), s.end(), re};
-        std::sregex_iterator end{};
+        std::string s("aaaa a");
+        std::regex re("\\ba");
+        std::sregex_iterator it(s.begin(), s.end(), re);
+        std::sregex_iterator end = std::sregex_iterator();
 
         assert(it->position(0) == 0);
         assert(it->length(0) == 1);
@@ -44,11 +44,11 @@
 
     // This regex_iterator uses regex_search(_BidirectionalIterator __first, ...)
     {
-        std::string s{"aaaa a"};
-        std::list<char> l{s.begin(), s.end()};
-        std::regex re{"\\ba"};
-        std::regex_iterator<std::list<char>::iterator> it{l.begin(), l.end(), re};
-        std::regex_iterator<std::list<char>::iterator> end{};
+        std::string s("aaaa a");
+        std::list<char> l(s.begin(), s.end());
+        std::regex re("\\ba");
+        std::regex_iterator<std::list<char>::iterator> it(l.begin(), l.end(), re);
+        std::regex_iterator<std::list<char>::iterator> end = std::regex_iterator<std::list<char>::iterator>();
 
         assert(it->position(0) == 0);
         assert(it->length(0) == 1);
diff --git a/test/re/re.alg/re.alg.search/basic.pass.cpp b/test/re/re.alg/re.alg.search/basic.pass.cpp
index c8a5051..838294e 100644
--- a/test/re/re.alg/re.alg.search/basic.pass.cpp
+++ b/test/re/re.alg/re.alg.search/basic.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.search/ecma.pass.cpp b/test/re/re.alg/re.alg.search/ecma.pass.cpp
index 965c29d..2796850 100644
--- a/test/re/re.alg/re.alg.search/ecma.pass.cpp
+++ b/test/re/re.alg/re.alg.search/ecma.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.search/extended.pass.cpp b/test/re/re.alg/re.alg.search/extended.pass.cpp
index c181cff..a8a121b 100644
--- a/test/re/re.alg/re.alg.search/extended.pass.cpp
+++ b/test/re/re.alg/re.alg.search/extended.pass.cpp
@@ -18,6 +18,9 @@
 //                  const basic_regex<charT, traits>& e,
 //                  regex_constants::match_flag_type flags = regex_constants::match_default);
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/re/re.alg/re.alg.search/no_update_pos.pass.cpp b/test/re/re.alg/re.alg.search/no_update_pos.pass.cpp
index 63fcdaf..ef9cec5 100644
--- a/test/re/re.alg/re.alg.search/no_update_pos.pass.cpp
+++ b/test/re/re.alg/re.alg.search/no_update_pos.pass.cpp
@@ -25,9 +25,9 @@
     // of the text.
 
     const char *text = "aaa\naa";
-    std::regex re{"^a"};
-    std::cregex_iterator it{text, text+6, re};
-    std::cregex_iterator end{};
+    std::regex re("^a");
+    std::cregex_iterator it(text, text+6, re);
+    std::cregex_iterator end = std::cregex_iterator();
 
     assert(it->str() == "a");
     assert(it->position(0) == 0);
diff --git a/test/re/re.regex/re.regex.construct/awk_oct.pass.cpp b/test/re/re.regex/re.regex.construct/awk_oct.pass.cpp
index 11fce3f..4b7e5e6 100644
--- a/test/re/re.regex/re.regex.construct/awk_oct.pass.cpp
+++ b/test/re/re.regex/re.regex.construct/awk_oct.pass.cpp
@@ -21,8 +21,8 @@
 {
     using std::regex_constants::awk;
 
-    assert(std::regex_match("\4", std::regex{"\\4", awk}));
-    assert(std::regex_match("\41", std::regex{"\\41", awk}));
-    assert(std::regex_match("\141", std::regex{"\\141", awk}));
-    assert(std::regex_match("\1411", std::regex{"\\1411", awk}));
+    assert(std::regex_match("\4", std::regex("\\4", awk)));
+    assert(std::regex_match("\41", std::regex("\\41", awk)));
+    assert(std::regex_match("\141", std::regex("\\141", awk)));
+    assert(std::regex_match("\1411", std::regex("\\1411", awk)));
 }
diff --git a/test/re/re.traits/lookup_collatename.pass.cpp b/test/re/re.traits/lookup_collatename.pass.cpp
index 049246e..d495f8a 100644
--- a/test/re/re.traits/lookup_collatename.pass.cpp
+++ b/test/re/re.traits/lookup_collatename.pass.cpp
@@ -17,6 +17,9 @@
 //   string_type
 //   lookup_collatename(ForwardIterator first, ForwardIterator last) const;
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <iterator>
 #include <cassert>
diff --git a/test/re/re.traits/translate_nocase.pass.cpp b/test/re/re.traits/translate_nocase.pass.cpp
index 5e042ae..0692e00 100644
--- a/test/re/re.traits/translate_nocase.pass.cpp
+++ b/test/re/re.traits/translate_nocase.pass.cpp
@@ -14,9 +14,14 @@
 
 // charT translate_nocase(charT c) const;
 
+// REQUIRES: locale.en_US.UTF-8
+
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
 
+// TODO: investigation needed
+// XFAIL: linux-gnu
+
 #include <regex>
 #include <cassert>
 
diff --git a/test/strings/basic.string/string.capacity/max_size.pass.cpp b/test/strings/basic.string/string.capacity/max_size.pass.cpp
index e6a3aa4..f426425 100644
--- a/test/strings/basic.string/string.capacity/max_size.pass.cpp
+++ b/test/strings/basic.string/string.capacity/max_size.pass.cpp
@@ -11,6 +11,13 @@
 
 // size_type max_size() const;
 
+// NOTE: asan and msan will fail for one of two reasons
+// 1. If allocator_may_return_null=0 then they will fail because the allocation
+//    returns null.
+// 2. If allocator_may_return_null=1 then they will fail because the allocation
+//    is too large to succeed.
+// UNSUPPORTED: asan, msan
+
 #include <string>
 #include <cassert>
 
@@ -40,23 +47,11 @@
 
 template <class S>
 void
-test3(const S& s)
-{
-    S s2(s);
-    const size_t sz = s2.max_size() + 1;
-    try { s2.resize(sz, 'x'); }
-    catch ( const std::length_error & ) { return ; }
-    assert ( false );
-}
-
-template <class S>
-void
 test(const S& s)
 {
     assert(s.max_size() >= s.size());
     test1(s);
     test2(s);
-    test3(s);
 }
 
 int main()
diff --git a/test/strings/basic.string/string.capacity/over_max_size.pass.cpp b/test/strings/basic.string/string.capacity/over_max_size.pass.cpp
new file mode 100644
index 0000000..bbadb9c
--- /dev/null
+++ b/test/strings/basic.string/string.capacity/over_max_size.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// size_type max_size() const;
+
+#include <string>
+#include <cassert>
+
+#include "min_allocator.h"
+
+template <class S>
+void
+test(const S& s)
+{
+    assert(s.max_size() >= s.size());
+    S s2(s);
+    const size_t sz = s2.max_size() + 1;
+    try { s2.resize(sz, 'x'); }
+    catch ( const std::length_error & ) { return ; }
+    assert ( false );
+}
+
+int main()
+{
+    {
+    typedef std::string S;
+    test(S());
+    test(S("123"));
+    test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#if __cplusplus >= 201103L
+    {
+    typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
+    test(S());
+    test(S("123"));
+    test(S("12345678901234567890123456789012345678901234567890"));
+    }
+#endif
+}
diff --git a/test/strings/c.strings/cuchar.pass.cpp b/test/strings/c.strings/cuchar.pass.cpp
index d4c15db..022c656 100644
--- a/test/strings/c.strings/cuchar.pass.cpp
+++ b/test/strings/c.strings/cuchar.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// XFAIL: apple-darwin
+// XFAIL: *
 
 // <cuchar>
 
diff --git a/test/strings/c.strings/version_cuchar.pass.cpp b/test/strings/c.strings/version_cuchar.pass.cpp
index fa47f0f..dcfdcc3 100644
--- a/test/strings/c.strings/version_cuchar.pass.cpp
+++ b/test/strings/c.strings/version_cuchar.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// XFAIL: apple-darwin
+// XFAIL: *
 
 // <cuchar>
 
diff --git a/test/support/asan_testing.h b/test/support/asan_testing.h
index c8797bd..45ad04b 100644
--- a/test/support/asan_testing.h
+++ b/test/support/asan_testing.h
@@ -19,7 +19,7 @@
 template <typename T, typename Alloc>
 bool is_contiguous_container_asan_correct ( const std::vector<T, Alloc> &c )
 {
-    if ( std::is_same<Alloc, std::allocator<T>>::value && c.data() != NULL)
+    if ( std::is_same<Alloc, std::allocator<T> >::value && c.data() != NULL)
         return __sanitizer_verify_contiguous_container (
             c.data(), c.data() + c.size(), c.data() + c.capacity()) != 0;
     return true;
@@ -34,4 +34,4 @@
 #endif
  
 
-#endif  // ASAN_TESTING_H
\ No newline at end of file
+#endif  // ASAN_TESTING_H
diff --git a/test/support/cmpxchg_loop.h b/test/support/cmpxchg_loop.h
new file mode 100644
index 0000000..c39e3fb
--- /dev/null
+++ b/test/support/cmpxchg_loop.h
@@ -0,0 +1,51 @@
+#include <atomic>
+
+template <class A, class T>
+bool cmpxchg_weak_loop(A& atomic, T& expected, T desired) {
+  for (int i = 0; i < 10; i++) {
+    if (atomic.compare_exchange_weak(expected, desired) == true) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+template <class A, class T>
+bool cmpxchg_weak_loop(A& atomic, T& expected, T desired,
+                       std::memory_order success,
+                       std::memory_order failure) {
+  for (int i = 0; i < 10; i++) {
+    if (atomic.compare_exchange_weak(expected, desired, success,
+                                     failure) == true) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+template <class A, class T>
+bool c_cmpxchg_weak_loop(A* atomic, T* expected, T desired) {
+  for (int i = 0; i < 10; i++) {
+    if (std::atomic_compare_exchange_weak(atomic, expected, desired) == true) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+template <class A, class T>
+bool c_cmpxchg_weak_loop(A* atomic, T* expected, T desired,
+                         std::memory_order success,
+                         std::memory_order failure) {
+  for (int i = 0; i < 10; i++) {
+    if (std::atomic_compare_exchange_weak_explicit(atomic, expected, desired,
+                                                   success, failure) == true) {
+      return true;
+    }
+  }
+
+  return false;
+}
diff --git a/test/support/counting_predicates.hpp b/test/support/counting_predicates.hpp
index e825848..aab6a97 100644
--- a/test/support/counting_predicates.hpp
+++ b/test/support/counting_predicates.hpp
@@ -14,33 +14,33 @@
 template <typename Predicate, typename Arg>
 struct unary_counting_predicate : public std::unary_function<Arg, bool>  {
 public:
-	unary_counting_predicate(Predicate p) : p_(p), count_(0) {}
-	~unary_counting_predicate() {}
-	
-	bool operator () (const Arg &a) const { ++count_; return p_(a); }
-	size_t count() const { return count_; }
-	void reset() { count_ = 0; }
-	
+    unary_counting_predicate(Predicate p) : p_(p), count_(0) {}
+    ~unary_counting_predicate() {}
+    
+    bool operator () (const Arg &a) const { ++count_; return p_(a); }
+    size_t count() const { return count_; }
+    void reset() { count_ = 0; }
+    
 private:
-	Predicate p_;
-	mutable size_t count_;
-	};
+    Predicate p_;
+    mutable size_t count_;
+    };
 
 
 template <typename Predicate, typename Arg1, typename Arg2=Arg1>
 struct binary_counting_predicate : public std::binary_function<Arg1, Arg2, bool> {
 public:
 
-	binary_counting_predicate ( Predicate p ) : p_(p), count_(0) {}
-	~binary_counting_predicate() {}
-	
-	bool operator () (const Arg1 &a1, const Arg2 &a2) const { ++count_; return p_(a1, a2); }
-	size_t count() const { return count_; }
-	void reset() { count_ = 0; }
+    binary_counting_predicate ( Predicate p ) : p_(p), count_(0) {}
+    ~binary_counting_predicate() {}
+    
+    bool operator () (const Arg1 &a1, const Arg2 &a2) const { ++count_; return p_(a1, a2); }
+    size_t count() const { return count_; }
+    void reset() { count_ = 0; }
 
 private:
-	Predicate p_;
-	mutable size_t count_;
-	};
+    Predicate p_;
+    mutable size_t count_;
+    };
 
 #endif // __COUNTING_PREDICATES_H
diff --git a/test/support/min_allocator.h b/test/support/min_allocator.h
index f3f08ca..b643636 100644
--- a/test/support/min_allocator.h
+++ b/test/support/min_allocator.h
@@ -10,6 +10,34 @@
 #ifndef MIN_ALLOCATOR_H
 #define MIN_ALLOCATOR_H
 
+#include <cstddef>
+
+template <class T>
+class bare_allocator
+{
+public:
+    typedef T value_type;
+
+    bare_allocator() {}
+
+    template <class U>
+    bare_allocator(bare_allocator<U>) {}
+
+    T* allocate(std::size_t n)
+    {
+        return static_cast<T*>(::operator new(n*sizeof(T)));
+    }
+
+    void deallocate(T* p, std::size_t)
+    {
+        return ::operator delete(static_cast<void*>(p));
+    }
+
+    friend bool operator==(bare_allocator, bare_allocator) {return true;}
+    friend bool operator!=(bare_allocator x, bare_allocator y) {return !(x == y);}
+};
+
+
 #if __cplusplus >= 201103L
 
 #include <memory>
@@ -71,7 +99,7 @@
     explicit min_pointer(min_pointer<void> p) : ptr_(static_cast<T*>(p.ptr_)) {}
 
     explicit operator bool() const {return ptr_ != nullptr;}
-    
+
     typedef std::ptrdiff_t difference_type;
     typedef T& reference;
     typedef T* pointer;
diff --git a/test/support/platform_support.h b/test/support/platform_support.h
index 9ae2ae7..09bb29a 100644
--- a/test/support/platform_support.h
+++ b/test/support/platform_support.h
@@ -44,19 +44,31 @@
 #include <string>
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include <io.h> // _mktemp
+#else
+#include <unistd.h> // close
 #endif
 
 inline
 std::string
 get_temp_file_name()
 {
-   std::string s("temp.XXXXXX");
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-   _mktemp(&s[0]);
+    char Path[MAX_PATH+1];
+    char FN[MAX_PATH+1];
+    do { } while (0 == GetTempPath(MAX_PATH+1, Path));
+    do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN));
+    return FN;
 #else
-   mktemp(&s[0]);
+    std::string Name;
+    int FD = -1;
+    do {
+      Name = "libcxx.XXXXXX";
+      FD = mkstemp(&Name[0]);
+      assert(errno != EINVAL && "Something is wrong with the mkstemp's argument");
+    } while (FD == -1 || errno == EEXIST);
+    close(FD);
+    return Name;
 #endif
-   return s;
 }
 
 #endif // PLATFORM_SUPPORT_H
diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h
index 5bd6df7..e09fd83 100644
--- a/test/support/test_iterators.h
+++ b/test/support/test_iterators.h
@@ -11,6 +11,13 @@
 #define ITERATORS_H
 
 #include <iterator>
+#include <cassert>
+
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
 
 template <class It>
 class output_iterator
@@ -37,6 +44,9 @@
     output_iterator& operator++() {++it_; return *this;}
     output_iterator operator++(int)
         {output_iterator tmp(*this); ++(*this); return tmp;}
+
+    template <class T>
+    void operator,(T const &) DELETE_FUNCTION;
 };
 
 template <class It>
@@ -70,6 +80,9 @@
         {return x.it_ == y.it_;}
     friend bool operator!=(const input_iterator& x, const input_iterator& y)
         {return !(x == y);}
+
+    template <class T>
+    void operator,(T const &) DELETE_FUNCTION;
 };
 
 template <class T, class U>
@@ -119,6 +132,9 @@
         {return x.it_ == y.it_;}
     friend bool operator!=(const forward_iterator& x, const forward_iterator& y)
         {return !(x == y);}
+
+    template <class T>
+    void operator,(T const &) DELETE_FUNCTION;
 };
 
 template <class T, class U>
@@ -167,6 +183,9 @@
     bidirectional_iterator& operator--() {--it_; return *this;}
     bidirectional_iterator operator--(int)
         {bidirectional_iterator tmp(*this); --(*this); return tmp;}
+
+    template <class T>
+    void operator,(T const &) DELETE_FUNCTION;
 };
 
 template <class T, class U>
@@ -226,6 +245,9 @@
         {random_access_iterator tmp(*this); tmp -= n; return tmp;}
 
     reference operator[](difference_type n) const {return it_[n];}
+
+    template <class T>
+    void operator,(T const &) DELETE_FUNCTION;
 };
 
 template <class T, class U>
@@ -302,4 +324,6 @@
 template <class Iter>    // everything else
 inline Iter base(Iter i) { return i; }
 
+#undef DELETE_FUNCTION
+
 #endif  // ITERATORS_H
diff --git a/test/thread/futures/futures.async/async.pass.cpp b/test/thread/futures/futures.async/async.pass.cpp
index f67abe4..c8a7425 100644
--- a/test/thread/futures/futures.async/async.pass.cpp
+++ b/test/thread/futures/futures.async/async.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/default_error_condition.pass.cpp b/test/thread/futures/futures.errors/default_error_condition.pass.cpp
index 35afe5a..7f28b8a 100644
--- a/test/thread/futures/futures.errors/default_error_condition.pass.cpp
+++ b/test/thread/futures/futures.errors/default_error_condition.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp b/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp
index 1f1cf40..cd00176 100644
--- a/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp
+++ b/test/thread/futures/futures.errors/equivalent_error_code_int.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp b/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp
index 06fdce1..05ad1ec 100644
--- a/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp
+++ b/test/thread/futures/futures.errors/equivalent_int_error_condition.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/future_category.pass.cpp b/test/thread/futures/futures.errors/future_category.pass.cpp
index 515946c..7f407a0 100644
--- a/test/thread/futures/futures.errors/future_category.pass.cpp
+++ b/test/thread/futures/futures.errors/future_category.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/make_error_code.pass.cpp b/test/thread/futures/futures.errors/make_error_code.pass.cpp
index f904c46..3c14add 100644
--- a/test/thread/futures/futures.errors/make_error_code.pass.cpp
+++ b/test/thread/futures/futures.errors/make_error_code.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.errors/make_error_condition.pass.cpp b/test/thread/futures/futures.errors/make_error_condition.pass.cpp
index fd0f1c5..52972aa 100644
--- a/test/thread/futures/futures.errors/make_error_condition.pass.cpp
+++ b/test/thread/futures/futures.errors/make_error_condition.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.future_error/code.pass.cpp b/test/thread/futures/futures.future_error/code.pass.cpp
index fdbfa4e..e02af48 100644
--- a/test/thread/futures/futures.future_error/code.pass.cpp
+++ b/test/thread/futures/futures.future_error/code.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.future_error/types.pass.cpp b/test/thread/futures/futures.future_error/types.pass.cpp
index af8e219..e741dd0 100644
--- a/test/thread/futures/futures.future_error/types.pass.cpp
+++ b/test/thread/futures/futures.future_error/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.future_error/what.pass.cpp b/test/thread/futures/futures.future_error/what.pass.cpp
index 5e54350..1a66e4a 100644
--- a/test/thread/futures/futures.future_error/what.pass.cpp
+++ b/test/thread/futures/futures.future_error/what.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // LWG 2056 changed the values of future_errc, so if we're using new headers
 // with an old library we'll get incorrect messages.
diff --git a/test/thread/futures/futures.overview/future_errc.pass.cpp b/test/thread/futures/futures.overview/future_errc.pass.cpp
index 7b3b70a..1e6fcb7 100644
--- a/test/thread/futures/futures.overview/future_errc.pass.cpp
+++ b/test/thread/futures/futures.overview/future_errc.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.overview/future_status.pass.cpp b/test/thread/futures/futures.overview/future_status.pass.cpp
index 0b6d32c..2c196aa 100644
--- a/test/thread/futures/futures.overview/future_status.pass.cpp
+++ b/test/thread/futures/futures.overview/future_status.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp b/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
index 85b7993..499de52 100644
--- a/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
+++ b/test/thread/futures/futures.overview/is_error_code_enum_future_errc.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.overview/launch.pass.cpp b/test/thread/futures/futures.overview/launch.pass.cpp
index 5f4663c..da54f7e 100644
--- a/test/thread/futures/futures.overview/launch.pass.cpp
+++ b/test/thread/futures/futures.overview/launch.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/alloc_ctor.pass.cpp b/test/thread/futures/futures.promise/alloc_ctor.pass.cpp
index dca399f..70a4e00 100644
--- a/test/thread/futures/futures.promise/alloc_ctor.pass.cpp
+++ b/test/thread/futures/futures.promise/alloc_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
@@ -18,6 +20,7 @@
 #include <cassert>
 
 #include "../test_allocator.h"
+#include "min_allocator.h"
 
 int main()
 {
@@ -46,4 +49,36 @@
         assert(f.valid());
     }
     assert(test_alloc_base::count == 0);
+    // Test with a minimal allocator
+    {
+        std::promise<int> p(std::allocator_arg, bare_allocator<void>());
+        std::future<int> f = p.get_future();
+        assert(f.valid());
+    }
+    {
+        std::promise<int&> p(std::allocator_arg, bare_allocator<void>());
+        std::future<int&> f = p.get_future();
+        assert(f.valid());
+    }
+    {
+        std::promise<void> p(std::allocator_arg, bare_allocator<void>());
+        std::future<void> f = p.get_future();
+        assert(f.valid());
+    }
+    // Test with a minimal allocator that returns class-type pointers
+    {
+        std::promise<int> p(std::allocator_arg, min_allocator<void>());
+        std::future<int> f = p.get_future();
+        assert(f.valid());
+    }
+    {
+        std::promise<int&> p(std::allocator_arg, min_allocator<void>());
+        std::future<int&> f = p.get_future();
+        assert(f.valid());
+    }
+    {
+        std::promise<void> p(std::allocator_arg, min_allocator<void>());
+        std::future<void> f = p.get_future();
+        assert(f.valid());
+    }
 }
diff --git a/test/thread/futures/futures.promise/default.pass.cpp b/test/thread/futures/futures.promise/default.pass.cpp
index 47aec02..95c9657 100644
--- a/test/thread/futures/futures.promise/default.pass.cpp
+++ b/test/thread/futures/futures.promise/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/dtor.pass.cpp b/test/thread/futures/futures.promise/dtor.pass.cpp
index cd4fafb..78912f1 100644
--- a/test/thread/futures/futures.promise/dtor.pass.cpp
+++ b/test/thread/futures/futures.promise/dtor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/get_future.pass.cpp b/test/thread/futures/futures.promise/get_future.pass.cpp
index e7e78c7..a7d084e 100644
--- a/test/thread/futures/futures.promise/get_future.pass.cpp
+++ b/test/thread/futures/futures.promise/get_future.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/move_assign.pass.cpp b/test/thread/futures/futures.promise/move_assign.pass.cpp
index c378495..c3097df 100644
--- a/test/thread/futures/futures.promise/move_assign.pass.cpp
+++ b/test/thread/futures/futures.promise/move_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/move_ctor.pass.cpp b/test/thread/futures/futures.promise/move_ctor.pass.cpp
index 4bd013a..eeec4fb 100644
--- a/test/thread/futures/futures.promise/move_ctor.pass.cpp
+++ b/test/thread/futures/futures.promise/move_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_exception.pass.cpp b/test/thread/futures/futures.promise/set_exception.pass.cpp
index 13c9aa9..51c05eb 100644
--- a/test/thread/futures/futures.promise/set_exception.pass.cpp
+++ b/test/thread/futures/futures.promise/set_exception.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
index 7f9e418..5e57692 100644
--- a/test/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
+++ b/test/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_lvalue.pass.cpp b/test/thread/futures/futures.promise/set_lvalue.pass.cpp
index 4ee5fbb..cdc3777 100644
--- a/test/thread/futures/futures.promise/set_lvalue.pass.cpp
+++ b/test/thread/futures/futures.promise/set_lvalue.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp b/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
index eef353a..18f87c5 100644
--- a/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
+++ b/test/thread/futures/futures.promise/set_lvalue_at_thread_exit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_rvalue.pass.cpp b/test/thread/futures/futures.promise/set_rvalue.pass.cpp
index 3cbacea..dab4bf7 100644
--- a/test/thread/futures/futures.promise/set_rvalue.pass.cpp
+++ b/test/thread/futures/futures.promise/set_rvalue.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp b/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp
index 1e3108c..8f3b768 100644
--- a/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp
+++ b/test/thread/futures/futures.promise/set_rvalue_at_thread_exit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp b/test/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
index bf8f21b..ec50cc3 100644
--- a/test/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
+++ b/test/thread/futures/futures.promise/set_value_at_thread_exit_const.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp b/test/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
index ee6f62f..8c09208 100644
--- a/test/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
+++ b/test/thread/futures/futures.promise/set_value_at_thread_exit_void.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_value_const.pass.cpp b/test/thread/futures/futures.promise/set_value_const.pass.cpp
index 94a9f92..6673f63 100644
--- a/test/thread/futures/futures.promise/set_value_const.pass.cpp
+++ b/test/thread/futures/futures.promise/set_value_const.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/set_value_void.pass.cpp b/test/thread/futures/futures.promise/set_value_void.pass.cpp
index c3b7e78..5012e0b 100644
--- a/test/thread/futures/futures.promise/set_value_void.pass.cpp
+++ b/test/thread/futures/futures.promise/set_value_void.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/swap.pass.cpp b/test/thread/futures/futures.promise/swap.pass.cpp
index 5e292b0..1ed3e64 100644
--- a/test/thread/futures/futures.promise/swap.pass.cpp
+++ b/test/thread/futures/futures.promise/swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.promise/uses_allocator.pass.cpp b/test/thread/futures/futures.promise/uses_allocator.pass.cpp
index 1f30682..458826e 100644
--- a/test/thread/futures/futures.promise/uses_allocator.pass.cpp
+++ b/test/thread/futures/futures.promise/uses_allocator.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/copy_assign.pass.cpp b/test/thread/futures/futures.shared_future/copy_assign.pass.cpp
index e6b86d1..b23ba19 100644
--- a/test/thread/futures/futures.shared_future/copy_assign.pass.cpp
+++ b/test/thread/futures/futures.shared_future/copy_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/copy_ctor.pass.cpp b/test/thread/futures/futures.shared_future/copy_ctor.pass.cpp
index 445c189..425d1f9 100644
--- a/test/thread/futures/futures.shared_future/copy_ctor.pass.cpp
+++ b/test/thread/futures/futures.shared_future/copy_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/ctor_future.pass.cpp b/test/thread/futures/futures.shared_future/ctor_future.pass.cpp
index 207473e..3a78b80 100644
--- a/test/thread/futures/futures.shared_future/ctor_future.pass.cpp
+++ b/test/thread/futures/futures.shared_future/ctor_future.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/default.pass.cpp b/test/thread/futures/futures.shared_future/default.pass.cpp
index dc056e8..92927f5 100644
--- a/test/thread/futures/futures.shared_future/default.pass.cpp
+++ b/test/thread/futures/futures.shared_future/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/dtor.pass.cpp b/test/thread/futures/futures.shared_future/dtor.pass.cpp
index a06a313..baa89cb 100644
--- a/test/thread/futures/futures.shared_future/dtor.pass.cpp
+++ b/test/thread/futures/futures.shared_future/dtor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/get.pass.cpp b/test/thread/futures/futures.shared_future/get.pass.cpp
index 16723ea..c5ee234 100644
--- a/test/thread/futures/futures.shared_future/get.pass.cpp
+++ b/test/thread/futures/futures.shared_future/get.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/move_assign.pass.cpp b/test/thread/futures/futures.shared_future/move_assign.pass.cpp
index 36e0168..6b58f41 100644
--- a/test/thread/futures/futures.shared_future/move_assign.pass.cpp
+++ b/test/thread/futures/futures.shared_future/move_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/move_ctor.pass.cpp b/test/thread/futures/futures.shared_future/move_ctor.pass.cpp
index 35b8221..32b8fd7 100644
--- a/test/thread/futures/futures.shared_future/move_ctor.pass.cpp
+++ b/test/thread/futures/futures.shared_future/move_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/wait.pass.cpp b/test/thread/futures/futures.shared_future/wait.pass.cpp
index b14d703..4293fca 100644
--- a/test/thread/futures/futures.shared_future/wait.pass.cpp
+++ b/test/thread/futures/futures.shared_future/wait.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/wait_for.pass.cpp b/test/thread/futures/futures.shared_future/wait_for.pass.cpp
index ae678ff..e5a4754 100644
--- a/test/thread/futures/futures.shared_future/wait_for.pass.cpp
+++ b/test/thread/futures/futures.shared_future/wait_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.shared_future/wait_until.pass.cpp b/test/thread/futures/futures.shared_future/wait_until.pass.cpp
index 1a0c9b3..258f9bf 100644
--- a/test/thread/futures/futures.shared_future/wait_until.pass.cpp
+++ b/test/thread/futures/futures.shared_future/wait_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
index a0f711a..18786f4 100644
--- a/test/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/assign_move.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
index f53b26e..7690496 100644
--- a/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/ctor_default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
index 58e9982..2eee2cb 100644
--- a/test/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/ctor_func.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
index e7070c5..3aac2b2 100644
--- a/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/ctor_func_alloc.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
@@ -18,6 +20,7 @@
 #include <cassert>
 
 #include "../../test_allocator.h"
+#include "min_allocator.h"
 
 class A
 {
@@ -92,4 +95,30 @@
         assert(f.get() == 4);
     }
     assert(test_alloc_base::count == 0);
+    A::n_copies = 0;
+    A::n_moves  = 0;
+    {
+        std::packaged_task<double(int, char)> p(std::allocator_arg,
+                                                bare_allocator<void>(), A(5));
+        assert(p.valid());
+        std::future<double> f = p.get_future();
+        p(3, 'a');
+        assert(f.get() == 105.0);
+        assert(A::n_copies == 0);
+        assert(A::n_moves > 0);
+    }
+    A::n_copies = 0;
+    A::n_moves  = 0;
+    {
+        std::packaged_task<double(int, char)> p(std::allocator_arg,
+                                                min_allocator<void>(), A(5));
+        assert(p.valid());
+        std::future<double> f = p.get_future();
+        p(3, 'a');
+        assert(f.get() == 105.0);
+        assert(A::n_copies == 0);
+        assert(A::n_moves > 0);
+    }
+    A::n_copies = 0;
+    A::n_moves  = 0;
 }
diff --git a/test/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
index c668a67..88f0722 100644
--- a/test/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/ctor_move.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
index 9b76934..e24232d 100644
--- a/test/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/dtor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
index d6efbf1..13b5db1 100644
--- a/test/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/get_future.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
index accbd75..61a6a4f 100644
--- a/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/make_ready_at_thread_exit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/operator.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
index b77cf31..2a09353 100644
--- a/test/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/operator.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/reset.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
index 3ca3d14..9d38d9b 100644
--- a/test/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/reset.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.members/swap.pass.cpp b/test/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
index 9f549aa..33763be 100644
--- a/test/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.members/swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp b/test/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
index ef99f61..668732b 100644
--- a/test/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.nonmembers/swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp b/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
index 130390f..986f71e 100644
--- a/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
+++ b/test/thread/futures/futures.tas/futures.task.nonmembers/uses_allocator.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.tas/types.pass.cpp b/test/thread/futures/futures.tas/types.pass.cpp
index c66f359..dd1724d 100644
--- a/test/thread/futures/futures.tas/types.pass.cpp
+++ b/test/thread/futures/futures.tas/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/default.pass.cpp b/test/thread/futures/futures.unique_future/default.pass.cpp
index 915f118..84cb846 100644
--- a/test/thread/futures/futures.unique_future/default.pass.cpp
+++ b/test/thread/futures/futures.unique_future/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/dtor.pass.cpp b/test/thread/futures/futures.unique_future/dtor.pass.cpp
index 1bc141b..5e9697b 100644
--- a/test/thread/futures/futures.unique_future/dtor.pass.cpp
+++ b/test/thread/futures/futures.unique_future/dtor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/get.pass.cpp b/test/thread/futures/futures.unique_future/get.pass.cpp
index 1b0ee2b..758e38a 100644
--- a/test/thread/futures/futures.unique_future/get.pass.cpp
+++ b/test/thread/futures/futures.unique_future/get.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/move_assign.pass.cpp b/test/thread/futures/futures.unique_future/move_assign.pass.cpp
index 79dcd7d..8d38b81 100644
--- a/test/thread/futures/futures.unique_future/move_assign.pass.cpp
+++ b/test/thread/futures/futures.unique_future/move_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/move_ctor.pass.cpp b/test/thread/futures/futures.unique_future/move_ctor.pass.cpp
index af23e4d..e12c920 100644
--- a/test/thread/futures/futures.unique_future/move_ctor.pass.cpp
+++ b/test/thread/futures/futures.unique_future/move_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/share.pass.cpp b/test/thread/futures/futures.unique_future/share.pass.cpp
index a19ce2e..794b5ce 100644
--- a/test/thread/futures/futures.unique_future/share.pass.cpp
+++ b/test/thread/futures/futures.unique_future/share.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/wait.pass.cpp b/test/thread/futures/futures.unique_future/wait.pass.cpp
index 68c0d14..e10d37c 100644
--- a/test/thread/futures/futures.unique_future/wait.pass.cpp
+++ b/test/thread/futures/futures.unique_future/wait.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/wait_for.pass.cpp b/test/thread/futures/futures.unique_future/wait_for.pass.cpp
index 2a81a2c..0a381d9 100644
--- a/test/thread/futures/futures.unique_future/wait_for.pass.cpp
+++ b/test/thread/futures/futures.unique_future/wait_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/futures.unique_future/wait_until.pass.cpp b/test/thread/futures/futures.unique_future/wait_until.pass.cpp
index 8ac0bc8..70d7e57 100644
--- a/test/thread/futures/futures.unique_future/wait_until.pass.cpp
+++ b/test/thread/futures/futures.unique_future/wait_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/futures/version.pass.cpp b/test/thread/futures/version.pass.cpp
index 5ac4e0f..6730a14 100644
--- a/test/thread/futures/version.pass.cpp
+++ b/test/thread/futures/version.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <future>
 
diff --git a/test/thread/macro.pass.cpp b/test/thread/macro.pass.cpp
index 243640d..c1b1377 100644
--- a/test/thread/macro.pass.cpp
+++ b/test/thread/macro.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.condition/cv_status.pass.cpp b/test/thread/thread.condition/cv_status.pass.cpp
index d5e0947..fe5fa05 100644
--- a/test/thread/thread.condition/cv_status.pass.cpp
+++ b/test/thread/thread.condition/cv_status.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp b/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
index e4f193a..2b8772f 100644
--- a/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
+++ b/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp
index a912413..6f43564 100644
--- a/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp
index 9828fbb..437ed96 100644
--- a/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
index 52b73c0..bf28e01 100644
--- a/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp
index 0b50e26..fd80ee9 100644
--- a/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
index c112585..6236a13 100644
--- a/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp
index c4afc53..236eecc 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
index 038c946..ca48eee 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
index ef7a9b6..0ee40d1 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp
index 22b82d2..45e0b81 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp
index 476cec5..d87a188 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp
index b7a4b3a..90ffb1d 100644
--- a/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp
index 853fc1a..210060a 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp
index a14c568..6bdca7b 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp
index 389d4bc..27ead95 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
index 8ad0ca3..98f6c43 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp
index dd4879d..522c61b 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait.exception.pass.cpp
@@ -1,3 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
 #include <thread>
 #include <condition_variable>
 #include <mutex>
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp
index b611167..f5c8926 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp
index 7eb4b33..1906b58 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_for.exception.pass.cpp
@@ -1,3 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
 #include <thread>
 #include <condition_variable>
 #include <mutex>
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp
index 89759ac..a4b4ed9 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
index bc4b7c3..b240307 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp
index 9b4fab3..921ad69 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp
index 15bf809..1994ebd 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp
index 1490e11..c0fea03 100644
--- a/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.condition/version.pass.cpp b/test/thread/thread.condition/version.pass.cpp
index 517c93b..12a775e 100644
--- a/test/thread/thread.condition/version.pass.cpp
+++ b/test/thread/thread.condition/version.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <condition_variable>
 
diff --git a/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
index 14c79a1..f67ca21 100644
--- a/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
index bdb76c6..f0c54b7 100644
--- a/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
index 6f68884..8327100 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
index d47222d..a15405f 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp
index 20aa62e..5238ed6 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
index 2713680..2c1c665 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
index 73936b7..8676f2c 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
index cf63861..f59d2e8 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/move_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
index 01bfbfd..c8a0287 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
index b4f6025..9082e57 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_adopt_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
index 3a8b61a..bbc38fc 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_defer_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
index ffe329c..9816e57 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
index baf08de..5d188ab 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
index 9d06d3f..f2d4e0d 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_try_to_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
index ecac479..f150065 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
index d65fbfa..82b1ff8 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
index d076e52..5867465 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
index 8efffc4..9d38983 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
index 9e4b3c8..eb08a45 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/unlock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
index 6a7a39e..8505763 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/member_swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
index 03bf5e8..057dbc4 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/nonmember_swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
index a836b35..65ddca6 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.mod/release.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
index 4b4f6c6..4eb75d8 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/mutex.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
index 177a69e..d079d2d 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/op_bool.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
index a10c588..d64b0aa 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.obs/owns_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
index 3537357..c153b45 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.shared/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp
index 55038c7..a49bc50 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
index 2eb1c3a..4dff853 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
index f36600c..aa640ee 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
index 4b08aca..1f7217a 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
index ff8043b..9c3a7b6 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
index f475ec1..bf62231 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
index 8370c56..33e400b 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
index 8faf88f..2ead670 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
index b6c64f5..cea58c5 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
index c101d89..f5408df 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
index 40d9489..bd88577 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
index 3e7d13a..558f079 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
index 2b435e0..24e4d10 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
index 1318c86..bbabfc4 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp
index fd3931a..598d53a 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp
index d74247e..3fc8c28 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp
index 4252de1..89c28e6 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp
index 78b0c6a..bc1e3e5 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
index 0d2e362..7004ac0 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp
index 2e2db5d..f53af35 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp
index aba22a7..f8bcb6d 100644
--- a/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.lock/types.pass.cpp b/test/thread/thread.mutex/thread.lock/types.pass.cpp
index 8a34bcb..64df068 100644
--- a/test/thread/thread.mutex/thread.lock/types.pass.cpp
+++ b/test/thread/thread.mutex/thread.lock/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp
index 704d716..4de42fb 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp
index 8fde818..ba2d54d 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
index 59c762a..12c80f0 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp
index 6ef0160..fe8f351 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp
index bc775ed..8c5d266 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp
index cd48151..abebe90 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
index fb95294..10626bc 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp
index f63e0ef..ff546d4 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
index f45382d..a90b6c9 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
index 153ce62..b4f9ba3 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
index 724a7b0..ac5e206 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
index aa6f5fb..33b0696 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
index e97b313..98cd8f9 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
index a34633e..a006e17 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
index 528c69a..b2cc15e 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
index a6238e3..d1b1121 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
index 8670fbf..5a8e624 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <shared_mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
index 5956540..33320a7 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp
index a4b41ac..fe2dd82 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp
index d5a06bf..b32a266 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp
index 5e4d5f1..46222a7 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp
index f19dec2..6c9c442 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
index a4c5110..56e1874 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp
index 32bedb3..91f747b 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp
index d56e8bc..63c3cfe 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp
index 972fc63..3c1d6dd 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp
index e5e9166..066eb7b 100644
--- a/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
diff --git a/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
index b4f76b4..5395c85 100644
--- a/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
+++ b/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <mutex>
 
@@ -133,7 +135,15 @@
 
 class MoveOnly
 {
+#if !defined(__clang__)
+   // GCC 4.8 complains about the following being private
+public:
+    MoveOnly(const MoveOnly&)
+    {
+    }
+#else
     MoveOnly(const MoveOnly&);
+#endif
 public:
     MoveOnly() {}
     MoveOnly(MoveOnly&&) {}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
index 9a7f8dc..476ca0c 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
index 1a5f320..94a30e7 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
@@ -14,8 +16,6 @@
 // thread& operator=(thread&& t);
 
 #include <thread>
-#include <new>
-#include <cstdlib>
 #include <cassert>
 
 class G
@@ -29,13 +29,6 @@
     G(const G& g) : alive_(g.alive_) {++n_alive;}
     ~G() {alive_ = 0; --n_alive;}
 
-    void operator()()
-    {
-        assert(alive_ == 1);
-        assert(n_alive >= 1);
-        op_run = true;
-    }
-
     void operator()(int i, double j)
     {
         assert(alive_ == 1);
@@ -49,15 +42,9 @@
 int G::n_alive = 0;
 bool G::op_run = false;
 
-void f1()
-{
-    std::exit(0);
-}
-
 int main()
 {
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-    std::set_terminate(f1);
     {
         assert(G::n_alive == 0);
         assert(!G::op_run);
@@ -71,12 +58,5 @@
         assert(G::n_alive == 0);
         assert(G::op_run);
     }
-    {
-        std::thread t0(G(), 5, 5.5);
-        std::thread::id id = t0.get_id();
-        std::thread t1;
-        t0 = std::move(t1);
-        assert(false);
-    }
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 }
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
new file mode 100644
index 0000000..8cb2cb1
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move2.pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// NOTE: std::terminate is called so the destructors are not invoked and the
+// memory is not freed. This will cause ASAN to fail.
+// XFAIL: asan
+
+// <thread>
+
+// class thread
+
+// thread& operator=(thread&& t);
+
+#include <thread>
+#include <exception>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive >= 1);
+        op_run = true;
+    }
+
+    void operator()(int i, double j)
+    {
+        assert(alive_ == 1);
+        assert(n_alive >= 1);
+        assert(i == 5);
+        assert(j == 5.5);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+void f1()
+{
+    std::exit(0);
+}
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    std::set_terminate(f1);
+    {
+        std::thread t0(G(), 5, 5.5);
+        std::thread::id id = t0.get_id();
+        std::thread t1;
+        t0 = std::move(t1);
+        assert(false);
+    }
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
index e5568ba..0f5d5aa 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
@@ -13,6 +15,8 @@
 
 // template <class F, class ...Args> thread(F&& f, Args&&... args);
 
+// UNSUPPORTED: asan, msan
+
 #include <thread>
 #include <new>
 #include <cstdlib>
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
index cd9c2c4..64d5a93 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
index 17268ab..36e0fbd 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
index e068c04..20c8da1 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
index b8727d0..585f7ea 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
index 6d17dfc..e8c3801 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
index b315473..0037deb 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
index 2ff273c..6dd4c3e 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
index 099781f..de52b1d 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
index 54fc739..126965f 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
index d407dfc..bb7f2aa 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <functional>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
index dbb98b5..5a31232 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
index 6af4f3b..a5ea55a 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
index 32faef4..2559303 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
index 9c90eb7..351c1cf 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
index 1aae922..37c2d9c 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
index 820091e..e8dede1 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
index 256edc2..4d1ffad 100644
--- a/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.class/types.pass.cpp b/test/thread/thread.threads/thread.thread.class/types.pass.cpp
index e5094f7..a5bf770 100644
--- a/test/thread/thread.threads/thread.thread.class/types.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.class/types.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
index ef6615b..3b4b782 100644
--- a/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
index f66b962..bffb5f3 100644
--- a/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
index 2f3bb9a..9f3941b 100644
--- a/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/thread.thread.this/yield.pass.cpp b/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
index 52f53a6..daf5b0c 100644
--- a/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
+++ b/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/thread/thread.threads/version.pass.cpp b/test/thread/thread.threads/version.pass.cpp
index 6d272c7..d16b0eb 100644
--- a/test/thread/thread.threads/version.pass.cpp
+++ b/test/thread/thread.threads/version.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <thread>
 
diff --git a/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp b/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
index 537fb90..dbfaa97 100644
--- a/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
+++ b/test/utilities/allocator.adaptor/allocator.adaptor.types/allocator_pointers.pass.cpp
@@ -103,13 +103,13 @@
 
 int main()
 {
-	test_pointer<std::scoped_allocator_adaptor<std::allocator<char>>> ();
-	test_pointer<std::scoped_allocator_adaptor<std::allocator<int>>> ();
-	test_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();
+    test_pointer<std::scoped_allocator_adaptor<std::allocator<char>>> ();
+    test_pointer<std::scoped_allocator_adaptor<std::allocator<int>>> ();
+    test_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();
 
-	test_void_pointer<std::scoped_allocator_adaptor<std::allocator<char>>> ();
-	test_void_pointer<std::scoped_allocator_adaptor<std::allocator<int>>> ();
-	test_void_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();	
+    test_void_pointer<std::scoped_allocator_adaptor<std::allocator<char>>> ();
+    test_void_pointer<std::scoped_allocator_adaptor<std::allocator<int>>> ();
+    test_void_pointer<std::scoped_allocator_adaptor<std::allocator<Foo>>> ();   
 }
 #else
 int main() {}
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
index 44252b4..b8995bf 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
@@ -14,6 +14,8 @@
 // template <MoveConstructible  R, MoveConstructible ... ArgTypes>
 //   void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
index 92f99cd..3a43be7 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
@@ -13,6 +13,8 @@
 
 // function(nullptr_t);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
index de16998..ba65cd3 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
@@ -16,6 +16,8 @@
 //         && Convertible<Callable<F, ArgTypes...>::result_type
 //   operator=(F f);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
index f758a4d..38e65fc 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_function.pass.cpp
@@ -13,6 +13,8 @@
 
 // template<class A> function(allocator_arg_t, const A&, const function&);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
index 570c27e..2180b89 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
@@ -13,6 +13,8 @@
 
 // template<class A> function(allocator_arg_t, const A&, function&&);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <cassert>
 
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
index cf7b963..2fbd7cf 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy.pass.cpp
@@ -13,6 +13,8 @@
 
 // function(const function& f);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
index 544ec43..cfa79e2 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
@@ -13,6 +13,8 @@
 
 // function& operator=(const function& f);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
index 12a2b6e..b8c597b 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
@@ -13,6 +13,8 @@
 
 // function& operator=(nullptr_t);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
index dc56574..3c012d1 100644
--- a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
+++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
@@ -13,6 +13,8 @@
 
 // void swap(function& other);
 
+// UNSUPPORTED: asan, msan
+
 #include <functional>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp b/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
index 5a95097..4033e67 100644
--- a/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
+++ b/test/utilities/function.objects/refwrap/refwrap.helpers/ref_2.pass.cpp
@@ -35,9 +35,9 @@
     unary_counting_predicate<bool(*)(int), int> cp(is5);
     assert(!cp(6));
     assert(cp.count() == 1);
-	assert(call_pred(cp));
+    assert(call_pred(cp));
     assert(cp.count() == 1);
-	assert(call_pred(std::ref(cp)));
+    assert(call_pred(std::ref(cp)));
     assert(cp.count() == 2);
-	}
+    }
 }
diff --git a/test/utilities/function.objects/refwrap/type_properties.pass.cpp b/test/utilities/function.objects/refwrap/type_properties.pass.cpp
new file mode 100644
index 0000000..61e0bfa
--- /dev/null
+++ b/test/utilities/function.objects/refwrap/type_properties.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// reference_wrapper
+
+// Test that reference wrapper meets the requirements of TriviallyCopyable,
+// CopyConstructible and CopyAssignable.
+
+#include <functional>
+#include <type_traits>
+#include <string>
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+class MoveOnly
+{
+    MoveOnly(const MoveOnly&);
+    MoveOnly& operator=(const MoveOnly&);
+
+    int data_;
+public:
+    MoveOnly(int data = 1) : data_(data) {}
+    MoveOnly(MoveOnly&& x)
+        : data_(x.data_) {x.data_ = 0;}
+    MoveOnly& operator=(MoveOnly&& x)
+        {data_ = x.data_; x.data_ = 0; return *this;}
+
+    int get() const {return data_;}
+};
+#endif
+
+
+template <class T>
+void test()
+{
+    typedef std::reference_wrapper<T> Wrap;
+    static_assert(std::is_copy_constructible<Wrap>::value, "");
+    static_assert(std::is_copy_assignable<Wrap>::value, "");
+    // Extension up for standardization: See N4151.
+    static_assert(std::is_trivially_copyable<Wrap>::value, "");
+}
+
+int main()
+{
+    test<int>();
+    test<double>();
+    test<std::string>(); 
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test<MoveOnly>(); 
+#endif
+}
diff --git a/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
index f881805..a4a84e8 100644
--- a/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
+++ b/test/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
@@ -12,6 +12,8 @@
 // allocator:
 // pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
index 7e1500b..b9a1749 100644
--- a/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
+++ b/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
@@ -12,6 +12,8 @@
 // allocator:
 // template <class... Args> void construct(pointer p, Args&&... args);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp b/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp
index b894e45..5a8f7a2 100644
--- a/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp
+++ b/test/utilities/memory/default.allocator/allocator_pointers.pass.cpp
@@ -103,13 +103,13 @@
 
 int main()
 {
-	test_pointer<std::allocator<char>> ();
-	test_pointer<std::allocator<int>> ();
-	test_pointer<std::allocator<Foo>> ();	
+    test_pointer<std::allocator<char>> ();
+    test_pointer<std::allocator<int>> ();
+    test_pointer<std::allocator<Foo>> ();   
 
-	test_void_pointer<std::allocator<char>> ();
-	test_void_pointer<std::allocator<int>> ();
-	test_void_pointer<std::allocator<Foo>> ();	
+    test_void_pointer<std::allocator<char>> ();
+    test_void_pointer<std::allocator<int>> ();
+    test_void_pointer<std::allocator<Foo>> ();  
 }
 #else
 int main() {}
diff --git a/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp b/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
index e0e38fb..a8ad936 100644
--- a/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
+++ b/test/utilities/memory/pointer.traits/pointer.traits.functions/pointer_to.pass.cpp
@@ -40,7 +40,7 @@
     {
         int i = 0;
         A<int> a = std::pointer_traits<A<int> >::pointer_to(i);
-        assert(a.t_ = &i);
+        assert(a.t_ == &i);
     }
     {
         (std::pointer_traits<A<void> >::element_type)0;
diff --git a/test/utilities/memory/pointer.traits/pointer_to.pass.cpp b/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
index 764a7ba..fc44d9d 100644
--- a/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
+++ b/test/utilities/memory/pointer.traits/pointer_to.pass.cpp
@@ -24,7 +24,7 @@
     {
         int i = 0;
         int* a = std::pointer_traits<int*>::pointer_to(i);
-        assert(a = &i);
+        assert(a == &i);
     }
     {
         (std::pointer_traits<void*>::element_type)0;
diff --git a/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp b/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
index a706c40..95350a6 100644
--- a/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
+++ b/test/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp
@@ -15,17 +15,20 @@
 
 // default unique_ptr ctor should require default Deleter ctor
 
+// USE_VERIFY
+
 #include <memory>
 
 class Deleter
 {
-
-    Deleter() {}
+    // expected-error@memory:* {{base class 'Deleter' has private default constructor}}
+    // expected-note@memory:* + {{in instantiation of member function}}
+    Deleter() {} // expected-note {{implicitly declared private here}}
 
 public:
 
     Deleter(Deleter&) {}
-    Deleter& operator=(Deleter&) {}
+    Deleter& operator=(Deleter&) { return *this; }
 
     void operator()(void*) const {}
 };
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
index 0c80324..cd79fdb 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
index 9f93ae8..2fd9d5a 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
index 1c274d1..5c082cc 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
index 7741223..f53f442 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
index 6e6f635..fc4c47a 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
index f6a2085..19482dc 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
index 0420734..e3ac84a 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads
 
 // <memory>
 
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
index 49fd1b6..566e95a 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
index 94d0615..b423604 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
index 83ee45f..f65f3eb 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
index 2b3bb8b..6864200 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
+// UNSUPPORTED: libcpp-has-no-threads
+//
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
index 7af7468..0263061 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
@@ -19,6 +19,12 @@
 #include <type_traits>
 #include <cassert>
 
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION { assert(false); }
+#endif
+
 struct test_deleter_base
 {
     static int count;
@@ -46,6 +52,8 @@
     void set_state(int i) {state_ = i;}
 
     void operator()(T* p) {assert(state_ >= 0); ++dealloc_count; delete p;}
+   
+    test_deleter* operator&() const DELETE_FUNCTION;
 };
 
 template <class T>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
index 27046cf..28e49d6 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp
@@ -11,6 +11,8 @@
 
 // template<class Y> explicit shared_ptr(auto_ptr<Y>&& r);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
index 7966e00..b67f31e 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
@@ -15,6 +15,7 @@
 #include <cassert>
 #include "../test_deleter.h"
 #include "test_allocator.h"
+#include "min_allocator.h"
 
 struct A
 {
@@ -47,4 +48,38 @@
     assert(test_deleter<A>::dealloc_count == 1);
     assert(test_allocator<A>::count == 0);
     assert(test_allocator<A>::alloc_count == 0);
+    test_deleter<A>::dealloc_count = 0;
+    // Test an allocator with a minimal interface
+    {
+    std::shared_ptr<A> p(nullptr, test_deleter<A>(1), bare_allocator<void>());
+    assert(A::count == 0);
+    assert(p.use_count() == 1);
+    assert(p.get() == 0);
+    test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+    assert(test_deleter<A>::count ==1);
+    assert(test_deleter<A>::dealloc_count == 0);
+    assert(d);
+    assert(d->state() == 1);
+    }
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+    test_deleter<A>::dealloc_count = 0;
+#if __cplusplus >= 201103L
+    // Test an allocator that returns class-type pointers
+    {
+    std::shared_ptr<A> p(nullptr, test_deleter<A>(1), min_allocator<void>());
+    assert(A::count == 0);
+    assert(p.use_count() == 1);
+    assert(p.get() == 0);
+    test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+    assert(test_deleter<A>::count ==1);
+    assert(test_deleter<A>::dealloc_count == 0);
+    assert(d);
+    assert(d->state() == 1);
+    }
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+#endif
 }
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
index e8365ae..a8588cc 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -13,6 +13,8 @@
 
 // template<class D> shared_ptr(nullptr_t, D d);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <cassert>
 #include <new>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
index 23d3f10..1a9c09c 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
@@ -15,6 +15,7 @@
 #include <cassert>
 #include "../test_deleter.h"
 #include "test_allocator.h"
+#include "min_allocator.h"
 
 struct A
 {
@@ -27,6 +28,7 @@
 
 int A::count = 0;
 
+
 int main()
 {
     {
@@ -48,4 +50,40 @@
     assert(test_deleter<A>::dealloc_count == 1);
     assert(test_allocator<A>::count == 0);
     assert(test_allocator<A>::alloc_count == 0);
+    test_deleter<A>::dealloc_count = 0;
+    // Test an allocator with a minimal interface
+    {
+    A* ptr = new A;
+    std::shared_ptr<A> p(ptr, test_deleter<A>(3), bare_allocator<void>());
+    assert(A::count == 1);
+    assert(p.use_count() == 1);
+    assert(p.get() == ptr);
+    test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+    assert(test_deleter<A>::count == 1);
+    assert(test_deleter<A>::dealloc_count == 0);
+    assert(d);
+    assert(d->state() == 3);
+    }
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+    test_deleter<A>::dealloc_count = 0;
+#if __cplusplus >= 201103L
+    // Test an allocator that returns class-type pointers
+    {
+    A* ptr = new A;
+    std::shared_ptr<A> p(ptr, test_deleter<A>(3), min_allocator<void>());
+    assert(A::count == 1);
+    assert(p.use_count() == 1);
+    assert(p.get() == ptr);
+    test_deleter<A>* d = std::get_deleter<test_deleter<A> >(p);
+    assert(test_deleter<A>::count == 1);
+    assert(test_deleter<A>::dealloc_count == 0);
+    assert(d);
+    assert(d->state() == 3);
+    }
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+#endif
 }
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
index 79aaa58..b024f7e 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -13,6 +13,8 @@
 
 // template<class Y, class D> shared_ptr(Y* p, D d);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <cassert>
 #include <new>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
index d50d91c..28fb8bf 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
@@ -11,6 +11,8 @@
 
 // template<class Y> explicit shared_ptr(Y* p);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index b841833..dc2a6af 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -11,6 +11,8 @@
 
 // template <class Y, class D> explicit shared_ptr(unique_ptr<Y, D>&&r);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
@@ -53,6 +55,9 @@
 
 int A::count = 0;
 
+void fn ( const std::shared_ptr<int> &) {}
+void fn ( const std::shared_ptr<B> &) { assert (false); }
+
 int main()
 {
     {
@@ -89,4 +94,10 @@
     }
     }
     assert(A::count == 0);
+
+    // LWG 2399
+    {
+    throw_next = false;
+    fn(std::unique_ptr<int>(new int));
+    }
 }
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
index e019837..aa77dab 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.pass.cpp
@@ -19,6 +19,7 @@
 #include <cstdlib>
 #include <cassert>
 #include "test_allocator.h"
+#include "min_allocator.h"
 
 int new_count = 0;
 
@@ -54,4 +55,24 @@
     }
     assert(A::count == 0);
     assert(test_allocator<A>::alloc_count == 0);
+#if __cplusplus >= 201103L
+    {
+    int i = 67;
+    char c = 'e';
+    std::shared_ptr<A> p = std::allocate_shared<A>(min_allocator<void>(), i, c);
+    assert(A::count == 1);
+    assert(p->get_int() == 67);
+    assert(p->get_char() == 'e');
+    }
+    assert(A::count == 0);
+    {
+    int i = 68;
+    char c = 'f';
+    std::shared_ptr<A> p = std::allocate_shared<A>(bare_allocator<void>(), i, c);
+    assert(A::count == 1);
+    assert(p->get_int() == 68);
+    assert(p->get_char() == 'f');
+    }
+    assert(A::count == 0);
+#endif
 }
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp
new file mode 100644
index 0000000..8dcd50e
--- /dev/null
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_no_variadics.pass.cpp
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// shared_ptr
+
+// template<class T, class A, class... Args>
+//    shared_ptr<T> allocate_shared(const A& a, Args&&... args);
+
+#define _LIBCPP_HAS_NO_VARIADICS
+#include <memory>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include "test_allocator.h"
+#include "min_allocator.h"
+
+struct Zero
+{
+    static int count;
+    Zero() {++count;}
+    Zero(Zero const &) {++count;}
+    ~Zero() {--count;}
+};
+
+int Zero::count = 0;
+
+struct One
+{
+    static int count;
+    int value;
+    explicit One(int v) : value(v) {++count;}
+    One(One const & o) : value(o.value) {++count;}
+    ~One() {--count;}
+};
+
+int One::count = 0;
+
+
+struct Two
+{
+    static int count;
+    int value;
+    Two(int v, int) : value(v) {++count;}
+    Two(Two const & o) : value(o.value) {++count;}
+    ~Two() {--count;}
+};
+
+int Two::count = 0;
+
+struct Three
+{
+    static int count;
+    int value;
+    Three(int v, int, int) : value(v) {++count;}
+    Three(Three const & o) : value(o.value) {++count;}
+    ~Three() {--count;}
+};
+
+int Three::count = 0;
+
+template <class Alloc>
+void test()
+{
+    int const bad = -1;
+    {
+    std::shared_ptr<Zero> p = std::allocate_shared<Zero>(Alloc());
+    assert(Zero::count == 1);
+    }
+    assert(Zero::count == 0);
+    {
+    int const i = 42;
+    std::shared_ptr<One> p = std::allocate_shared<One>(Alloc(), i);
+    assert(One::count == 1);
+    assert(p->value == i);
+    }
+    assert(One::count == 0);
+    {
+    int const i = 42;
+    std::shared_ptr<Two> p = std::allocate_shared<Two>(Alloc(), i, bad);
+    assert(Two::count == 1);
+    assert(p->value == i);
+    }
+    assert(Two::count == 0);
+    {
+    int const i = 42;
+    std::shared_ptr<Three> p = std::allocate_shared<Three>(Alloc(), i, bad, bad);
+    assert(Three::count == 1);
+    assert(p->value == i);
+    }
+    assert(Three::count == 0);
+}
+
+int main()
+{
+    {
+    int i = 67;
+    int const bad = -1;
+    std::shared_ptr<Two> p = std::allocate_shared<Two>(test_allocator<Two>(54), i, bad);
+    assert(test_allocator<Two>::alloc_count == 1);
+    assert(Two::count == 1);
+    assert(p->value == 67);
+    }
+    assert(Two::count == 0);
+    assert(test_allocator<Two>::alloc_count == 0);
+
+    test<bare_allocator<void> >();
+#if __cplusplus >= 201103L
+    test<min_allocator<void> >();
+#endif
+}
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
index eda148c..30a4984 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -13,6 +13,8 @@
 
 // template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
 
+// UNSUPPORTED: asan, msan
+
 #include <memory>
 #include <new>
 #include <cstdlib>
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
index 1fdf883..75bf3df 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr.pass.cpp
@@ -55,8 +55,10 @@
 template <class T>
 std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
 
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 template <class T>
 void sink (std::weak_ptr<T> &&) {}
+#endif
 
 int main()
 {
@@ -98,6 +100,7 @@
     assert(B::count == 0);
     assert(A::count == 0);
 
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     {
         std::shared_ptr<A> ps(new A);
         std::weak_ptr<A> pA = source(ps);
@@ -107,4 +110,5 @@
     }
     assert(B::count == 0);
     assert(A::count == 0);
+#endif
 }
diff --git a/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp b/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp
index 70ad11b..51a8fa5 100644
--- a/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp
+++ b/test/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.const/weak_ptr_Y.pass.cpp
@@ -55,9 +55,6 @@
 template <class T>
 std::weak_ptr<T> source (std::shared_ptr<T> p) { return std::weak_ptr<T>(p); }
 
-template <class T>
-void sink (std::weak_ptr<T> &&) {}
-
 int main()
 {
     static_assert(( std::is_convertible<std::weak_ptr<A>, std::weak_ptr<B> >::value), "");
diff --git a/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
index 7de3b0d..eb8e31c 100644
--- a/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
+++ b/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
@@ -52,7 +52,7 @@
     test_make_signed< unsigned long long, signed long long >();
     test_make_signed< wchar_t, std::conditional<sizeof(wchar_t) == 4, int, short>::type >();
     test_make_signed< const wchar_t, std::conditional<sizeof(wchar_t) == 4, const int, const short>::type >();
-    test_make_signed< const Enum, const int >();
+    test_make_signed< const Enum, std::conditional<sizeof(Enum) == sizeof(int), const int, const signed char>::type >();
     test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >();
 #ifndef _LIBCPP_HAS_NO_INT128
     test_make_signed< __int128_t, __int128_t >();
diff --git a/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
index a13485a..9844401 100644
--- a/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
+++ b/test/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
@@ -52,7 +52,7 @@
     test_make_unsigned<unsigned long long, unsigned long long> ();
     test_make_unsigned<wchar_t, std::conditional<sizeof(wchar_t) == 4, unsigned int, unsigned short>::type> ();
     test_make_unsigned<const wchar_t, std::conditional<sizeof(wchar_t) == 4, const unsigned int, const unsigned short>::type> ();
-    test_make_unsigned<const Enum, const unsigned int> ();
+    test_make_unsigned<const Enum, std::conditional<sizeof(Enum) == sizeof(int), const unsigned int, const unsigned char>::type >();
     test_make_unsigned<BigEnum,
                    std::conditional<sizeof(long) == 4, unsigned long long, unsigned long>::type> ();
 #ifndef _LIBCPP_HAS_NO_INT128
diff --git a/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
index 01a2f65..6ea1cac 100644
--- a/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
+++ b/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
@@ -39,7 +39,7 @@
     test_alignment_of<int, 4>();
     test_alignment_of<double, 8>();
 #if (defined(__ppc__) && !defined(__ppc64__))
-    test_alignment_of<bool, 4>();	// 32-bit PPC has four byte bool
+    test_alignment_of<bool, 4>();   // 32-bit PPC has four byte bool
 #else
     test_alignment_of<bool, 1>();
 #endif
diff --git a/test/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/test/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
new file mode 100644
index 0000000..1f99a74
--- /dev/null
+++ b/test/utilities/meta/meta.unary.prop.query/void_t.pass.cpp
@@ -0,0 +1,69 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// void_t
+
+#include <type_traits>
+
+#if _LIBCPP_STD_VER <= 14
+int main () {}
+#else
+
+template <class T>
+void test1()
+{
+    static_assert( std::is_same<void, std::void_t<T>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const T>>::value, "");
+    static_assert( std::is_same<void, std::void_t<volatile T>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const volatile T>>::value, "");
+}
+
+template <class T, class U>
+void test2()
+{
+    static_assert( std::is_same<void, std::void_t<T, U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const T, U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<volatile T, U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const volatile T, U>>::value, "");
+
+    static_assert( std::is_same<void, std::void_t<T, const U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const T, const U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<volatile T, const U>>::value, "");
+    static_assert( std::is_same<void, std::void_t<const volatile T, const U>>::value, "");
+}
+
+class Class
+{
+public:
+    ~Class();
+};
+
+int main()
+{
+    static_assert( std::is_same<void, std::void_t<>>::value, "");
+
+	test1<void>();
+	test1<int>();
+	test1<double>();
+	test1<int&>();
+	test1<Class>();
+	test1<Class[]>();
+	test1<Class[5]>();
+	
+	test2<void, int>();
+	test2<double, int>();
+	test2<int&, int>();
+	test2<Class&, bool>();
+	test2<void *, int&>();
+
+    static_assert( std::is_same<void, std::void_t<int, double const &, Class, volatile int[], void>>::value, "");
+}
+#endif
diff --git a/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
index c563870..67ef3db 100644
--- a/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp
@@ -61,6 +61,18 @@
     test_member_function_pointer<void (Class::*)(int) volatile>();
     test_member_function_pointer<void (Class::*)(int, char) volatile>();
 
+    test_member_function_pointer<void (Class::*)(...)>();
+    test_member_function_pointer<void (Class::*)(int, ...)>();
+    test_member_function_pointer<void (Class::*)(int, char, ...)>();
+
+    test_member_function_pointer<void (Class::*)(...) const>();
+    test_member_function_pointer<void (Class::*)(int, ...) const>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) const>();
+
+    test_member_function_pointer<void (Class::*)(...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, ...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+
 #if __cplusplus >= 201103L
 // reference qualifiers on functions are a C++11 extension
     test_member_function_pointer<void (Class::*)() &&>();
@@ -74,5 +86,17 @@
     test_member_function_pointer<void (Class::*)() volatile &&>();
     test_member_function_pointer<void (Class::*)(int) volatile &&>();
     test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
+
+    test_member_function_pointer<void (Class::*)(...) &&>();
+    test_member_function_pointer<void (Class::*)(int,...) &&>();
+    test_member_function_pointer<void (Class::*)(int, char,...) &&>();
+
+    test_member_function_pointer<void (Class::*)(...) &>();
+    test_member_function_pointer<void (Class::*)(int,...) &>();
+    test_member_function_pointer<void (Class::*)(int, char,...) &>();
+
+    test_member_function_pointer<void (Class::*)(...) volatile &&>();
+    test_member_function_pointer<void (Class::*)(int,...) volatile &&>();
+    test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>();
 #endif
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
new file mode 100644
index 0000000..e13e586
--- /dev/null
+++ b/test/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp
@@ -0,0 +1,76 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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
+
+// member_function_pointer
+
+#define _LIBCPP_HAS_NO_VARIADICS
+#include <type_traits>
+
+template <class T>
+void test_member_function_pointer_imp()
+{
+    static_assert(!std::is_void<T>::value, "");
+#if _LIBCPP_STD_VER > 11
+    static_assert(!std::is_null_pointer<T>::value, "");
+#endif
+    static_assert(!std::is_integral<T>::value, "");
+    static_assert(!std::is_floating_point<T>::value, "");
+    static_assert(!std::is_array<T>::value, "");
+    static_assert(!std::is_pointer<T>::value, "");
+    static_assert(!std::is_lvalue_reference<T>::value, "");
+    static_assert(!std::is_rvalue_reference<T>::value, "");
+    static_assert(!std::is_member_object_pointer<T>::value, "");
+    static_assert( std::is_member_function_pointer<T>::value, "");
+    static_assert(!std::is_enum<T>::value, "");
+    static_assert(!std::is_union<T>::value, "");
+    static_assert(!std::is_class<T>::value, "");
+    static_assert(!std::is_function<T>::value, "");
+}
+
+template <class T>
+void test_member_function_pointer()
+{
+    test_member_function_pointer_imp<T>();
+    test_member_function_pointer_imp<const T>();
+    test_member_function_pointer_imp<volatile T>();
+    test_member_function_pointer_imp<const volatile T>();
+}
+
+class Class
+{
+};
+
+int main()
+{
+    test_member_function_pointer<void (Class::*)()>();
+    test_member_function_pointer<void (Class::*)(int)>();
+    test_member_function_pointer<void (Class::*)(int, char)>();
+
+    test_member_function_pointer<void (Class::*)() const>();
+    test_member_function_pointer<void (Class::*)(int) const>();
+    test_member_function_pointer<void (Class::*)(int, char) const>();
+
+    test_member_function_pointer<void (Class::*)() volatile>();
+    test_member_function_pointer<void (Class::*)(int) volatile>();
+    test_member_function_pointer<void (Class::*)(int, char) volatile>();
+
+    test_member_function_pointer<void (Class::*)(...)>();
+    test_member_function_pointer<void (Class::*)(int, ...)>();
+    test_member_function_pointer<void (Class::*)(int, char, ...)>();
+
+    test_member_function_pointer<void (Class::*)(...) const>();
+    test_member_function_pointer<void (Class::*)(int, ...) const>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) const>();
+
+    test_member_function_pointer<void (Class::*)(...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, ...) volatile>();
+    test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
+}
diff --git a/test/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
index d619701..691e353 100644
--- a/test/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp
@@ -10,7 +10,7 @@
 // type_traits
 
 // nullptr_t
-//	is_null_pointer
+//  is_null_pointer
 
 #include <type_traits>
 
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
index de27b98..1c715e0 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp
@@ -40,6 +40,20 @@
     constexpr C operator&() const;
 };
 
+struct F {};
+constexpr F* operator&(F const &) { return nullptr; }
+
+struct G {};
+constexpr G* operator&(G &&) { return nullptr; }
+
+struct H {};
+constexpr H* operator&(H const &&) { return nullptr; }
+
+struct J
+{
+    constexpr J* operator&() const &&;
+};
+
 #endif  // _LIBCPP_HAS_NO_CONSTEXPR
 
 int main()
@@ -49,5 +63,9 @@
     static_assert(std::__has_operator_addressof<A>::value == false, "");
     static_assert(std::__has_operator_addressof<B>::value == true, "");
     static_assert(std::__has_operator_addressof<E>::value == true, "");
+    static_assert(std::__has_operator_addressof<F>::value == true, "");
+    static_assert(std::__has_operator_addressof<G>::value == true, "");
+    static_assert(std::__has_operator_addressof<H>::value == true, "");
+    static_assert(std::__has_operator_addressof<J>::value == true, "");
 #endif  // _LIBCPP_HAS_NO_CONSTEXPR
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
index 92fd336..685d30d 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp
@@ -69,7 +69,7 @@
     test_has_not_virtual_destructor<int*>();
     test_has_not_virtual_destructor<const int*>();
     test_has_not_virtual_destructor<char[3]>();
-    test_has_not_virtual_destructor<char[3]>();
+    test_has_not_virtual_destructor<char[]>();
     test_has_not_virtual_destructor<bit_zero>();
 
     test_has_virtual_destructor<Abstract>();
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
index cba575f..f2a8c23 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp
@@ -61,7 +61,7 @@
     test_is_not_abstract<int*>();
     test_is_not_abstract<const int*>();
     test_is_not_abstract<char[3]>();
-    test_is_not_abstract<char[3]>();
+    test_is_not_abstract<char[]>();
     test_is_not_abstract<Union>();
     test_is_not_abstract<Empty>();
     test_is_not_abstract<bit_zero>();
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
index 3285765..72f2ff4 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp
@@ -30,7 +30,7 @@
     test_is_const<int*>();
     test_is_const<const int*>();
     test_is_const<char[3]>();
-    test_is_const<char[3]>();
+    test_is_const<char[]>();
 
     static_assert(!std::is_const<int&>::value, "");
     static_assert(!std::is_const<const int&>::value, "");
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
index bde44de..c43d594 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp
@@ -52,6 +52,11 @@
     B& operator=(const B&);
 };
 
+struct C
+{
+    void operator=(C&);  // not const
+};
+
 int main()
 {
     test_is_copy_assignable<int> ();
@@ -71,4 +76,5 @@
     test_is_not_copy_assignable<B> ();
 #endif
     test_is_not_copy_assignable<void> ();
+    test_is_not_copy_assignable<C> ();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
index 837d0b0..f878a50 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp
@@ -58,6 +58,12 @@
     B(const B&);
 };
 
+struct C
+{
+    C(C&);  // not const
+    void operator=(C&);  // not const
+};
+
 int main()
 {
     test_is_copy_constructible<A>();
@@ -75,6 +81,7 @@
     test_is_not_copy_constructible<char[]>();
     test_is_not_copy_constructible<void>();
     test_is_not_copy_constructible<Abstract>();
+    test_is_not_copy_constructible<C>();
 #if __has_feature(cxx_access_control_sfinae) 
     test_is_not_copy_constructible<B>();
 #endif
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
index 584d2cc..47af3c4 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp
@@ -56,7 +56,7 @@
     test_is_not_empty<int*>();
     test_is_not_empty<const int*>();
     test_is_not_empty<char[3]>();
-    test_is_not_empty<char[3]>();
+    test_is_not_empty<char[]>();
     test_is_not_empty<Union>();
     test_is_not_empty<NotEmpty>();
 
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
index 892ffd7..a89ee7d 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
@@ -60,7 +60,6 @@
     test_is_not_move_assignable<const int> ();
     test_is_not_move_assignable<int[]> ();
     test_is_not_move_assignable<int[3]> ();
-    test_is_not_move_assignable<int[3]> ();
 #endif
     test_is_not_move_assignable<void> ();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
index 3bd2b3b..8fff5f8 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp
@@ -34,6 +34,11 @@
     void operator=(A);
 };
 
+struct C
+{
+    void operator=(C&);  // not const
+};
+
 int main()
 {
     test_is_nothrow_assignable<int&, int&> ();
@@ -46,4 +51,5 @@
     test_is_not_nothrow_assignable<int, int> ();
     test_is_not_nothrow_assignable<B, A> ();
     test_is_not_nothrow_assignable<A, B> ();
+    test_is_not_nothrow_assignable<C, C&> ();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
index 8978ec9..fe0b567 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp
@@ -70,14 +70,34 @@
     A(const A&);
 };
 
+struct C
+{
+    C(C&);  // not const
+    void operator=(C&);  // not const
+};
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+struct Tuple {
+    Tuple(Empty&&) noexcept {}
+};
+#endif
+
 int main()
 {
     test_is_nothrow_constructible<int> ();
     test_is_nothrow_constructible<int, const int&> ();
     test_is_nothrow_constructible<Empty> ();
     test_is_nothrow_constructible<Empty, const Empty&> ();
-
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    test_is_nothrow_constructible<Tuple &&, Empty> (); // See bug #19616.
+#endif
+    
     test_is_not_nothrow_constructible<A, int> ();
     test_is_not_nothrow_constructible<A, int, double> ();
     test_is_not_nothrow_constructible<A> ();
+    test_is_not_nothrow_constructible<C> ();
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    static_assert(!std::is_constructible<Tuple&, Empty>::value, "");
+    test_is_not_nothrow_constructible<Tuple &, Empty> (); // See bug #19616.
+#endif
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
index 7871732..8fd5bab 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
@@ -23,7 +23,7 @@
 }
 
 template <class T>
-void test_has_not_nothrow_destructor()
+void test_is_not_nothrow_destructible()
 {
     static_assert(!std::is_nothrow_destructible<T>::value, "");
     static_assert(!std::is_nothrow_destructible<const T>::value, "");
@@ -64,9 +64,10 @@
 
 int main()
 {
-    test_has_not_nothrow_destructor<void>();
-    test_has_not_nothrow_destructor<AbstractDestructor>();
-    test_has_not_nothrow_destructor<NotEmpty>();
+    test_is_not_nothrow_destructible<void>();
+    test_is_not_nothrow_destructible<AbstractDestructor>();
+    test_is_not_nothrow_destructible<NotEmpty>();
+    test_is_not_nothrow_destructible<char[]>();
 
 #if __has_feature(cxx_noexcept)
     test_is_nothrow_destructible<A>();
@@ -83,7 +84,6 @@
     test_is_nothrow_destructible<int*>();
     test_is_nothrow_destructible<const int*>();
     test_is_nothrow_destructible<char[3]>();
-    test_is_nothrow_destructible<char[3]>();
     test_is_nothrow_destructible<Abstract>();
 #if __has_feature(cxx_noexcept)
     test_is_nothrow_destructible<bit_zero>();
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
index a97685c..4ec1ae9 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp
@@ -48,5 +48,5 @@
     test_is_pod<int*>();
     test_is_pod<const int*>();
     test_is_pod<char[3]>();
-    test_is_pod<char[3]>();
+    test_is_pod<char[]>();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
index 8f5547e..6e82cdd 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
@@ -69,7 +69,7 @@
     test_is_not_polymorphic<int*>();
     test_is_not_polymorphic<const int*>();
     test_is_not_polymorphic<char[3]>();
-    test_is_not_polymorphic<char[3]>();
+    test_is_not_polymorphic<char[]>();
     test_is_not_polymorphic<Union>();
     test_is_not_polymorphic<Empty>();
     test_is_not_polymorphic<bit_zero>();
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
index 7de6566..479c252 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp
@@ -45,7 +45,7 @@
     test_is_not_signed<int*>();
     test_is_not_signed<const int*>();
     test_is_not_signed<char[3]>();
-    test_is_not_signed<char[3]>();
+    test_is_not_signed<char[]>();
     test_is_not_signed<bool>();
     test_is_not_signed<unsigned>();
 
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
index 984824a..735d05f 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp
@@ -34,6 +34,11 @@
     void operator=(A);
 };
 
+struct C
+{
+    void operator=(C&);  // not const
+};
+
 int main()
 {
     test_is_trivially_assignable<int&, int&> ();
@@ -44,4 +49,5 @@
     test_is_not_trivially_assignable<int, int> ();
     test_is_not_trivially_assignable<B, A> ();
     test_is_not_trivially_assignable<A, B> ();
+    test_is_not_trivially_assignable<C&, C&> ();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
similarity index 100%
rename from test/utilities/meta/meta.unary/meta.unary.prop/is_trivialially_copyable.pass.cpp
rename to test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
index 1b34885..b18ace4 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp
@@ -23,7 +23,7 @@
 }
 
 template <class T>
-void test_has_not_trivial_destructor()
+void test_is_not_trivially_destructible()
 {
     static_assert(!std::is_trivially_destructible<T>::value, "");
     static_assert(!std::is_trivially_destructible<const T>::value, "");
@@ -64,10 +64,11 @@
 
 int main()
 {
-    test_has_not_trivial_destructor<void>();
-    test_has_not_trivial_destructor<A>();
-    test_has_not_trivial_destructor<AbstractDestructor>();
-    test_has_not_trivial_destructor<NotEmpty>();
+    test_is_not_trivially_destructible<void>();
+    test_is_not_trivially_destructible<A>();
+    test_is_not_trivially_destructible<AbstractDestructor>();
+    test_is_not_trivially_destructible<NotEmpty>();
+    test_is_not_trivially_destructible<char[]>();
 
     test_is_trivially_destructible<Abstract>();
     test_is_trivially_destructible<int&>();
@@ -78,6 +79,5 @@
     test_is_trivially_destructible<int*>();
     test_is_trivially_destructible<const int*>();
     test_is_trivially_destructible<char[3]>();
-    test_is_trivially_destructible<char[3]>();
     test_is_trivially_destructible<bit_zero>();
 }
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
index 2cd4945..dfdb155 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp
@@ -45,7 +45,7 @@
     test_is_not_unsigned<int*>();
     test_is_not_unsigned<const int*>();
     test_is_not_unsigned<char[3]>();
-    test_is_not_unsigned<char[3]>();
+    test_is_not_unsigned<char[]>();
     test_is_not_unsigned<int>();
     test_is_not_unsigned<double>();
 
diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
index 8e1fca4..f6805bc 100644
--- a/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
+++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp
@@ -30,7 +30,7 @@
     test_is_volatile<int*>();
     test_is_volatile<const int*>();
     test_is_volatile<char[3]>();
-    test_is_volatile<char[3]>();
+    test_is_volatile<char[]>();
 
     static_assert(!std::is_volatile<int&>::value, "");
     static_assert(!std::is_volatile<volatile int&>::value, "");
diff --git a/test/utilities/optional/optional.hash/hash.pass.cpp b/test/utilities/optional/optional.hash/hash.pass.cpp
index ca23d78..9e5fb55 100644
--- a/test/utilities/optional/optional.hash/hash.pass.cpp
+++ b/test/utilities/optional/optional.hash/hash.pass.cpp
@@ -20,7 +20,7 @@
 int main()
 {
 #if _LIBCPP_STD_VER > 11
-	using std::experimental::optional;
+    using std::experimental::optional;
 
     {
         typedef int T;
diff --git a/test/utilities/optional/optional.nullops/eqaul.pass.cpp b/test/utilities/optional/optional.nullops/eqaul.pass.cpp
index d137d30..54fb522 100644
--- a/test/utilities/optional/optional.nullops/eqaul.pass.cpp
+++ b/test/utilities/optional/optional.nullops/eqaul.pass.cpp
@@ -18,9 +18,9 @@
 int main()
 {
 #if _LIBCPP_STD_VER > 11
-	using std::experimental::optional;
-	using std::experimental::nullopt_t;
-	using std::experimental::nullopt;
+    using std::experimental::optional;
+    using std::experimental::nullopt_t;
+    using std::experimental::nullopt;
     
     {
     typedef int T;
diff --git a/test/utilities/optional/optional.nullops/less_than.pass.cpp b/test/utilities/optional/optional.nullops/less_than.pass.cpp
index 51c8e49..576a98a 100644
--- a/test/utilities/optional/optional.nullops/less_than.pass.cpp
+++ b/test/utilities/optional/optional.nullops/less_than.pass.cpp
@@ -18,9 +18,9 @@
 int main()
 {
 #if _LIBCPP_STD_VER > 11
-	using std::experimental::optional;
-	using std::experimental::nullopt_t;
-	using std::experimental::nullopt;
+    using std::experimental::optional;
+    using std::experimental::nullopt_t;
+    using std::experimental::nullopt;
 
     {
     typedef int T;
diff --git a/test/utilities/optional/optional.object/optional_const_void.fail.cpp b/test/utilities/optional/optional.object/optional_const_void.fail.cpp
index ccbcf2e..6999cf2 100644
--- a/test/utilities/optional/optional.object/optional_const_void.fail.cpp
+++ b/test/utilities/optional/optional.object/optional_const_void.fail.cpp
@@ -16,7 +16,7 @@
 int main()
 {
 #if _LIBCPP_STD_VER > 11
-	using std::experimental::optional;
+    using std::experimental::optional;
 
     optional<const void> opt;
 #else
diff --git a/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp b/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
index bec6787..60c6461 100644
--- a/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
+++ b/test/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
@@ -11,6 +11,7 @@
 // darwin11 and darwin12:
 // XFAIL: with_system_lib=x86_64-apple-darwin11
 // XFAIL: with_system_lib=x86_64-apple-darwin12
+// UNSUPPORTED: libcpp-has-no-monotonic-clock
 
 // <chrono>
 
diff --git a/test/utilities/time/time.clock/time.clock.steady/now.pass.cpp b/test/utilities/time/time.clock/time.clock.steady/now.pass.cpp
index 0c6ebe6..4b86d9e 100644
--- a/test/utilities/time/time.clock/time.clock.steady/now.pass.cpp
+++ b/test/utilities/time/time.clock/time.clock.steady/now.pass.cpp
@@ -6,6 +6,8 @@
 // Source Licenses. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-monotonic-clock
 
 // <chrono>
 
diff --git a/test/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.pass.cpp
new file mode 100644
index 0000000..f62d2fe
--- /dev/null
+++ b/test/utilities/tuple/tuple.tuple/tuple.assign/tuple_array_template_depth.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Tuple, __tuple_assignable<Tuple, tuple> >
+//   tuple & operator=(Tuple &&);
+
+// This test checks that we do not evaluate __make_tuple_types
+// on the array when it doesn't match the size of the tuple.
+
+#include <array>
+#include <tuple>
+
+// Use 1256 to try and blow the template instantiation depth for all compilers.
+typedef std::array<char, 1256> array_t;
+typedef std::tuple<array_t> tuple_t;
+
+int main()
+{
+    array_t arr;
+    tuple_t tup;
+    tup = arr;
+}
diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
index d6fbdae..3d8b194 100644
--- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
+++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
@@ -16,6 +16,7 @@
 
 #include <tuple>
 #include <cassert>
+#include <type_traits>
 
 #include "../MoveOnly.h"
 
@@ -30,6 +31,71 @@
 
 #endif
 
+struct NoDefault { NoDefault() = delete; };
+
+// Make sure the _Up... constructor SFINAEs out when the types that
+// are not explicitly initialized are not all default constructible.
+// Otherwise, std::is_constructible would return true but instantiating
+// the constructor would fail.
+void test_default_constructible_extension_sfinae()
+{
+    {
+        typedef std::tuple<MoveOnly, NoDefault> Tuple;
+
+        static_assert(!std::is_constructible<
+            Tuple,
+            MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            Tuple,
+            MoveOnly, NoDefault
+        >::value, "");
+    }
+    {
+        typedef std::tuple<MoveOnly, MoveOnly, NoDefault> Tuple;
+
+        static_assert(!std::is_constructible<
+            Tuple,
+            MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            Tuple,
+            MoveOnly, MoveOnly, NoDefault
+        >::value, "");
+    }
+    {
+        // Same idea as above but with a nested tuple type.
+        typedef std::tuple<MoveOnly, NoDefault> Tuple;
+        typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
+
+        static_assert(!std::is_constructible<
+            NestedTuple,
+            MoveOnly, MoveOnly, MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            MoveOnly, Tuple, MoveOnly, MoveOnly
+        >::value, "");
+    }
+    {
+        typedef std::tuple<MoveOnly, int> Tuple;
+        typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            MoveOnly, MoveOnly, MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            MoveOnly, Tuple, MoveOnly, MoveOnly
+        >::value, "");
+    }
+}
+
 int main()
 {
     {
@@ -72,4 +138,7 @@
         static_assert(std::get<0>(t).id_ == 3, "");
     }
 #endif
+    // Check that SFINAE is properly applied with the default reduced arity
+    // constructor extensions.
+    test_default_constructible_extension_sfinae();
 }
diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
index 667c4dd..00bc5e0 100644
--- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
+++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
@@ -22,6 +22,71 @@
 #include "../alloc_first.h"
 #include "../alloc_last.h"
 
+struct NoDefault { NoDefault() = delete; };
+
+// Make sure the _Up... constructor SFINAEs out when the types that
+// are not explicitly initialized are not all default constructible.
+// Otherwise, std::is_constructible would return true but instantiating
+// the constructor would fail.
+void test_default_constructible_extension_sfinae()
+{
+    {
+        typedef std::tuple<MoveOnly, NoDefault> Tuple;
+
+        static_assert(!std::is_constructible<
+            Tuple,
+            std::allocator_arg_t, A1<int>, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            Tuple,
+            std::allocator_arg_t, A1<int>, MoveOnly, NoDefault
+        >::value, "");
+    }
+    {
+        typedef std::tuple<MoveOnly, MoveOnly, NoDefault> Tuple;
+
+        static_assert(!std::is_constructible<
+            std::tuple<MoveOnly, MoveOnly, NoDefault>,
+            std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            std::tuple<MoveOnly, MoveOnly, NoDefault>,
+            std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, NoDefault
+        >::value, "");
+    }
+    {
+        // Same idea as above but with a nested tuple
+        typedef std::tuple<MoveOnly, NoDefault> Tuple;
+        typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
+
+        static_assert(!std::is_constructible<
+            NestedTuple,
+            std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            std::allocator_arg_t, A1<int>, MoveOnly, Tuple, MoveOnly, MoveOnly
+        >::value, "");
+    }
+    {
+        typedef std::tuple<MoveOnly, int> Tuple;
+        typedef std::tuple<MoveOnly, Tuple, MoveOnly, MoveOnly> NestedTuple;
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            std::allocator_arg_t, A1<int>, MoveOnly, MoveOnly, MoveOnly, MoveOnly
+        >::value, "");
+
+        static_assert(std::is_constructible<
+            NestedTuple,
+            std::allocator_arg_t, A1<int>, MoveOnly, Tuple, MoveOnly, MoveOnly
+        >::value, "");
+    }
+}
+
 int main()
 {
     {
@@ -68,4 +133,7 @@
         assert(std::get<1>(t) == MoveOnly());
         assert(std::get<2>(t) == MoveOnly());
     }
+    // Check that SFINAE is properly applied with the default reduced arity
+    // constructor extensions.
+    test_default_constructible_extension_sfinae();
 }
diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
index b72b77e..9cde90d 100644
--- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
+++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
@@ -16,9 +16,23 @@
 #include <tuple>
 #include <string>
 #include <cassert>
+#include <type_traits>
 
 #include "DefaultOnly.h"
 
+struct NoDefault {
+    NoDefault() = delete;
+    explicit NoDefault(int) { }
+};
+
+struct NoExceptDefault {
+    NoExceptDefault() noexcept = default;
+};
+
+struct ThrowingDefault {
+    ThrowingDefault() { }
+};
+
 int main()
 {
     {
@@ -46,6 +60,20 @@
         assert(std::get<2>(t) == "");
         assert(std::get<3>(t) == DefaultOnly());
     }
+    {
+        // See bug #21157.
+        static_assert(!std::is_default_constructible<std::tuple<NoDefault>>(), "");
+        static_assert(!std::is_default_constructible<std::tuple<DefaultOnly, NoDefault>>(), "");
+        static_assert(!std::is_default_constructible<std::tuple<NoDefault, DefaultOnly, NoDefault>>(), "");
+    }
+    {
+        static_assert(noexcept(std::tuple<NoExceptDefault>()), "");
+        static_assert(noexcept(std::tuple<NoExceptDefault, NoExceptDefault>()), "");
+
+        static_assert(!noexcept(std::tuple<ThrowingDefault, NoExceptDefault>()), "");
+        static_assert(!noexcept(std::tuple<NoExceptDefault, ThrowingDefault>()), "");
+        static_assert(!noexcept(std::tuple<ThrowingDefault, ThrowingDefault>()), "");
+    }
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     {
         constexpr std::tuple<> t;
diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/tuple_array_template_depth.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/tuple_array_template_depth.pass.cpp
new file mode 100644
index 0000000..65a1c70
--- /dev/null
+++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/tuple_array_template_depth.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.
+//
+//===----------------------------------------------------------------------===//
+
+// <tuple>
+
+// template <class... Types> class tuple;
+
+// template <class Tuple, __tuple_convertible<Tuple, tuple> >
+//   tuple(Tuple &&);
+//
+// template <class Tuple, __tuple_constructible<Tuple, tuple> >
+//   tuple(Tuple &&);
+
+// This test checks that we do not evaluate __make_tuple_types
+// on the array.
+
+#include <array>
+#include <tuple>
+
+// Use 1256 to try and blow the template instantiation depth for all compilers.
+typedef std::array<char, 1256> array_t;
+typedef std::tuple<array_t> tuple_t;
+
+int main()
+{
+    array_t arr;
+    tuple_t tup(arr);
+}
diff --git a/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
index b47842d..3fca573 100644
--- a/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
+++ b/test/utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp
@@ -213,4 +213,18 @@
         assert(std::get<3>(t3) == 4);
         assert(std::get<4>(t3) == 5);
     }
+    {
+        // See bug #19616.
+        auto t1 = std::tuple_cat(
+            std::make_tuple(std::make_tuple(1)),
+            std::make_tuple()
+        );
+        assert(t1 == std::make_tuple(std::make_tuple(1)));
+
+        auto t2 = std::tuple_cat(
+            std::make_tuple(std::make_tuple(1)),
+            std::make_tuple(std::make_tuple(2))
+        );
+        assert(t2 == std::make_tuple(std::make_tuple(1), std::make_tuple(2)));
+    }
 }
diff --git a/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp
new file mode 100644
index 0000000..d8a72c6
--- /dev/null
+++ b/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.array.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// template <class... Types> class tuple;
+
+// template <size_t I, class... Types>
+// class tuple_element<I, tuple<Types...> >
+// {
+// public:
+//     typedef Ti type;
+// };
+//
+//  LWG #2212 says that tuple_size and tuple_element must be 
+//     available after including <utility>
+
+#include <array>
+#include <type_traits>
+
+template <class T, std::size_t N, class U, size_t idx>
+void test()
+{
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<const T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<volatile T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<const volatile T> >::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, T>::type, U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, const T>::type, const U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, volatile T>::type, volatile U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, const volatile T>::type, const volatile U>::value), "");
+}
+
+int main()
+{
+    test<std::array<int, 5>, 5, int, 0>();
+    test<std::array<int, 5>, 5, int, 1>();
+    test<std::array<const char *, 4>, 4, const char *, 3>();
+    test<std::array<volatile int, 4>, 4, volatile int, 3>();
+    test<std::array<char *, 3>, 3, char *, 1>();
+    test<std::array<char *, 3>, 3, char *, 2>();
+}
diff --git a/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp
new file mode 100644
index 0000000..8c8357d
--- /dev/null
+++ b/test/utilities/tuple/tuple.tuple/tuple.helper/tuple.include.utility.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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>
+
+// template <class... Types> class tuple;
+
+// template <class... Types>
+//   class tuple_size<tuple<Types...>>
+//     : public integral_constant<size_t, sizeof...(Types)> { };
+//
+//  LWG #2212 says that tuple_size and tuple_element must be 
+//     available after including <utility>
+
+#include <utility>
+#include <type_traits>
+
+template <class T, std::size_t N, class U, size_t idx>
+void test()
+{
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<const T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<volatile T> >::value), "");
+    static_assert((std::is_base_of<std::integral_constant<std::size_t, N>,
+                                   std::tuple_size<const volatile T> >::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, T>::type, U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, const T>::type, const U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, volatile T>::type, volatile U>::value), "");
+    static_assert((std::is_same<typename std::tuple_element<idx, const volatile T>::type, const volatile U>::value), "");
+}
+
+int main()
+{
+    test<std::pair<int, int>, 2, int, 0>();
+    test<std::pair<int, int>, 2, int, 1>();
+    test<std::pair<const int, int>, 2, int, 1>();
+    test<std::pair<int, volatile int>, 2, volatile int, 1>();
+    test<std::pair<char *, int>, 2, char *, 0>();
+    test<std::pair<char *, int>, 2, int,    1>();
+}
diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html
new file mode 100644
index 0000000..caa750b
--- /dev/null
+++ b/www/cxx1z_status.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
+<html>
+<head>
+  <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <title>libc++ C++1Z Status</title>
+  <link type="text/css" rel="stylesheet" href="menu.css">
+  <link type="text/css" rel="stylesheet" href="content.css">
+</head>
+
+<body>
+<div id="menu">
+  <div>
+    <a href="http://llvm.org/">LLVM Home</a>
+  </div>
+
+  <div class="submenu">
+    <label>libc++ Info</label>
+    <a href="/index.html">About</a>
+  </div>
+
+  <div class="submenu">
+    <label>Quick Links</label>
+    <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">cfe-dev</a>
+    <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">cfe-commits</a>
+    <a href="http://llvm.org/bugs/">Bug Reports</a>
+    <a href="http://llvm.org/svn/llvm-project/libcxx/trunk/">Browse SVN</a>
+    <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/">Browse ViewVC</a>
+  </div>
+</div>
+
+<div id="content">
+  <!--*********************************************************************-->
+  <h1>libc++ C++1z Status</h1>
+  <!--*********************************************************************-->
+
+  <p>In November 2014, the C++ standard committee created a draft for the next version of the C++ standard, known here as "C++1z" (probably to be C++17)</p>
+  <p>This page shows the status of libc++; the status of clang's support of the language features is <a href="http://clang.llvm.org/cxx_status.html#cxx17">here</a>.</p>
+
+  <p>The groups that have contributed papers:
+  <ul>
+    <li>LWG - Library working group</li>
+    <li>CWG - Core Language Working group</li>
+    <li>SG1 - Study group #1 (Concurrency working group)</li>
+  </ul>
+  </p>
+  
+  <h3>Paper Status</h3>
+  <table id="papers" border="1">
+	<tr><th>Paper #</th><th>Group</th><th>Paper Name</th><th>Meeting</th><th>Status</th><th>First released version</th></tr>
+<!--
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3346.pdf">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><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3911">N3911</a></td><td>LWG</td></td><td>TransformationTrait Alias <code>void_t</code>.</td><td>Urbana</td><td>Complete</td><td>3.6</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4089">N4089</a></td><td>LWG</td></td><td>Safe conversions in <code>unique_ptr&lt;T[]&gt;</code>.</td><td>Urbana</td><td></td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4169">N4169</a></td><td>LWG</td></td><td>A proposal to add invoke function template</td><td>Urbana</td><td></td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190">N4190</a></td></td><td>LWG</td><td>Removing auto_ptr, random_shuffle(), And Old <functional> Stuff.</td><td>Urbana</td><td></td><td></td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4258.pdf">N4258</a></td><td>LWG</td></td><td>Cleaning-up noexcept in the Library.</td><td>Urbana</td><td></td><td></td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/N4277.html">N4277</a></td><td>LWG</td></td><td>TriviallyCopyable <code>reference_wrapper</code>.</td><td>Urbana</td><td>Complete</td><td>3.2</td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4279.html">N4279</a></td><td>LWG</td></td><td>Improved insertion interface for unique-key maps.</td><td>Urbana</td><td></td><td></td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4280.pdf">N4280</a></td><td>LWG</td></td><td>Non-member size() and more</td><td>Urbana</td><td>Complete</td><td>3.6</td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4284.html">N4284</a></td><td>LWG</td></td><td>Contiguous Iterators.</td><td>Urbana</td><td></td><td></td></tr>
+
+<!--  	<tr><td></td><td></td><td></td><td></td><td></td><td></td></tr> -->
+  </table>
+
+  <h3>Library Working group Issues Status</h3>
+<!--   <I>Note: "NAD" means that the issue was deemed "Not a defect"</I> -->
+  <table id="issues" border="1">
+	<tr><th>Issue #</th><th>Issue Name</th><th>Meeting</th><th>Status</th></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2016">2016</a></td><td>Allocators must be no-throw swappable</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2376">2118</td><td><code>unique_ptr</code> for array does not support cv qualification conversion of actual argument</td><td>Urbana</td><td>Will be resolved by N4089</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2170">2170</a></td><td>Aggregates cannot be <code>DefaultConstructible</code></td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2387">2308</td><td>Clarify container destructor requirements w.r.t. <code>std::array</code></td><td>Urbana</td><td>Will be resolved by N4258</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2340">2340</a></td><td>Replacement allocation functions declared as inline</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2354">2354</a></td><td>Unnecessary copying when inserting into maps with braced-init syntax</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2377">2377</a></td><td><code>std::align</code> requirements overly strict</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2396">2396</a></td><td><code>underlying_type</code> doesn't say what to do for an incomplete enumeration type</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2399">2399</a></td><td><code>shared_ptr</code>'s constructor from <code>unique_ptr</code> should be constrained</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2400">2400</a></td><td><code>shared_ptr</code>'s <code>get_deleter()</code> should use <code>addressof()</code></td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2401">2401</a></td><td><code>std::function</code> needs more noexcept</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2404">2404</a></td><td><code>mismatch()</code>'s complexity needs to be updated</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2408">2408</a></td><td>SFINAE-friendly <code>common_type</code> / <code>iterator_traits</code> is missing in C++14</td><td>Urbana</td><td></td></tr>
+ 	<tr><td></td><td></td><td></td><td></td></tr>
+
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2106">2106</td><td><code>move_iterator</code> wrapping iterators returning prvalues</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2129">2129</td><td>User specializations of <code>std::initializer_list</code></td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2212">2212</td><td><code>tuple_size</code> for <code>const pair</code> request <tuple> header</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2217">2217</td><td><code>operator==(sub_match, string)</code> slices on embedded '\0's</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2230">2230</td><td>"see below" for <code>initializer_list</code> constructors of unordered containers</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2233">2233</td><td><code>bad_function_call::what()</code> unhelpful</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2266">2266</td><td><code>vector</code> and <code>deque</code> have incorrect insert requirements</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2325">2325</td><td><code>minmax_element()</code>'s behavior differing from <code>max_element()</code>'s should be noted</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2361">2361</td><td>Apply 2299 resolution throughout library</td><td>Urbana</td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2365">2365</td><td>Missing noexcept in <code>shared_ptr::shared_ptr(nullptr_t)</code></td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2376">2376</td><td><code>bad_weak_ptr::what()</code> overspecified</td><td>Urbana</td><td>Complete</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2387">2387</td><td>More nested types that must be accessible and unambiguous</td><td>Urbana</td><td></td></tr>
+<!--
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#1214">1214</a></td><td>Insufficient/inconsistent key immutability requirements for associative containers</td><td>Urbana</td><td></td></tr>
+-->
+<!-- 	<tr><td></td><td></td><td></td><td></td></tr> -->
+  </table>
+
+  <p>Last Updated: 18-Nov-2014</p>
+</div>
+</body>
+</html>
diff --git a/www/index.html b/www/index.html
index c1f3aa5..2052ad6 100644
--- a/www/index.html
+++ b/www/index.html
@@ -126,6 +126,8 @@
    <p>LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.</p>
    <p>libc++ is also a 100% complete C++14 implementation. A list of new features and changes for 
       C++14 can be found <a href="cxx1y_status.html">here</a>.</p>
+   <p>A list of features and changes for the next C++ standard, known here as
+      "C++1z" (probably to be C++17) can be found <a href="cxx1z_status.html">here</a>.</p>
    <p>Implementation of the post-c++14 Technical Specifications is in progress. A list of features and
       the current status of these features can be found <a href="ts1z_status.html">here</a>.</p>
    <p>
@@ -134,6 +136,25 @@
    and <a href="results.Linux.html">Linux</a>.
    </p>
 
+   <!--======================================================================-->
+   <h2 id="dir-structure">Build Bots</h2>
+   <!--======================================================================-->
+   <p>These are the libc++ build bots</p>
+   <ul>
+      <li><a href="http://llvm-amd64.freebsd.your.org/b/builders/libcxx-amd64-freebsd">
+        clang-libcxxrt-x86_64-freebsd10
+      </a></li>
+      <li><a href="http://llvm-amd64.freebsd.your.org/b/builders/libcxx-i386-freebsd">
+        clang-libcxxrt-i386-freebsd10
+      </a></li>
+      <li><a href="http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-debian">
+        clang-libcxxabi-x86_64-linux-debian
+      </a></li>
+      <li><a href="http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu">
+        clang-libcxxabi-x86_64-linux-ubuntu
+      </a></li>
+    </ul>
+
   <!--=====================================================================-->
   <h2>Get it and get involved!</h2>
   <!--=====================================================================-->
@@ -415,6 +436,37 @@
   </p>
 
   <!--=====================================================================-->
+  <h2 id="local-abi">Using a local ABI library</h2>
+  <!--=====================================================================-->
+  <p>
+    <strong>Note: This is not recommended in almost all cases.</strong><br>
+    Generally these instructions should only be used when you can't install
+    your ABI library.
+  </p>
+  <p>
+    Normally you must link libc++ against a ABI shared library that the
+    linker can find.  If you want to build and test libc++ against an ABI
+    library not in the linker's path you need to set
+    <code>-DLIBCXX_CXX_ABI_LIBRARY_PATH=/path/to/abi/lib</code> when
+    configuring CMake.
+  </p>
+  <p>
+    An example build using libc++abi would look like:
+    <ul>
+    <li><code>CC=clang CXX=clang++ cmake
+              -DLIBCXX_CXX_ABI=libc++abi
+              -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="/path/to/libcxxabi/include"
+              -DLIBCXX_CXX_ABI_LIBRARY_PATH="/path/to/libcxxabi-build/lib"
+              path/to/libcxx</code></li>
+    <li><code>make</code></li>
+    </ul>
+  </p>
+  <p>
+    When testing libc++ LIT will automatically link against the proper ABI
+    library.
+  </p>
+
+  <!--=====================================================================-->
   <h2>Design Documents</h2>
   <!--=====================================================================-->
 
diff --git a/www/results.Linux.html b/www/results.Linux.html
index 84b612c..82416a3 100644
--- a/www/results.Linux.html
+++ b/www/results.Linux.html
@@ -5,13 +5,12 @@
 </head>
 <body>
 <pre>
-
 All failures in the libc++ test suite will be documented here.
 Note: glibc >= 2.16 is required for full C11 compatibility.
 
 Test Suite Run Information:
-Date: 7/31/2014
-Compiler: Clang Tip-of-Tree (r214433), Built 7/31/2014
+Date: 8/18/2014
+Compiler: Clang Tip-of-Tree (r215809)
 ABI: libc++abi
 C Library: eglibc 2.19
 Platform: x86_64-linux-gnu
@@ -19,84 +18,496 @@
 Distribution: Ubuntu 14.04
 Run By: Eric Fiselier (eric at efcs dot ca)
 
-depr/
- depr.c.headers/
-  math_h.pass.cpp: Fails a static assert that the return type of
-   isnan(double) and isinf(double) is a bool. see PR18382.
-input.output/
- iostream.format/
-  ext.manip/
-   get_time.pass.cpp: Local representation is 'Sat 31 Dec 2061
-    11:55:59 PM EST' which does not match the expected result in the
-    test.
-   put_time.pass.cpp: idem.
-localization/
- locale.categories/
-  category.collate/
-   locale.collate.byname/
-    compare.pass.cpp: In the C local, sorting order seems OK, but not
-     in the &quot&quot and en UTF8 locals. Needs investigation.
-  category.ctype/
-   locale.ctype.byname/
-    tolower_1.pass.cpp: Needs Investigation.
-    tolower_many.pass.cpp: idem.
-    toupper_1.pass.cpp: idem.
-    toupper_many.pass.cpp: idem.
-    widen_1.pass.cpp: idem.
-    widen_many.pass.cpp: idem.
-  category.monetary/
-   locale.money.get/
-    locale.money.get.members/
-     get_long_double_ru_RU.pass.cpp: Needs investigation.
-     get_long_double_zh_CN.pass.cpp: idem.
-    locale.money.put.members/
-     put_long_double_ru_RU.pass.cpp: idem.
-     put_long_double_zh_CN.pass.cpp: idem.
-   locale.moneypunct.byname/
-    decimal_point.pass.cpp: Expects ',' for RU, but gets '.'.
-    thousands_sep.pass.cpp: idem.
-  category.numeric/
-   locale.nm.put/
-    facet.num.put.members/
-     put_long_double.pass.cpp: Fails due to getting '+nan' rather
-      than just 'nan'.
-  category.time/
-   locale.time.get.byname/
-    get_date.pass.cpp: Needs investigation.
-    get_date_wide.pass.cpp: idem.
-    get_one.pass.cpp: idem.
-    get_one_wide.pass.cpp: idem.
-    get_weekday.pass.cpp: idem.
-    get_weekday_wide.pass.cpp: idem.
-   locale.time.put.byname/
-    put1.pass.cpp: idem.
-   locale.time.put/
-    locale.time.put.members/
-     put2.pass.cpp: idem.
-  facet.numpunct/
-   locale.numpunct.byname/
-    grouping.pass.cpp: idem.
-    thousands_sep.pass.cpp: idem.
-numerics/
- c.math/
-  cmath.pass.cpp: Fails for same reason as depr/depr.c.headers/math_h.pass.cpp
-re/
- re.alg/
-  re.alg.match/
-   basic.pass.cpp: Needs investigation.
-   ecma.pass.cpp: idem.
-   extended.pass.cpp: idem.
-  re.alg.search/
-   awk.pass.cpp: idem.
-   basic.pass.cpp: idem.
-   ecma.pass.cpp: idem.
-   extended.pass.cpp: idem.
- re.traits/
-  lookup_collatename.pass.cpp: idem.
-strings/
- c.strings/
-  cuchar.pass.cpp: Can't find cuchar header
-  version_cuchar.pass.cpp: idem.
+
+Testing Time: 1187.82s
+********************
+Failing Tests (33):
+    libc++ :: localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
+        - GLIBC's locales collate strings differently. Needs investigation.
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+        - Needs Investigation.
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+        - Idem
+    libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+        - Idem
+    libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+        - Differences in GLIBC locales. Needs investigation.
+    libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
+        - Differences in GLIBC locales. Puts '-' before 'CNY' as opposed to after.
+    libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+        - Differences in GLIBC locales. Needs investigation.
+    libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
+        - Differences in GLIBC locales. Puts '-' before 'CNY' as opposed to after.
+    libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
+        - Expects ',' for ru_RU but gets '.'.
+    libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
+        - Expects ',' for ru_RU but gets '.'.
+    libc++ :: localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+        - GLIBC puts "+nan" where "nan" is expected.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
+        - GLIBC has different locale data for fr_FR, ru_RU and zh_CN.
+          The is also a possible bug in zh_CN tests. Needs investigation.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
+        - Some test cases are non-portible with GLIBC (include time zone).
+          Other failures related to GLIBC locale data. Needs investigation.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
+        - GLIBC starts weekdays with lowercase letters. Test case expectes upper case.
+    libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
+        - Idem.
+    libc++ :: localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
+        - GLIBC abbreviated days end with '.'. Test case expects no '.'.
+    libc++ :: localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
+        - Needs investigation.
+    libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+        - Fails due to differences in GLIBC locales
+    libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
+        - Fails due to differences in GLIBC locales
+    libc++ :: re/re.alg/re.alg.match/basic.pass.cpp
+        - Needs investigation.
+    libc++ :: re/re.alg/re.alg.match/ecma.pass.cpp
+        - Idem.
+    libc++ :: re/re.alg/re.alg.match/extended.pass.cpp
+        - Idem.
+    libc++ :: re/re.alg/re.alg.search/awk.pass.cpp
+        - Idem.
+    libc++ :: re/re.alg/re.alg.search/basic.pass.cpp
+        - Idem.
+    libc++ :: re/re.alg/re.alg.search/ecma.pass.cpp
+        - Idem.
+    libc++ :: re/re.alg/re.alg.search/extended.pass.cpp
+        - Idem.
+    libc++ :: re/re.traits/lookup_collatename.pass.cpp
+        - Idem.
+    libc++ :: re/re.traits/translate_nocase.pass.cpp
+        - Idem.
+
+********************
+Expected Failing Tests (5):
+    libc++ :: depr/depr.c.headers/math_h.pass.cpp
+        - Fails a static assert that the return type of
+          isnan(double) and isinf(double) is a bool. see PR18382.
+    libc++ :: numerics/c.math/cmath_isinf.pass.cpp
+        - Idem.
+    libc++ :: numerics/c.math/cmath_isnan.pass.cpp
+        - Idem.
+    libc++ :: strings/c.strings/cuchar.pass.cpp
+        - &lt;cuchar&gt; is not implemented.
+    libc++ :: strings/c.strings/version_cuchar.pass.cpp
+        - Idem.
+
+  Expected Passes    : 4716
+  Expected Failures  : 5
+  Unexpected Failures: 33
+
+********************************************************************************
+
+-- Testing: 4754 tests, 2 threads --
+FAIL: libc++ :: localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp (2073 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp4DtKocexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp4DtKocexe'
+Exit Code: -6
+Standard Error:
+--
+tmp4DtKocexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp:38: int main(): Assertion `f.compare(s2.data(), s2.data() + s2.size(), s3.data(), s3.data() + s3.size()) == 1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp (2152 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpAfkClkexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpAfkClkexe'
+Exit Code: -6
+Standard Error:
+--
+tmpAfkClkexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp:38: int main(): Assertion `f.tolower('\xDA') == '\xFA'' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp (2153 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpGjakKeexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpGjakKeexe'
+Exit Code: -6
+Standard Error:
+--
+tmpGjakKeexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp:35: int main(): Assertion `in[0] == '\xFA'' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp (2154 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp0gK3Y6exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp0gK3Y6exe'
+Exit Code: -6
+Standard Error:
+--
+tmp0gK3Y6exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp:39: int main(): Assertion `f.toupper('\xFA') == '\xDA'' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp (2155 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpCoF624exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpCoF624exe'
+Exit Code: -6
+Standard Error:
+--
+tmpCoF624exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp:35: int main(): Assertion `in[0] == '\xDA'' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp (2157 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpjOo8fnexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpjOo8fnexe'
+Exit Code: -6
+Standard Error:
+--
+tmpjOo8fnexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp:53: int main(): Assertion `f.widen(char(-5)) == wchar_t(251)' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp (2158 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpDWZ5aNexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpDWZ5aNexe'
+Exit Code: -6
+Standard Error:
+--
+tmpDWZ5aNexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp:60: int main(): Assertion `v[6] == wchar_t(133)' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp (2184 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpfA5HOrexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpfA5HOrexe'
+Exit Code: -6
+Standard Error:
+--
+tmpfA5HOrexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp:71: int main(): Assertion `iter.base() == v.data() + v.size()' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp (2185 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpTI59qtexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpTI59qtexe'
+Exit Code: -6
+Standard Error:
+--
+tmpTI59qtexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp:314: int main(): Assertion `iter.base() == v.data() + v.size()' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp (2192 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp1psSk2exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp1psSk2exe'
+Exit Code: -6
+Standard Error:
+--
+tmp1psSk2exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp:70: int main(): Assertion `ex == "0,00 "' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp (2193 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpKwjbrPexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpKwjbrPexe'
+Exit Code: -6
+Standard Error:
+--
+tmpKwjbrPexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp:218: int main(): Assertion `ex == "CNY -0.01"' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp (2198 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp4UnNQ2exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp4UnNQ2exe'
+Exit Code: -6
+Standard Error:
+--
+tmp4UnNQ2exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp:114: int main(): Assertion `f.decimal_point() == ','' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp (2205 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp6MGZAmexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp6MGZAmexe'
+Exit Code: -6
+Standard Error:
+--
+tmp6MGZAmexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp:114: int main(): Assertion `f.thousands_sep() == ' '' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp (2229 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp7AME77exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp7AME77exe'
+Exit Code: -6
+Standard Error:
+--
+tmp7AME77exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp:10886: void test5(): Assertion `ex == "nan"' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp (2249 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpooRjFgexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpooRjFgexe'
+Exit Code: -6
+Standard Error:
+--
+tmpooRjFgexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp:64: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp (2250 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpcm_vb9exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpcm_vb9exe'
+Exit Code: -6
+Standard Error:
+--
+tmpcm_vb9exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp:64: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp (2253 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpLKJQXHexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpLKJQXHexe'
+Exit Code: -6
+Standard Error:
+--
+tmpLKJQXHexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp:51: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp (2254 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpiDgYiqexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpiDgYiqexe'
+Exit Code: -6
+Standard Error:
+--
+tmpiDgYiqexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp:51: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp (2257 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpAUaH78exe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpAUaH78exe'
+Exit Code: -6
+Standard Error:
+--
+tmpAUaH78exe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp:74: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp (2258 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp7iGNTDexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp7iGNTDexe'
+Exit Code: -6
+Standard Error:
+--
+tmp7iGNTDexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp:72: int main(): Assertion `i.base() == in+sizeof(in)/sizeof(in[0])-1' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp (2277 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpnT0vVFexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpnT0vVFexe'
+Exit Code: -6
+Standard Error:
+--
+tmpnT0vVFexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp:73: int main(): Assertion `(ex == "Today is Samedi which is abbreviated Sam.")|| (ex == "Today is samedi which is abbreviated sam." )' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp (2281 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp47THCHexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp47THCHexe'
+Exit Code: -6
+Standard Error:
+--
+tmp47THCHexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp:185: int main(): Assertion `ex == "May"' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp (2285 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpn6fLHJexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpn6fLHJexe'
+Exit Code: -6
+Standard Error:
+--
+tmpn6fLHJexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp:57: int main(): Assertion `np.grouping() == "\x7F"' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp (2286 of 4754)
+******************** TEST 'libc++ :: localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpkna8llexe' '/home/eric/workspace/staging-libcxx/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpkna8llexe'
+Exit Code: -6
+Standard Error:
+--
+tmpkna8llexe: /home/eric/workspace/staging-libcxx/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp:57: int main(): Assertion `np.thousands_sep() == ','' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.match/basic.pass.cpp (3203 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.match/basic.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmp0wkTrlexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/basic.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmp0wkTrlexe'
+Exit Code: -6
+Standard Error:
+--
+tmp0wkTrlexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/basic.pass.cpp:624: int main(): Assertion `std::regex_match(s, m, std::regex("[a[=M=]z]", std::regex_constants::basic))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.match/ecma.pass.cpp (3204 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.match/ecma.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpghcl7yexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/ecma.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpghcl7yexe'
+Exit Code: -6
+Standard Error:
+--
+tmpghcl7yexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/ecma.pass.cpp:585: int main(): Assertion `std::regex_match(s, m, std::regex("[a[=M=]z]"))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.match/extended.pass.cpp (3208 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.match/extended.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpGVUdIMexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/extended.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpGVUdIMexe'
+Exit Code: -6
+Standard Error:
+--
+tmpGVUdIMexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.match/extended.pass.cpp:622: int main(): Assertion `std::regex_match(s, m, std::regex("[a[=M=]z]", std::regex_constants::extended))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.search/awk.pass.cpp (3218 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.search/awk.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpgFuw4cexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/awk.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpgFuw4cexe'
+Exit Code: -6
+Standard Error:
+--
+tmpgFuw4cexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/awk.pass.cpp:694: int main(): Assertion `std::regex_search(s, m, std::regex("[a[=M=]z]", std::regex_constants::awk))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.search/basic.pass.cpp (3219 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.search/basic.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpXeQuwGexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpXeQuwGexe'
+Exit Code: -6
+Standard Error:
+--
+tmpXeQuwGexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/basic.pass.cpp:696: int main(): Assertion `std::regex_search(s, m, std::regex("[a[=M=]z]", std::regex_constants::basic))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.search/ecma.pass.cpp (3220 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.search/ecma.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpvGAAImexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpvGAAImexe'
+Exit Code: -6
+Standard Error:
+--
+tmpvGAAImexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/ecma.pass.cpp:675: int main(): Assertion `std::regex_search(s, m, std::regex("[a[=M=]z]"))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.alg/re.alg.search/extended.pass.cpp (3224 of 4754)
+******************** TEST 'libc++ :: re/re.alg/re.alg.search/extended.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpGvouurexe' '/home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/extended.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpGvouurexe'
+Exit Code: -6
+Standard Error:
+--
+tmpGvouurexe: /home/eric/workspace/staging-libcxx/test/re/re.alg/re.alg.search/extended.pass.cpp:694: int main(): Assertion `std::regex_search(s, m, std::regex("[a[=M=]z]", std::regex_constants::extended))' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.traits/lookup_collatename.pass.cpp (3349 of 4754)
+******************** TEST 'libc++ :: re/re.traits/lookup_collatename.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpItXmtJexe' '/home/eric/workspace/staging-libcxx/test/re/re.traits/lookup_collatename.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpItXmtJexe'
+Exit Code: -6
+Standard Error:
+--
+tmpItXmtJexe: /home/eric/workspace/staging-libcxx/test/re/re.traits/lookup_collatename.pass.cpp:31: void test(const char_type *, const std::basic_string<char_type> &) [char_type = char]: Assertion `t.lookup_collatename(F(A), F(A + t.length(A))) == expected' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
+FAIL: libc++ :: re/re.traits/translate_nocase.pass.cpp (3354 of 4754)
+******************** TEST 'libc++ :: re/re.traits/translate_nocase.pass.cpp' FAILED ********************
+Compiled With: '/opt/llvm-tot/bin/clang++' '-o' '/tmp/tmpGsRNu3exe' '/home/eric/workspace/staging-libcxx/test/re/re.traits/translate_nocase.pass.cpp' '-nostdinc++' '-std=c++11' '-D__STDC_FORMAT_MACROS' '-D__STDC_LIMIT_MACROS' '-D__STDC_CONSTANT_MACROS' '-I/home/eric/workspace/staging-libcxx/test/../include' '-I/home/eric/workspace/staging-libcxx/test/../test/support' '-nodefaultlibs' '-L/home/eric/workspace/build-libcxx-staging/lib' '-lc++' '-lc++abi' '-lgcc_eh' '-lc' '-lm' '-lpthread' '-lrt' '-lgcc_s' '-Wl,-R' '/home/eric/workspace/build-libcxx-staging/lib'
+Command: '/tmp/tmpGsRNu3exe'
+Exit Code: -6
+Standard Error:
+--
+tmpGsRNu3exe: /home/eric/workspace/staging-libcxx/test/re/re.traits/translate_nocase.pass.cpp:44: int main(): Assertion `t.translate_nocase('\xDA') == '\xFA'' failed.
+--
+
+Compiled test failed unexpectedly!
+********************
 </pre>
 </body>
 </html>
diff --git a/www/ts1z_status.html b/www/ts1z_status.html
index 3a15770..95880b9 100644
--- a/www/ts1z_status.html
+++ b/www/ts1z_status.html
@@ -41,14 +41,21 @@
 
   <h3>Technical Specifications</h3>
   <table id="TS" border="1">
-	<tr><th>Paper Number</th><th>TS Title</th></tr>
+	<tr><th>Paper Number</th><th>Paper Title</th><th>TS</th></tr>
 
-	<tr><td>4023</td><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4023.html">C++ Extensions for Library Fundamentals</a></td></tr>
-	<tr><td>3940</td><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html">Technical Specification - File System</a></td></tr>
-	<tr><td></td><td></td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4023.html">4023</a></td><td>C++ Extensions for Library Fundamentals</td><td>Library Fundamentals 1</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3940.html">3940</a></td><td>Technical Specification - File System</td><td>File System</td></tr>
+	<tr><td></td><td></td><td></td></tr>
+
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/n4273.txt">4273</a></td><td>Uniform Container Erasure.</td><td>Library Fundamentals 2</td></tr>
+	<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4061">4061</a></td><td>Greatest Common Divisor and Least Common Multiple.</td><td>Library Fundamentals 2</td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/N4257.htm">4257</a></td><td>Delimited iterators.</td><td>Library Fundamentals 2</td></tr>
+	<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21urbana-champaign/StrawPolls/N4282.pdf">4282</a></td><td>The World's Dumbest Smart Pointer.</td><td>Library Fundamentals 2</td></tr>
+	<tr><td></td><td></td><td></td></tr>
+
   </table>
 
-  <h3>Features in Library Fundamentals</h3>
+  <h3>Features in Library Fundamentals 1</h3>
   <table id="Features" border="1">
 	<tr><th>Feature Name</th><th>Status</th></tr>
 	<tr><td>Uses-allocator construction</td><td>Not started</td></tr>
@@ -76,6 +83,13 @@
 
   </table>
 
+  <h3>Features in Library Fundamentals 2</h3>
+  <table id="Features" border="1">
+	<tr><th>Feature Name</th><th>Status</th></tr>
+<!--  <tr><td></td><td></td></tr> -->
+
+  </table>
+  
   <h3>Features in Filesystem</h3>
   <table id="Features" border="1">
 	<tr><th>Feature Name</th><th>Status</th></tr>