diff --git a/CMakeLists.txt b/CMakeLists.txt index dd36b6163..27a26f8cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,14 +40,27 @@ option(LIBCXX_ENABLE_RTTI "Use run time type information." ON) 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 DEFINED LIBCXX_CXX_ABI) - set(LIBCXX_CXX_ABI "none") -endif() +if (NOT LIBCXX_CXX_ABI) + if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND + IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi") + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_LIBCXXABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include") + set(LIBCXX_CXX_ABI_INTREE 1) + else () + set(LIBCXX_CXX_ABI_LIBNAME "none") + endif () +else () + set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") +endif () set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING "Specify C++ ABI library to use." FORCE) set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS}) @@ -90,16 +103,17 @@ set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.") macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs) list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines}) set(${abipathvar} "${${abipathvar}}" - CACHE STRINGS - "Paths to ABI include directories separate by ';'." + 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() - set(LIBCXX_ABILIB_FILE_PATHS) + foreach(fpath ${LIBCXX_ABILIB_FILES}) set(found FALSE) foreach(incpath ${${abipathvar}}) @@ -107,39 +121,33 @@ macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs) set(found TRUE) get_filename_component(dstdir ${fpath} PATH) get_filename_component(ifile ${fpath} NAME) - add_custom_command( - OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}" - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${incpath}/${fpath}" - "${CMAKE_BINARY_DIR}/include/${dstdir}" - MAIN_DEPENDENCY "${incpath}/${fpath}" - ) - list(APPEND LIBCXX_CXX_ABI_DEPS - "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}" + 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(abilib_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS}) - set(LIBCXX_CXX_ABI_DEPS abilib_headers) + + add_custom_target(LIBCXX_CXX_ABI_DEPS DEPENDS ${abilib_headers}) include_directories("${CMAKE_BINARY_DIR}/include") - install(DIRECTORY "${CMAKE_BINARY_DIR}/include/" + + install(FILES ${abilib_headers} DESTINATION include/c++/v1 - FILES_MATCHING - PATTERN "*" + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) endmacro() -if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR - "${LIBCXX_CXX_ABI}" STREQUAL "libsupc++") +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}" STREQUAL "libstdc++") + if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++") set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX") set(_LIBSUPCXX_LIBNAME stdc++) else() @@ -150,15 +158,22 @@ if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR "-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}" "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits" ) -elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi") +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" "" - "c++abi" "cxxabi.h" "" + ${CXXABI_LIBNAME} "cxxabi.h" "" ) -elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt") +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}" STREQUAL "none") +elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none") message(FATAL_ERROR "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are " "supported for c++ abi." @@ -181,10 +196,25 @@ if (MSVC) else() if (LIBCXX_HAS_NOSTDINCXX_FLAG) list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++) + string(REPLACE "-stdlib=libc++" "" 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_REQUIRED_FLAGS "-std=${LIBCXX_STD_VERSION}") endif() macro(append_if list condition var) @@ -259,6 +289,29 @@ if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() +# 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_FEATURE_FLAGS LIBCXX_HAS_NO_OMIT_FRAME_POINTER_FLAG + "-fno-omit-frame-pointer") + if (LLVM_USE_SANITIZER STREQUAL "Address") + list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize=address") + elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?") + list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize=memory") + if (LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins") + list(APPEND LIBCXX_CXX_FEATURE_FLAGS "-fsanitize-memory-track-origins") + endif() + 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_REQUIRED_FLAGS "${LIBCXX_CXX_REQUIRED_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXX_CXX_REQUIRED_FLAGS}") diff --git a/CREDITS.TXT b/CREDITS.TXT index 368b526fc..7a28adae0 100644 --- a/CREDITS.TXT +++ b/CREDITS.TXT @@ -33,6 +33,10 @@ E: mclow.lists@gmail.com 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/config-ix.cmake b/cmake/config-ix.cmake index e8adafd65..2596787a3 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -2,26 +2,28 @@ include(CheckLibraryExists) 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_NO_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(/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 0c88b7f23..bbf7ea42b 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -2,15 +2,12 @@ if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS) set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE) endif() -file(COPY . - DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1" +install(DIRECTORY . + DESTINATION include/c++/v1 FILES_MATCHING PATTERN "*" PATTERN "CMakeLists.txt" EXCLUDE PATTERN ".svn" EXCLUDE ${LIBCXX_SUPPORT_HEADER_PATTERN} - ) - -install(DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/" - DESTINATION include/c++/v1/ + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ ) diff --git a/include/__bit_reference b/include/__bit_reference index 37b792371..d9ebfbe5e 100644 --- a/include/__bit_reference +++ b/include/__bit_reference @@ -174,7 +174,7 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type if (__b) return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); if (__n == __dn) - return _It(__first.__seg_, __first.__ctz_ + __n); + return __first + __n; __n -= __dn; ++__first.__seg_; } @@ -210,7 +210,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type if (__b) return _It(__first.__seg_, static_cast(_VSTD::__ctz(__b))); if (__n == __dn) - return _It(__first.__seg_, __first.__ctz_ + __n); + return __first + __n; __n -= __dn; ++__first.__seg_; } diff --git a/include/__config b/include/__config index e1c5a67a9..d20aecb67 100644 --- a/include/__config +++ b/include/__config @@ -313,6 +313,10 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_CONSTEXPR #endif +#if !(__has_feature(cxx_relaxed_constexpr)) +#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR +#endif + #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L #if defined(__FreeBSD__) #define _LIBCPP_HAS_QUICK_EXIT @@ -341,7 +345,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(underlying_type) -# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) +# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#endif + +#if __has_feature(is_literal) +# define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. @@ -354,6 +362,10 @@ namespace std { } } +#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) +#define _LIBCPP_HAS_NO_ASAN +#endif + #elif defined(__GNUC__) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -361,12 +373,27 @@ namespace std { #define _LIBCPP_NORETURN __attribute__((noreturn)) +#if _GNUC_VER >= 407 +#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) +#endif + #if !__EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS #endif #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES + +// constexpr was added to GCC in 4.6. +#if _GNUC_VER < 406 #define _LIBCPP_HAS_NO_CONSTEXPR +// Can only use constexpr in c++11 mode. +#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L +#define _LIBCPP_HAS_NO_CONSTEXPR +#endif + +// No version of GCC supports relaxed constexpr rules +#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _NOEXCEPT throw() #define _NOEXCEPT_(x) @@ -428,11 +455,16 @@ namespace _LIBCPP_NAMESPACE { using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); } +#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) +#define _LIBCPP_HAS_NO_ASAN +#endif + #elif defined(_LIBCPP_MSVC) #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_HAS_NO_CONSTEXPR +#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS @@ -453,6 +485,8 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); namespace std { } +#define _LIBCPP_HAS_NO_ASAN + #elif defined(__IBMCPP__) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -485,6 +519,8 @@ namespace std { } } +#define _LIBCPP_HAS_NO_ASAN + #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS @@ -533,12 +569,20 @@ template struct __static_assert_check {}; #define __has_feature(__x) 0 #endif +#ifndef __has_builtin +#define __has_builtin(__x) 0 +#endif + #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) # define _LIBCPP_EXPLICIT explicit #else # define _LIBCPP_EXPLICIT #endif +#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) +# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE +#endif + #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ @@ -579,7 +623,7 @@ template struct __static_assert_check {}; #define _LIBCPP_LOCALE__L_EXTENSIONS 1 #endif -#if defined(__FreeBSD__) +#ifdef __FreeBSD__ #define _DECLARE_C99_LDBL_MATH 1 #endif @@ -598,8 +642,10 @@ template struct __static_assert_check {}; #ifndef _LIBCPP_STD_VER # if __cplusplus <= 201103L # define _LIBCPP_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCPP_STD_VER 14 # else -# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification +# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification # endif #endif // _LIBCPP_STD_VER @@ -610,15 +656,24 @@ template struct __static_assert_check {}; #endif #if _LIBCPP_STD_VER <= 11 -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 #define _LIBCPP_EXPLICIT_AFTER_CXX11 #define _LIBCPP_DEPRECATED_AFTER_CXX11 #else -#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] #endif +#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) +#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr +#else +#define _LIBCPP_CONSTEXPR_AFTER_CXX11 +#endif + +#ifndef _LIBCPP_HAS_NO_ASAN +extern "C" void __sanitizer_annotate_contiguous_container( + const void *, const void *, const void *, const void *); +#endif + // Try to find out if RTTI is disabled. // 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. diff --git a/include/__functional_03 b/include/__functional_03 index 258260173..d8a9f05fa 100644 --- a/include/__functional_03 +++ b/include/__functional_03 @@ -651,9 +651,14 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp()> __base* __f_; template + _LIBCPP_INLINE_VISIBILITY static bool __not_null(const _Fp&) {return true;} template - static bool __not_null(const function<_Rp()>& __p) {return __p;} + _LIBCPP_INLINE_VISIBILITY + static bool __not_null(_R2 (*__p)()) {return __p;} + template + _LIBCPP_INLINE_VISIBILITY + static bool __not_null(const function<_R2()>& __p) {return __p;} public: typedef _Rp result_type; @@ -955,7 +960,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)> static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_Rp(_B0)>& __p) {return __p;} + static bool __not_null(const function<_R2(_B0)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1257,7 +1262,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)> static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_Rp(_B0, _B1)>& __p) {return __p;} + static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1558,7 +1563,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)> static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_Rp(_B0, _B1, _B2)>& __p) {return __p;} + static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;} public: typedef _Rp result_type; @@ -1911,7 +1916,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename __mu_return1::type __mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>) { - __ti(_VSTD::forward::type>(get<_Indx>(__uj))...); + __ti(_VSTD::forward::type>(_VSTD::get<_Indx>(__uj))...); } template @@ -1947,9 +1952,9 @@ __mu(_Ti&, _Uj& __uj) { const size_t _Indx = is_placeholder<_Ti>::value - 1; // compiler bug workaround - typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj); + typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj); return __t; -// return _VSTD::forward::type>(get<_Indx>(__uj)); +// return _VSTD::forward::type>(_VSTD::get<_Indx>(__uj)); } template @@ -2040,7 +2045,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { - return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...); + return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); } template diff --git a/include/__functional_base_03 b/include/__functional_base_03 index f297ee057..22c06add9 100644 --- a/include/__functional_base_03 +++ b/include/__functional_base_03 @@ -1027,7 +1027,7 @@ public: typename __invoke_return0::type operator() (_A0& __a0) const { - return __invoke(get(), __a0); + return __invoke(get(), __a0); } template @@ -1035,7 +1035,7 @@ public: typename __invoke_return1::type operator() (_A0& __a0, _A1& __a1) const { - return __invoke(get(), __a0, __a1); + return __invoke(get(), __a0, __a1); } template @@ -1043,7 +1043,7 @@ public: typename __invoke_return2::type operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return __invoke(get(), __a0, __a1, __a2); } }; diff --git a/include/__sso_allocator b/include/__sso_allocator index 7240072ca..645f2ba17 100644 --- a/include/__sso_allocator +++ b/include/__sso_allocator @@ -55,14 +55,14 @@ public: __allocated_ = true; return (pointer)&buf_; } - return static_cast(::operator new(__n * sizeof(_Tp))); + return static_cast(_VSTD::__allocate(__n * sizeof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) { if (__p == (pointer)&buf_) __allocated_ = false; else - ::operator delete(__p); + _VSTD::__deallocate(__p); } _LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);} diff --git a/include/__tree b/include/__tree index acf87593a..8e5447a2f 100644 --- a/include/__tree +++ b/include/__tree @@ -1980,9 +1980,9 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p) __begin_node() = __r.__ptr_; --size(); __node_allocator& __na = __node_alloc(); - __node_traits::destroy(__na, const_cast(_VSTD::addressof(*__p))); __tree_remove(__end_node()->__left_, static_cast<__node_base_pointer>(__np)); + __node_traits::destroy(__na, const_cast(_VSTD::addressof(*__p))); __node_traits::deallocate(__na, __np, 1); return __r; } diff --git a/include/__tuple b/include/__tuple index de35cb87e..ee5b916fa 100644 --- a/include/__tuple +++ b/include/__tuple @@ -27,6 +27,32 @@ _LIBCPP_BEGIN_NAMESPACE_STD +// __lazy_and + +template +struct __lazy_and_impl; + +template +struct __lazy_and_impl : false_type {}; + +template <> +struct __lazy_and_impl : true_type {}; + +template +struct __lazy_and_impl : integral_constant {}; + +template +struct __lazy_and_impl : __lazy_and_impl<_Hp::type::value, _Tp...> {}; + +template +struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {}; + +// __lazy_not + +template +struct __lazy_not : integral_constant {}; + + template class _LIBCPP_TYPE_VIS_ONLY tuple_size; template diff --git a/include/algorithm b/include/algorithm index 303ec7d7f..1fed6e93b 100644 --- a/include/algorithm +++ b/include/algorithm @@ -4784,49 +4784,8 @@ is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) template void -__push_heap_front(_RandomAccessIterator __first, _RandomAccessIterator, _Compare __comp, - typename iterator_traits<_RandomAccessIterator>::difference_type __len) -{ - typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; - if (__len > 1) - { - difference_type __p = 0; - _RandomAccessIterator __pp = __first; - difference_type __c = 2; - _RandomAccessIterator __cp = __first + __c; - if (__c == __len || __comp(*__cp, *(__cp - 1))) - { - --__c; - --__cp; - } - if (__comp(*__pp, *__cp)) - { - value_type __t(_VSTD::move(*__pp)); - do - { - *__pp = _VSTD::move(*__cp); - __pp = __cp; - __p = __c; - __c = (__p + 1) * 2; - if (__c > __len) - break; - __cp = __first + __c; - if (__c == __len || __comp(*__cp, *(__cp - 1))) - { - --__c; - --__cp; - } - } while (__comp(__t, *__cp)); - *__pp = _VSTD::move(__t); - } - } -} - -template -void -__push_heap_back(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, - typename iterator_traits<_RandomAccessIterator>::difference_type __len) +__sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; @@ -4859,10 +4818,10 @@ push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare #ifdef _LIBCPP_DEBUG typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; __debug_less<_Compare> __c(__comp); - __push_heap_back<_Comp_ref>(__first, __last, __c, __last - __first); + __sift_up<_Comp_ref>(__first, __last, __c, __last - __first); #else // _LIBCPP_DEBUG typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; - __push_heap_back<_Comp_ref>(__first, __last, __comp, __last - __first); + __sift_up<_Comp_ref>(__first, __last, __comp, __last - __first); #endif // _LIBCPP_DEBUG } @@ -4876,6 +4835,60 @@ push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) // pop_heap +template +void +__sift_down(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, + typename iterator_traits<_RandomAccessIterator>::difference_type __len, + _RandomAccessIterator __start) +{ + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; + // left-child of __start is at 2 * __start + 1 + // right-child of __start is at 2 * __start + 2 + difference_type __child = __start - __first; + + if (__len < 2 || (__len - 2) / 2 < __child) + return; + + __child = 2 * __child + 1; + _RandomAccessIterator __child_i = __first + __child; + + if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { + // right-child exists and is greater than left-child + ++__child_i; + ++__child; + } + + // check if we are in heap-order + if (__comp(*__child_i, *__start)) + // we are, __start is larger than it's largest child + return; + + value_type __top(_VSTD::move(*__start)); + do + { + // we are not in heap-order, swap the parent with it's largest child + *__start = _VSTD::move(*__child_i); + __start = __child_i; + + if ((__len - 2) / 2 < __child) + break; + + // recompute the child based off of the updated parent + __child = 2 * __child + 1; + __child_i = __first + __child; + + if ((__child + 1) < __len && __comp(*__child_i, *(__child_i + 1))) { + // right-child exists and is greater than left-child + ++__child_i; + ++__child; + } + + // check if we are in heap-order + } while (!__comp(*__child_i, __top)); + *__start = _VSTD::move(__top); +} + template inline _LIBCPP_INLINE_VISIBILITY void @@ -4885,7 +4898,7 @@ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare if (__len > 1) { swap(*__first, *--__last); - __push_heap_front<_Compare>(__first, __last, __comp, __len-1); + __sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); } } @@ -4922,10 +4935,11 @@ __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar difference_type __n = __last - __first; if (__n > 1) { - __last = __first; - ++__last; - for (difference_type __i = 1; __i < __n;) - __push_heap_back<_Compare>(__first, ++__last, __comp, ++__i); + // start from the first parent, there is no need to consider children + for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) + { + __sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); + } } } @@ -5000,7 +5014,7 @@ __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _R if (__comp(*__i, *__first)) { swap(*__i, *__first); - __push_heap_front<_Compare>(__first, __middle, __comp, __len); + __sift_down<_Compare>(__first, __middle, __comp, __len, __first); } } __sort_heap<_Compare>(__first, __middle, __comp); @@ -5041,15 +5055,15 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last, _RandomAccessIterator __r = __result_first; if (__r != __result_last) { - typename iterator_traits<_RandomAccessIterator>::difference_type __len = 0; - for (; __first != __last && __r != __result_last; ++__first, ++__r, ++__len) + for (; __first != __last && __r != __result_last; ++__first, ++__r) *__r = *__first; __make_heap<_Compare>(__result_first, __r, __comp); + typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; for (; __first != __last; ++__first) if (__comp(*__first, *__result_first)) { *__result_first = *__first; - __push_heap_front<_Compare>(__result_first, __r, __comp, __len); + __sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); } __sort_heap<_Compare>(__result_first, __r, __comp); } diff --git a/include/bitset b/include/bitset index 4cc7dbdae..8c278cc72 100644 --- a/include/bitset +++ b/include/bitset @@ -249,9 +249,9 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR -#if __SIZE_WIDTH__ == 64 +#if __SIZEOF_SIZE_T__ == 8 : __first_{__v} -#elif __SIZE_WIDTH__ == 32 +#elif __SIZEOF_SIZE_T__ == 4 : __first_{__v, __v >> __bits_per_word} #else #error This constructor has not been ported to this platform diff --git a/include/experimental/dynarray b/include/experimental/dynarray index 7c5c9b3f1..0bc8dfe2c 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -38,18 +38,18 @@ class dynarray public: // construct/copy/destroy: explicit dynarray(size_type c); - template - dynarray(size_type c, const Alloc& alloc); dynarray(size_type c, const T& v); - template - dynarray(size_type c, const T& v, const Alloc& alloc); dynarray(const dynarray& d); - template - dynarray(const dynarray& d, const Alloc& alloc); dynarray(initializer_list); - template - dynarray(initializer_list, const Alloc& alloc); + template + dynarray(allocator_arg_t, const Alloc& a, size_type c, const Alloc& alloc); + template + dynarray(allocator_arg_t, const Alloc& a, size_type c, const T& v, const Alloc& alloc); + template + dynarray(allocator_arg_t, const Alloc& a, const dynarray& d, const Alloc& alloc); + template + dynarray(allocator_arg_t, const Alloc& a, initializer_list, const Alloc& alloc); dynarray& operator=(const dynarray&) = delete; ~dynarray(); @@ -147,12 +147,12 @@ private: assert(!"dynarray::allocation"); #endif } - return static_cast (::operator new (sizeof(value_type) * count)); + return static_cast (_VSTD::__allocate (sizeof(value_type) * count)); } static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept { - ::operator delete (static_cast (__ptr)); + _VSTD::__deallocate (static_cast (__ptr)); } public: @@ -163,15 +163,15 @@ public: dynarray(initializer_list); // We're not implementing these right now. -// Waiting for the resolution of LWG issue #2235 +// Updated with the resolution of LWG issue #2255 // template -// dynarray(size_type __c, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c); // template -// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, size_type __c, const value_type& __v); // template -// dynarray(const dynarray& __d, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, const dynarray& __d); // template -// dynarray(initializer_list, const _Alloc& __alloc); +// dynarray(allocator_arg_t, const _Alloc& __alloc, initializer_list); dynarray& operator=(const dynarray&) = delete; ~dynarray(); diff --git a/include/forward_list b/include/forward_list index 72d31dc7e..a83b19520 100644 --- a/include/forward_list +++ b/include/forward_list @@ -1421,6 +1421,7 @@ template void forward_list<_Tp, _Alloc>::remove(const value_type& __v) { + forward_list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing iterator __e = end(); for (iterator __i = before_begin(); __i.__ptr_->__next_ != nullptr;) { @@ -1429,7 +1430,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v) iterator __j = _VSTD::next(__i, 2); for (; __j != __e && *__j == __v; ++__j) ; - erase_after(__i, __j); + __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); if (__j == __e) break; __i = __j; diff --git a/include/functional b/include/functional index 891ed460a..416a9a97f 100644 --- a/include/functional +++ b/include/functional @@ -1421,7 +1421,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)> static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const volatile) {return __p;} template _LIBCPP_INLINE_VISIBILITY - static bool __not_null(const function<_Rp(_Ap...)>& __p) {return __p;} + static bool __not_null(const function<_R2(_Ap...)>& __p) {return !!__p;} template ::value && __invokable<_Fp&, _ArgTypes...>::value> @@ -1617,21 +1617,22 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _ if (__not_null(__f)) { typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF; - if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value) + typedef typename __alloc_traits::template +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + rebind_alloc<_FF> +#else + rebind_alloc<_FF>::other +#endif + _Ap; + _Ap __a(__a0); + if (sizeof(_FF) <= sizeof(__buf_) && + is_nothrow_copy_constructible<_Fp>::value && is_nothrow_copy_constructible<_Ap>::value) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(_VSTD::move(__f)); + ::new (__f_) _FF(_VSTD::move(__f), _Alloc(__a)); } else { - typedef typename __alloc_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind_alloc<_FF> -#else - rebind_alloc<_FF>::other -#endif - _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::move(__f), _Alloc(__a)); @@ -1857,7 +1858,7 @@ inline _LIBCPP_INLINE_VISIBILITY typename __invoke_of<_Ti&, _Uj...>::type __mu_expand(_Ti& __ti, tuple<_Uj...>& __uj, __tuple_indices<_Indx...>) { - return __ti(_VSTD::forward<_Uj>(get<_Indx>(__uj))...); + return __ti(_VSTD::forward<_Uj>(_VSTD::get<_Indx>(__uj))...); } template @@ -1892,7 +1893,7 @@ typename enable_if __mu(_Ti&, _Uj& __uj) { const size_t _Indx = is_placeholder<_Ti>::value - 1; - return _VSTD::forward::type>(get<_Indx>(__uj)); + return _VSTD::forward::type>(_VSTD::get<_Indx>(__uj)); } template @@ -2019,7 +2020,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { - return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...); + return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); } template diff --git a/include/future b/include/future index 73d5456d7..de00f25d7 100644 --- a/include/future +++ b/include/future @@ -1872,7 +1872,7 @@ template __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) { - typedef typename remove_reference<_Fp>::type _FR; + typedef typename remove_reference::type>::type _FR; typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { @@ -1897,7 +1897,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( : __f_(nullptr) { typedef allocator_traits<_Alloc> __alloc_traits; - typedef typename remove_reference<_Fp>::type _FR; + typedef typename remove_reference::type>::type _FR; typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { diff --git a/include/limits b/include/limits index d917c577f..1acf03e30 100644 --- a/include/limits +++ b/include/limits @@ -235,7 +235,7 @@ protected: static _LIBCPP_CONSTEXPR const bool is_iec559 = false; static _LIBCPP_CONSTEXPR const bool is_bounded = true; - static _LIBCPP_CONSTEXPR const bool is_modulo = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value; #if __i386__ || __x86_64__ static _LIBCPP_CONSTEXPR const bool traps = true; @@ -768,7 +768,7 @@ template template _LIBCPP_CONSTEXPR const int numeric_limits::digits10; template - const int numeric_limits::max_digits10; + _LIBCPP_CONSTEXPR const int numeric_limits::max_digits10; template _LIBCPP_CONSTEXPR const bool numeric_limits::is_signed; template diff --git a/include/list b/include/list index 800a1a3f5..c36786dd4 100644 --- a/include/list +++ b/include/list @@ -214,10 +214,13 @@ struct __list_node_base pointer __next_; _LIBCPP_INLINE_VISIBILITY - __list_node_base() - : __prev_(static_cast(pointer_traits<__base_pointer>::pointer_to(*this))), - __next_(static_cast(pointer_traits<__base_pointer>::pointer_to(*this))) - {} + __list_node_base() : __prev_(__self()), __next_(__self()) {} + + _LIBCPP_INLINE_VISIBILITY + pointer __self() + { + return static_cast(pointer_traits<__base_pointer>::pointer_to(*this)); + } }; template @@ -753,20 +756,14 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c) swap(__sz(), __c.__sz()); swap(__end_, __c.__end_); if (__sz() == 0) - __end_.__next_ = __end_.__prev_ = static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_)); + __end_.__next_ = __end_.__prev_ = __end_.__self(); else - __end_.__prev_->__next_ = __end_.__next_->__prev_ - = static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_)); + __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_.__self(); if (__c.__sz() == 0) - __c.__end_.__next_ = __c.__end_.__prev_ - = static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)); + __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_.__self(); else - __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ - = static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)); + __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_.__self(); + #if _LIBCPP_DEBUG_LEVEL >= 2 __libcpp_db* __db = __get_db(); __c_node* __cn1 = __db->__find_c_and_lock(this); @@ -1059,7 +1056,9 @@ public: #endif // _LIBCPP_DEBUG_LEVEL >= 2 private: - static void __link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l); + static void __link_nodes (__node_pointer __p, __node_pointer __f, __node_pointer __l); + void __link_nodes_at_front(__node_pointer __f, __node_pointer __l); + void __link_nodes_at_back (__node_pointer __f, __node_pointer __l); iterator __iterator(size_type __n); template static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp); @@ -1081,6 +1080,31 @@ list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_p __l->__next_ = __p; } +// Link in nodes [__f, __l] at the front of the list +template +inline _LIBCPP_INLINE_VISIBILITY +void +list<_Tp, _Alloc>::__link_nodes_at_front(__node_pointer __f, __node_pointer __l) +{ + __f->__prev_ = base::__end_.__self(); + __l->__next_ = base::__end_.__next_; + __l->__next_->__prev_ = __l; + base::__end_.__next_ = __f; +} + +// Link in nodes [__f, __l] at the front of the list +template +inline _LIBCPP_INLINE_VISIBILITY +void +list<_Tp, _Alloc>::__link_nodes_at_back(__node_pointer __f, __node_pointer __l) +{ + __l->__next_ = base::__end_.__self(); + __f->__prev_ = base::__end_.__prev_; + __f->__prev_->__next_ = __f; + base::__end_.__prev_ = __l; +} + + template inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Alloc>::iterator @@ -1502,7 +1526,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes(base::__end_.__next_, __hold.get(), __hold.get()); + __link_nodes_at_front(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1515,8 +1539,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>:: - pointer_to(base::__end_)), __hold.get(), __hold.get()); + __link_nodes_at_back(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1531,7 +1554,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes(base::__end_.__next_, __hold.get(), __hold.get()); + __link_nodes_at_front(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1544,8 +1567,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>:: - pointer_to(base::__end_)), __hold.get(), __hold.get()); + __link_nodes_at_back(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1561,7 +1583,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_nodes(base::__end_.__next_, __hold.get(), __hold.get()); + __link_nodes_at_front(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1575,8 +1597,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args) typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>:: - pointer_to(base::__end_)), __hold.get(), __hold.get()); + __link_nodes_at_back(__hold.get(), __hold.get()); ++base::__sz(); __hold.release(); } @@ -1826,8 +1847,7 @@ list<_Tp, _Alloc>::resize(size_type __n) throw; } #endif // _LIBCPP_NO_EXCEPTIONS - __link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>:: - pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_); + __link_nodes_at_back(__r.__ptr_, __e.__ptr_); base::__sz() += __ds; } } @@ -2038,14 +2058,18 @@ template void list<_Tp, _Alloc>::remove(const value_type& __x) { - for (iterator __i = begin(), __e = end(); __i != __e;) + list<_Tp, _Alloc> __deleted_nodes; // collect the nodes we're removing + for (const_iterator __i = begin(), __e = end(); __i != __e;) { if (*__i == __x) { - iterator __j = _VSTD::next(__i); + const_iterator __j = _VSTD::next(__i); for (; __j != __e && *__j == __x; ++__j) ; - __i = erase(__i, __j); + __deleted_nodes.splice(__deleted_nodes.end(), *this, __i, __j); + __i = __j; + if (__i != __e) + ++__i; } else ++__i; @@ -2065,6 +2089,8 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred) for (; __j != __e && __pred(*__j); ++__j) ; __i = erase(__i, __j); + if (__i != __e) + ++__i; } else ++__i; diff --git a/include/locale b/include/locale index 3e87e9f34..fcff402bb 100644 --- a/include/locale +++ b/include/locale @@ -417,7 +417,7 @@ int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { // and failbit is set in __err. // Else an iterator pointing to the matching keyword is found. If more than // one keyword matches, an iterator to the first matching keyword is returned. -// If on exit __b == __e, eofbit is set in __err. If __case_senstive is false, +// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false, // __ct is used to force to lower case before comparing characters. // Examples: // Keywords: "a", "abb" @@ -1871,7 +1871,7 @@ public: }; template -class _LIBCPP_TYPE_VIS __time_get_c_storage +class _LIBCPP_TYPE_VIS_ONLY __time_get_c_storage { protected: typedef basic_string<_CharT> string_type; @@ -2038,7 +2038,7 @@ template locale::id time_get<_CharT, _InputIterator>::id; -// time_get primatives +// time_get primitives template void @@ -2259,7 +2259,7 @@ time_get<_CharT, _InputIterator>::__get_percent(iter_type& __b, iter_type __e, __err |= ios_base::eofbit; } -// time_get end primatives +// time_get end primitives template _InputIterator @@ -2509,7 +2509,7 @@ protected: }; template -class _LIBCPP_TYPE_VIS __time_get_storage +class _LIBCPP_TYPE_VIS_ONLY __time_get_storage : public __time_get { protected: diff --git a/include/map b/include/map index f533d8f4b..5c3969acd 100644 --- a/include/map +++ b/include/map @@ -159,7 +159,7 @@ public: template const_iterator find(const K& x) const; // C++14 template - 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 @@ public: template const_iterator find(const K& x) const; // C++14 template - 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); @@ -846,7 +846,6 @@ public: explicit map(const key_compare& __comp) _NOEXCEPT_( is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && is_nothrow_copy_constructible::value) : __tree_(__vc(__comp)) {} @@ -1105,6 +1104,12 @@ public: _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} +#if _LIBCPP_STD_VER > 11 + template + _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);} @@ -1587,7 +1592,6 @@ public: explicit multimap(const key_compare& __comp) _NOEXCEPT_( is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && is_nothrow_copy_constructible::value) : __tree_(__vc(__comp)) {} @@ -1836,6 +1840,12 @@ public: _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} +#if _LIBCPP_STD_VER > 11 + template + _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 da8786a2d..dc9aeba7a 100644 --- a/include/memory +++ b/include/memory @@ -1631,9 +1631,9 @@ public: _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator::const_pointer = 0) - {return static_cast(::operator new(__n * sizeof(_Tp)));} + {return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));} _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {::operator delete((void*)__p);} + {_VSTD::__deallocate((void*)__p);} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -1721,9 +1721,9 @@ public: _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator::const_pointer = 0) - {return static_cast(::operator new(__n * sizeof(_Tp)));} + {return static_cast(_VSTD::__allocate(__n * sizeof(_Tp)));} _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT - {::operator delete((void*)__p);} + {_VSTD::__deallocate((void*)__p);} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);} #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) @@ -2005,8 +2005,8 @@ public: tuple<_Args2...> __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) - : __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), - __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + : __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) {} #endif // _LIBCPP_HAS_NO_VARIADICS @@ -2019,7 +2019,7 @@ public: _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) { using _VSTD::swap; swap(__first_, __x.__first_); @@ -2096,8 +2096,8 @@ public: tuple<_Args2...> __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) - : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), - __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) {} #endif // _LIBCPP_HAS_NO_VARIADICS @@ -2110,7 +2110,7 @@ public: _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) { using _VSTD::swap; swap(__second_, __x.__second_); @@ -2188,8 +2188,8 @@ public: tuple<_Args2...> __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) - : _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...), - __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...) + : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...), + __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...) {} @@ -2203,7 +2203,7 @@ public: _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) { using _VSTD::swap; swap(__first_, __x.__first_); @@ -2278,8 +2278,8 @@ public: tuple<_Args2...> __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) - : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...), - _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) {} #endif // _LIBCPP_HAS_NO_VARIADICS @@ -2292,7 +2292,7 @@ public: _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) { } }; @@ -2375,7 +2375,7 @@ public: _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) {base::swap(__x);} }; @@ -2384,7 +2384,7 @@ inline _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T1>::value) + __is_nothrow_swappable<_T2>::value) {__x.swap(__y);} // __same_or_less_cv_qualified @@ -2401,13 +2401,14 @@ template struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> : false_type {}; -template ::value && - !is_pointer<_Ptr1>::value> +template ::value || + is_same<_Ptr1, _Ptr2>::value || + __has_element_type<_Ptr1>::value> struct __same_or_less_cv_qualified : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {}; template -struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true> +struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false> : false_type {}; // default_delete diff --git a/include/module.modulemap b/include/module.modulemap new file mode 100644 index 000000000..a0f425496 --- /dev/null +++ b/include/module.modulemap @@ -0,0 +1,471 @@ +module std [system] { + // FIXME: The standard does not require that each of these submodules + // re-exports its imported modules. We should provide an alternative form of + // export that issues a warning if a name from the submodule is used, and + // use that to provide a 'strict mode' for libc++. + module algorithm { + header "algorithm" + export initializer_list + export * + } + module array { + header "array" + export initializer_list + export * + } + module atomic { + header "atomic" + export * + } + module bitset { + header "bitset" + export string + export iosfwd + export * + } + // No submodule for cassert. It fundamentally needs repeated, textual inclusion. + module ccomplex { + header "ccomplex" + export complex + export * + } + module cctype { + header "cctype" + export * + } + module cerrno { + header "cerrno" +/* + export_macros ECONNREFUSED, EIO, ENODEV, ENOTEMPTY, ERANGE, + E2BIG, ECONNRESET, EISCONN, ENOENT, ENOTRECOVERABLE, EROFS, + EACCES, EDEADLK, EISDIR, ENOEXEC, ENOTSOCK, ESPIPE, + EADDRINUSE, EDESTADDRREQ, ELOOP, ENOLCK, ENOTSUP, ESRCH, + EADDRNOTAVAIL, EDOM, EMFILE, ENOLINK, ENOTTY, ETIME, + EAFNOSUPPORT, EEXIST, EMLINK, ENOMEM, ENXIO, ETIMEDOUT, + EAGAIN, EFAULT, EMSGSIZE, ENOMSG, EOPNOTSUPP, ETXTBSY, + EALREADY, EFBIG, ENAMETOOLONG, ENOPROTOOPT, EOVERFLOW, EWOULDBLOCK, + EBADF, EHOSTUNREACH, ENETDOWN, ENOSPC, EOWNERDEAD, EXDEV, + EBADMSG, EIDRM, ENETRESET, ENOSR, EPERM, errno, + EBUSY, EILSEQ, ENETUNREACH, ENOSTR, EPIPE, + ECANCELED, EINPROGRESS, ENFILE, ENOSYS, EPROTO, + ECHILD, EINTR, ENOBUFS, ENOTCONN, EPROTONOSUPPORT, + ECONNABORTED, EINVAL, ENODATA, ENOTDIR, EPROTOTYPE +*/ + export * + } + module cfenv { + header "cfenv" +/* + export_macros FE_ALL_EXCEPT, FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, + FE_UNDERFLOW, FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD, + FE_DFL_ENV +*/ + export * + } + module cfloat { + header "cfloat" +/* + export_macros FLT_EVAL_METHOD, FLT_RADIX, FLT_ROUNDS, + FLT_DIG, FLT_EPSILON, FLT_MANT_DIG, + FLT_MAX, FLT_MAX_10_EXP, FLT_MAX_EXP, + FLT_MIN, FLT_MIN_10_EXP, FLT_MIN_EXP, + DBL_DIG, DBL_EPSILON, DBL_MANT_DIG, + DBL_MAX, DBL_MAX_10_EXP, DBL_MAX_EXP, + DBL_MIN, DBL_MIN_10_EXP, DBL_MIN_EXP, + LDBL_DIG, LDBL_EPSILON, LDBL_MANT_DIG, + LDBL_MAX, LDBL_MAX_10_EXP, LDBL_MAX_EXP, + LDBL_MIN, LDBL_MIN_10_EXP, LDBL_MIN_EXP +*/ + export * + } + module chrono { + header "chrono" + export * + } + module cinttypes { + header "cinttypes" + export cstdint +/* + export_macros + PRId8, PRId16, PRId32, PRId64, PRIdFAST8, PRIdFAST16, PRIdFAST32, PRIdFAST64, PRIdLEAST8, PRIdLEAST16, PRIdLEAST32, PRIdLEAST64, PRIdMAX, PRIdPTR, + PRIi8, PRIi16, PRIi32, PRIi64, PRIiFAST8, PRIiFAST16, PRIiFAST32, PRIiFAST64, PRIiLEAST8, PRIiLEAST16, PRIiLEAST32, PRIiLEAST64, PRIiMAX, PRIiPTR, + PRIo8, PRIo16, PRIo32, PRIo64, PRIoFAST8, PRIoFAST16, PRIoFAST32, PRIoFAST64, PRIoLEAST8, PRIoLEAST16, PRIoLEAST32, PRIoLEAST64, PRIoMAX, PRIoPTR, + PRIu8, PRIu16, PRIu32, PRIu64, PRIuFAST8, PRIuFAST16, PRIuFAST32, PRIuFAST64, PRIuLEAST8, PRIuLEAST16, PRIuLEAST32, PRIuLEAST64, PRIuMAX, PRIuPTR, + PRIx8, PRIx16, PRIx32, PRIx64, PRIxFAST8, PRIxFAST16, PRIxFAST32, PRIxFAST64, PRIxLEAST8, PRIxLEAST16, PRIxLEAST32, PRIxLEAST64, PRIxMAX, PRIxPTR, + PRIX8, PRIX16, PRIX32, PRIX64, PRIXFAST8, PRIXFAST16, PRIXFAST32, PRIXFAST64, PRIXLEAST8, PRIXLEAST16, PRIXLEAST32, PRIXLEAST64, PRIXMAX, PRIXPTR, + SCNd8, SCNd16, SCNd32, SCNd64, SCNdFAST8, SCNdFAST16, SCNdFAST32, SCNdFAST64, SCNdLEAST8, SCNdLEAST16, SCNdLEAST32, SCNdLEAST64, SCNdMAX, SCNdPTR, + SCNi8, SCNi16, SCNi32, SCNi64, SCNiFAST8, SCNiFAST16, SCNiFAST32, SCNiFAST64, SCNiLEAST8, SCNiLEAST16, SCNiLEAST32, SCNiLEAST64, SCNiMAX, SCNiPTR, + SCNo8, SCNo16, SCNo32, SCNo64, SCNoFAST8, SCNoFAST16, SCNoFAST32, SCNoFAST64, SCNoLEAST8, SCNoLEAST16, SCNoLEAST32, SCNoLEAST64, SCNoMAX, SCNoPTR, + SCNu8, SCNu16, SCNu32, SCNu64, SCNuFAST8, SCNuFAST16, SCNuFAST32, SCNuFAST64, SCNuLEAST8, SCNuLEAST16, SCNuLEAST32, SCNuLEAST64, SCNuMAX, SCNuPTR, + SCNx8, SCNx16, SCNx32, SCNx64, SCNxFAST8, SCNxFAST16, SCNxFAST32, SCNxFAST64, SCNxLEAST8, SCNxLEAST16, SCNxLEAST32, SCNxLEAST64, SCNxMAX, SCNxPTR, + SCNX8, SCNX16, SCNX32, SCNX64, SCNXFAST8, SCNXFAST16, SCNXFAST32, SCNXFAST64, SCNXLEAST8, SCNXLEAST16, SCNXLEAST32, SCNXLEAST64, SCNXMAX, SCNXPTR +*/ + export * + } + module ciso646 { + header "ciso646" + export * + } + module climits { + header "climits" +/* + export_macros CHAR_BIT, CHAR_MIN, CHAR_MAX, + SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, + SHRT_MIN, SHRT_MAX, USHRT_MAX, + INT_MIN, INT_MAX, UINT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX, + LLONG_MIN, LLONG_MAX, ULLONG_MAX, + MB_LEN_MAX +*/ + export * + } + module clocale { + header "clocale" +/* + export_macros LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, NULL +*/ + export * + } + module cmath { + header "cmath" +/* + export_macros FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL, FP_ILOGBO, FP_ILOGBNAN, + FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, + HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY, NAN, + MATH_ERRNO, MATH_ERREXCEPT, math_errhandling +*/ + export * + } + module codecvt { + header "codecvt" + export * + } + module complex { + header "complex" + export * + } + module condition_variable { + header "condition_variable" + export * + } + module csetjmp { + header "csetjmp" +/* + export_macros setjmp +*/ + export * + } + module csignal { + header "csignal" +/* + export_macros SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, + SIG_DFL, SIG_IGN, SIG_ERR +*/ + export * + } + module cstdarg { + header "cstdarg" +/* + export_macros va_arg, va_start, va_end, va_copy +*/ + export * + } + module cstdbool { + header "cstdbool" +/* + export_macros __bool_true_false_are_defined +*/ + export * + } + module cstddef { + header "cstddef" +/* + export_macros NULL, offsetof +*/ + export * + } + module cstdint { + header "cstdint" +/* + export_macros + INT_8_MIN, INT_8_MAX, UINT_8_MAX, INT_16_MIN, INT_16_MAX, UINT_16_MAX, + INT_32_MIN, INT_32_MAX, UINT_32_MAX, INT_64_MIN, INT_64_MAX, UINT_64_MAX, + INT_FAST8_MIN, INT_FAST8_MAX, UINT_FAST8_MAX, INT_FAST16_MIN, INT_FAST16_MAX, UINT_FAST16_MAX, + INT_FAST32_MIN, INT_FAST32_MAX, UINT_FAST32_MAX, INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX, + INT_LEAST8_MIN, INT_LEAST8_MAX, UINT_LEAST8_MAX, INT_LEAST16_MIN, INT_LEAST16_MAX, UINT_LEAST16_MAX, + INT_LEAST32_MIN, INT_LEAST32_MAX, UINT_LEAST32_MAX, INT_LEAST64_MIN, INT_LEAST64_MAX, UINT_LEAST64_MAX, + INT_MAX_MIN, INT_MAX_MAX, UINT_MAX_MAX, INT_PTR_MIN, INT_PTR_MAX, UINT_PTR_MAX, + PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX, + SIZE_MAX +*/ + export * + } + module cstdio { + header "cstdio" +/* + export_macros BUFSIZ, EOF, FILENAME_MAX, FOPEN_MAX, L_tmpnam, NULL, + SEEK_CUR, SEEK_END, SEEK_SET, TMP_MAX, _IOFBF, _IOLBF, + stdin, stdout, stderr +*/ + export * + } + module cstdlib { + header "cstdlib" +/* + export_macros RAND_MAX +*/ + export * + } + module cstring { + header "cstring" +/* + export_macros NULL +*/ + export * + } + module ctgmath { + header "ctgmath" + export ccomplex + export cmath + export * + } + module ctime { + header "ctime" +/* + export_macros NULL, CLOCKS_PER_SEC +*/ + export * + } + module cwchar { + header "cwchar" +/* + export_macros NULL, WCHAR_MAX, WCHAR_MIN, WEOF +*/ + export * + } + module cwctype { + header "cwctype" +/* + export_macros WEOF +*/ + export * + } + module deque { + header "deque" + export initializer_list + export * + } + module exception { + header "exception" + export * + } + module forward_list { + header "forward_list" + export initializer_list + export * + } + module fstream { + header "fstream" + export * + } + module functional { + header "functional" + export * + } + module future { + header "future" + export * + } + module initializer_list { + header "initializer_list" + export * + } + module iomanip { + header "iomanip" + export * + } + module ios { + header "ios" + export iosfwd + export * + } + module iosfwd { + header "iosfwd" + export * + } + module iostream { + header "iostream" + export ios + export streambuf + export istream + export ostream + export * + } + module istream { + header "istream" + // FIXME: should re-export ios, streambuf? + export * + } + module iterator { + header "iterator" + export * + } + module limits { + header "limits" + export * + } + module list { + header "list" + export initializer_list + export * + } + module locale { + header "locale" + export * + } + module map { + header "map" + export initializer_list + export * + } + module memory { + header "memory" + export * + } + module mutex { + header "mutex" + export * + } + module new { + header "new" + export * + } + module numeric { + header "numeric" + export * + } + module ostream { + header "ostream" + // FIXME: should re-export ios, streambuf? + export * + } + module queue { + header "queue" + export initializer_list + export * + } + module random { + header "random" + export initializer_list + export * + } + module ratio { + header "ratio" + export * + } + module regex { + header "regex" + export initializer_list + export * + } + module scoped_allocator { + header "scoped_allocator" + export * + } + module set { + header "set" + export initializer_list + export * + } + module sstream { + header "sstream" + // FIXME: should re-export istream, ostream, ios, streambuf, string? + export * + } + module stack { + header "stack" + export initializer_list + export * + } + module stdexcept { + header "stdexcept" + export * + } + module streambuf { + header "streambuf" + export * + } + module string { + header "string" + export initializer_list + export * + } + module strstream { + header "strstream" + requires !cplusplus11 + } + module system_error { + header "system_error" + export * + } + module thread { + header "thread" + export * + } + module tuple { + header "tuple" + export * + } + module type_traits { + header "type_traits" + export * + } + module typeindex { + header "typeindex" + export * + } + module typeinfo { + header "typeinfo" + export * + } + module unordered_map { + header "unordered_map" + export initializer_list + export * + } + module unordered_set { + header "unordered_set" + export initializer_list + export * + } + module utility { + header "utility" + export initializer_list + export * + } + module valarray { + header "valarray" + export initializer_list + export * + } + module vector { + header "vector" + export initializer_list + export * + } + + // FIXME: These should be private. + module __bit_reference { header "__bit_reference" export * } + module __config { header "__config" export * } + module __debug { header "__debug" export * } + module __functional_base { header "__functional_base" export * } + module __hash_table { header "__hash_table" export * } + module __locale { header "__locale" export * } + module __mutex_base { header "__mutex_base" export * } + module __split_buffer { header "__split_buffer" export * } + module __sso_allocator { header "__sso_allocator" export * } + module __std_stream { header "__std_stream" export * } + module __tree { header "__tree" export * } + module __tuple { header "__tuple" export * } + module __undef_min_max { header "__undef_min_max" export * } +} diff --git a/include/mutex b/include/mutex index e0c02adb5..5dfba6325 100644 --- a/include/mutex +++ b/include/mutex @@ -425,7 +425,7 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) #endif // _LIBCPP_HAS_NO_VARIADICS -struct _LIBCPP_TYPE_VIS once_flag; +struct _LIBCPP_TYPE_VIS_ONLY once_flag; #ifndef _LIBCPP_HAS_NO_VARIADICS diff --git a/include/new b/include/new index ea4a4a01a..a710ed93f 100644 --- a/include/new +++ b/include/new @@ -147,4 +147,24 @@ inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _N inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} +_LIBCPP_BEGIN_NAMESPACE_STD + +inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) { +#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE + return ::operator new(__size); +#else + return __builtin_operator_new(__size); +#endif +} + +inline _LIBCPP_INLINE_VISIBILITY void __deallocate(void *__ptr) { +#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE + ::operator delete(__ptr); +#else + __builtin_operator_delete(__ptr); +#endif +} + +_LIBCPP_END_NAMESPACE_STD + #endif // _LIBCPP_NEW diff --git a/include/set b/include/set index 7dbf97095..22d794da5 100644 --- a/include/set +++ b/include/set @@ -436,7 +436,6 @@ public: explicit set(const value_compare& __comp) _NOEXCEPT_( is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && is_nothrow_copy_constructible::value) : __tree_(__comp) {} @@ -664,6 +663,12 @@ public: _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} +#if _LIBCPP_STD_VER > 11 + template + _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);} @@ -842,7 +847,6 @@ public: explicit multiset(const value_compare& __comp) _NOEXCEPT_( is_nothrow_default_constructible::value && - is_nothrow_default_constructible::value && is_nothrow_copy_constructible::value) : __tree_(__comp) {} @@ -1068,6 +1072,12 @@ public: _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} +#if _LIBCPP_STD_VER > 11 + template + _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 76610548d..00f816dc4 100644 --- a/include/shared_mutex +++ b/include/shared_mutex @@ -232,7 +232,7 @@ private: public: _LIBCPP_INLINE_VISIBILITY - shared_lock() noexcept + shared_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} @@ -244,7 +244,7 @@ public: {__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 +288,7 @@ public: 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 +297,7 @@ public: } _LIBCPP_INLINE_VISIBILITY - shared_lock& operator=(shared_lock&& __u) noexcept + shared_lock& operator=(shared_lock&& __u) _NOEXCEPT { if (__owns_) __m_->unlock_shared(); @@ -320,14 +320,14 @@ public: // 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 +337,13 @@ public: // 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 @@ -409,7 +409,7 @@ shared_lock<_Mutex>::unlock() template 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 diff --git a/include/string b/include/string index 7e61909cb..cb30d0494 100644 --- a/include/string +++ b/include/string @@ -990,9 +990,81 @@ char_traits::assign(char_type* __s, size_t __n, char_type __a) // helper fns for basic_string +// __find template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT +{ + if (__pos >= __sz) + return __npos; + const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); + if (__r == 0) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +template +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +{ + if (__pos > __sz || __sz - __pos < __n) + return __npos; + if (__n == 0) + return __pos; +// if (__n == 1) +// return _VSTD::__find<_CharT, _SizeT, _Traits, __npos>(__p, __sz, *__s, __pos); + const _CharT* __r = + _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq); + if (__r == __p + __sz) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + + +// __rfind + +template +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__rfind(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT +{ + if (__sz < 1) + return __npos; + if (__pos < __sz) + ++__pos; + else + __pos = __sz; + for (const _CharT* __ps = __p + __pos; __ps != __p;) + { + if (_Traits::eq(*--__ps, __c)) + return static_cast<_SizeT>(__ps - __p); + } + return __npos; +} + +template +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__rfind(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +{ + __pos = _VSTD::min(__pos, __sz); + if (__n < __sz - __pos) + __pos += __n; + else + __pos = __sz; + const _CharT* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, _Traits::eq); + if (__n > 0 && __r == __p + __pos) + return __npos; + return static_cast<_SizeT>(__r - __p); +} + +// __find_first_of +template +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos >= __sz || __n == 0) return __npos; @@ -1003,9 +1075,12 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_of(const _CharT *__p, _SizeT __sz, return static_cast<_SizeT>(__r - __p); } + +// __find_last_of template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__n != 0) { @@ -1024,9 +1099,11 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_last_of(const _CharT *__p, _SizeT __sz, } +// __find_first_not_of template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos < __sz) { @@ -1040,8 +1117,9 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT _ template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_first_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT { if (__pos < __sz) { @@ -1054,9 +1132,11 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_first_not_of(const _CharT *__p, _SizeT _ } +// __find_last_not_of template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_not_of(const _CharT *__p, _SizeT __sz, + const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT { if (__pos < __sz) ++__pos; @@ -1070,8 +1150,9 @@ _SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __ template -_SizeT _LIBCPP_INLINE_VISIBILITY __find_last_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT +_SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY +__find_last_not_of(const _CharT *__p, _SizeT __sz, + _CharT __c, _SizeT __pos) _NOEXCEPT { if (__pos < __sz) ++__pos; @@ -2053,11 +2134,13 @@ inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) : __r_(__a) { - if (__a == __str.__alloc() || !__str.__is_long()) - __r_.first().__r = __str.__r_.first().__r; - else + if (__str.__is_long() && __a != __str.__alloc()) // copy, not move __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); - __str.__zero(); + else + { + __r_.first().__r = __str.__r_.first().__r; + __str.__zero(); + } #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); if (__is_long()) @@ -2311,7 +2394,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); size_type __cap = capacity(); if (__cap >= __n) { @@ -2485,7 +2568,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::assign recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); return assign(__s, traits_type::length(__s)); } @@ -2495,7 +2578,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr"); size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz >= __n) @@ -2632,7 +2715,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::append recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr"); return append(__s, traits_type::length(__s)); } @@ -2642,7 +2725,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr"); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); @@ -2794,7 +2877,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::insert recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr"); return insert(__pos, __s, traits_type::length(__s)); } @@ -2845,7 +2928,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace recieved nullptr"); + _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); size_type __sz = size(); if (__pos > __sz) this->__throw_out_of_range(); @@ -2977,7 +3060,7 @@ template basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::replace recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr"); return replace(__pos, __n1, __s, traits_type::length(__s)); } @@ -3345,18 +3428,9 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): recieved nullptr"); - size_type __sz = size(); - if (__pos > __sz || __sz - __pos < __n) - return npos; - if (__n == 0) - return __pos; - const value_type* __p = data(); - const value_type* __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n, - __traits_eq()); - if (__r == __p + __sz) - return npos; - return static_cast(__r - __p); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr"); + return _VSTD::__find + (data(), size(), __s, __pos, __n); } template @@ -3365,7 +3439,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str, size_type __pos) const _NOEXCEPT { - return find(__str.data(), __pos, __str.size()); + return _VSTD::__find + (data(), size(), __str.data(), __pos, __str.size()); } template @@ -3374,8 +3449,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find(): recieved nullptr"); - return find(__s, __pos, traits_type::length(__s)); + _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr"); + return _VSTD::__find + (data(), size(), __s, __pos, traits_type::length(__s)); } template @@ -3383,14 +3459,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(value_type __c, size_type __pos) const _NOEXCEPT { - size_type __sz = size(); - if (__pos >= __sz) - return npos; - const value_type* __p = data(); - const value_type* __r = traits_type::find(__p + __pos, __sz - __pos, __c); - if (__r == 0) - return npos; - return static_cast(__r - __p); + return _VSTD::__find + (data(), size(), __c, __pos); } // rfind @@ -3401,19 +3471,9 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): recieved nullptr"); - size_type __sz = size(); - __pos = _VSTD::min(__pos, __sz); - if (__n < __sz - __pos) - __pos += __n; - else - __pos = __sz; - const value_type* __p = data(); - const value_type* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n, - __traits_eq()); - if (__n > 0 && __r == __p + __pos) - return npos; - return static_cast(__r - __p); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); + return _VSTD::__rfind + (data(), size(), __s, __pos, __n); } template @@ -3422,7 +3482,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str, size_type __pos) const _NOEXCEPT { - return rfind(__str.data(), __pos, __str.size()); + return _VSTD::__rfind + (data(), size(), __str.data(), __pos, __str.size()); } template @@ -3431,8 +3492,9 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): recieved nullptr"); - return rfind(__s, __pos, traits_type::length(__s)); + _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr"); + return _VSTD::__rfind + (data(), size(), __s, __pos, traits_type::length(__s)); } template @@ -3440,21 +3502,8 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c, size_type __pos) const _NOEXCEPT { - size_type __sz = size(); - if (__sz) - { - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - const value_type* __p = data(); - for (const value_type* __ps = __p + __pos; __ps != __p;) - { - if (traits_type::eq(*--__ps, __c)) - return static_cast(__ps - __p); - } - } - return npos; + return _VSTD::__rfind + (data(), size(), __c, __pos); } // find_first_of @@ -3465,7 +3514,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); return _VSTD::__find_first_of (data(), size(), __s, __pos, __n); } @@ -3486,7 +3535,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr"); return _VSTD::__find_first_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3508,7 +3557,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); return _VSTD::__find_last_of (data(), size(), __s, __pos, __n); } @@ -3529,7 +3578,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr"); return _VSTD::__find_last_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3551,7 +3600,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); return _VSTD::__find_first_not_of (data(), size(), __s, __pos, __n); } @@ -3572,7 +3621,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr"); return _VSTD::__find_first_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3595,7 +3644,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); return _VSTD::__find_last_not_of (data(), size(), __s, __pos, __n); } @@ -3616,7 +3665,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr"); return _VSTD::__find_last_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3680,7 +3729,7 @@ template int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); return compare(0, npos, __s, traits_type::length(__s)); } @@ -3690,7 +3739,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const value_type* __s) const { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); return compare(__pos1, __n1, __s, traits_type::length(__s)); } @@ -3701,7 +3750,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, const value_type* __s, size_type __n2) const { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): recieved nullptr"); + _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) this->__throw_out_of_range(); diff --git a/include/tuple b/include/tuple index 3a1752ee1..c3fdd407e 100644 --- a/include/tuple +++ b/include/tuple @@ -210,7 +210,13 @@ public: "Attempted to default construct a reference element in a tuple");} template ::value>::type> + class = typename enable_if< + __lazy_and< + __lazy_not::type, __tuple_leaf>> + , is_constructible<_Hp, _Tp> + >::value + >::type + > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : value(_VSTD::forward<_Tp>(__t)) @@ -268,17 +274,8 @@ public: >::value)), "Attempted to construct a reference element in a tuple with an rvalue");} - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX11 - __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value) - : value(__t.get()) - {static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");} - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_AFTER_CXX11 - __tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value) - : value(_VSTD::forward<_Hp>(__t.get())) - {} + __tuple_leaf(const __tuple_leaf& __t) = default; + __tuple_leaf(__tuple_leaf&& __t) = default; template _LIBCPP_INLINE_VISIBILITY @@ -325,7 +322,13 @@ public: : _Hp(__a) {} template ::value>::type> + class = typename enable_if< + __lazy_and< + __lazy_not::type, __tuple_leaf>> + , is_constructible<_Hp, _Tp> + >::value + >::type + > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : _Hp(_VSTD::forward<_Tp>(__t)) {} @@ -345,6 +348,9 @@ public: explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t), __a) {} + __tuple_leaf(__tuple_leaf const &) = default; + __tuple_leaf(__tuple_leaf &&) = default; + template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& @@ -863,7 +869,7 @@ struct __tuple_equal _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp& __x, const _Up& __y) { - return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y); + return __tuple_equal<_Ip - 1>()(__x, __y) && _VSTD::get<_Ip-1>(__x) == _VSTD::get<_Ip-1>(__y); } }; @@ -902,7 +908,7 @@ struct __tuple_less bool operator()(const _Tp& __x, const _Up& __y) { return __tuple_less<_Ip-1>()(__x, __y) || - (!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y)); + (!__tuple_less<_Ip-1>()(__y, __x) && _VSTD::get<_Ip-1>(__x) < _VSTD::get<_Ip-1>(__y)); } }; @@ -1051,8 +1057,8 @@ struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J typename __tuple_cat_return_ref&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { - return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))..., - get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); + return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., + _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); } template @@ -1067,8 +1073,8 @@ struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J typename __make_tuple_indices::value>::type, typename __make_tuple_indices::value>::type>() (forward_as_tuple( - _VSTD::forward<_Types>(get<_I0>(__t))..., - get<_J0>(_VSTD::forward<_Tuple0>(__t0))... + _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., + _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))... ), _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...); @@ -1097,8 +1103,8 @@ inline _LIBCPP_INLINE_VISIBILITY pair<_T1, _T2>::pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) - : first(_VSTD::forward<_Args1>(get<_I1>( __first_args))...), - second(_VSTD::forward<_Args2>(get<_I2>(__second_args))...) + : first(_VSTD::forward<_Args1>(_VSTD::get<_I1>( __first_args))...), + second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } diff --git a/include/type_traits b/include/type_traits index 26c2e0d17..c0e1a6df2 100644 --- a/include/type_traits +++ b/include/type_traits @@ -376,13 +376,9 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public t template struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; #endif -#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) -#define _LIBCPP_HAS_TYPE_TRAITS -#endif - // is_union -#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_union) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY is_union : public integral_constant {}; @@ -397,7 +393,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_union // is_class -#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_class) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY is_class : public integral_constant {}; @@ -455,13 +451,13 @@ struct __member_pointer_traits_imp namespace __libcpp_is_member_function_pointer_imp { - template - char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); + template + char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); - template - std::__two __test(...); + template + std::__two __test(...); }; - + template struct __libcpp_is_member_function_pointer : public integral_constant(nullptr)) == 1> {}; @@ -484,7 +480,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer // is_enum -#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_enum) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY is_enum : public integral_constant {}; @@ -797,7 +793,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_base_of : public integral_constant {}; -#else // __has_feature(is_base_of) +#else // _LIBCPP_HAS_IS_BASE_OF namespace __is_base_of_imp { @@ -822,7 +818,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_base_of : public integral_constant::value && sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; -#endif // __has_feature(is_base_of) +#endif // _LIBCPP_HAS_IS_BASE_OF // is_convertible @@ -945,7 +941,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_convertible // is_empty -#if __has_feature(is_empty) +#if __has_feature(is_empty) || (_GNUC_VER >= 407) template struct _LIBCPP_TYPE_VIS_ONLY is_empty @@ -996,17 +992,17 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic // has_virtual_destructor -#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor : public integral_constant {}; -#else // _LIBCPP_HAS_TYPE_TRAITS +#else template struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor : public false_type {}; -#endif // _LIBCPP_HAS_TYPE_TRAITS +#endif // alignment_of @@ -1541,42 +1537,61 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable // is_destructible -template -struct __destructible_test -{ - _Tp __t; +// 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 +struct __is_destructible_apply { typedef int type; }; + +template +struct __is_destructor_wellformed { + template + static char __test ( + typename __is_destructible_apply().~_Tp1())>::type + ); + + template + static __two __test (...); + + static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); }; +template +struct __destructible_imp; + template -decltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -__is_destructible_test(_Tp&&); -#else -__is_destructible_test(_Tp&); -#endif - -false_type -__is_destructible_test(__any); - -template ::value || is_abstract<_Tp>::value - || is_function<_Tp>::value> -struct __destructible_imp - : public common_type - < - decltype(__is_destructible_test(declval<_Tp>())) - >::type {}; +struct __destructible_imp<_Tp, false> + : public _VSTD::integral_constant::type>::value> {}; template struct __destructible_imp<_Tp, true> - : public false_type {}; + : public _VSTD::true_type {}; + +template +struct __destructible_false; + +template +struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {}; + +template +struct __destructible_false<_Tp, true> : public _VSTD::false_type {}; template struct is_destructible - : public __destructible_imp<_Tp> {}; + : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {}; template struct is_destructible<_Tp[]> - : public false_type {}; + : public _VSTD::false_type {}; + +template <> +struct is_destructible + : public _VSTD::false_type {}; // move @@ -1682,6 +1697,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> { @@ -1690,6 +1713,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> +{ + typedef _Class const _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> { @@ -1698,6 +1729,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, fa typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> +{ + typedef _Class volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> { @@ -1706,6 +1745,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, tr typedef _Rp (_FnType) (_Param...); }; +template +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 @@ -1716,6 +1763,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> +{ + typedef _Class& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> { @@ -1724,6 +1779,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, fals typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> +{ + typedef _Class const& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> { @@ -1732,6 +1795,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, f typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> +{ + typedef _Class volatile& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> { @@ -1740,6 +1811,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, t typedef _Rp (_FnType) (_Param...); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> { @@ -1748,6 +1827,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> +{ + typedef _Class&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> { @@ -1756,6 +1843,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, fal typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> +{ + typedef _Class const&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> { @@ -1764,6 +1859,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, typedef _Rp (_FnType) (_Param...); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> +{ + typedef _Class volatile&& _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_Param..., ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> { @@ -1772,6 +1875,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, typedef _Rp (_FnType) (_Param...); }; +template +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 @@ -1784,6 +1895,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> typedef _Rp (_FnType) (); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> { @@ -1792,6 +1911,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> typedef _Rp (_FnType) (_P0); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> { @@ -1800,6 +1927,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> typedef _Rp (_FnType) (_P0, _P1); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false> +{ + typedef _Class _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, _P1, ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> { @@ -1808,6 +1943,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> typedef _Rp (_FnType) (_P0, _P1, _P2); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> { @@ -1816,6 +1959,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> typedef _Rp (_FnType) (); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false> +{ + typedef _Class const _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> { @@ -1824,6 +1975,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> typedef _Rp (_FnType) (_P0); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false> +{ + typedef _Class const _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> { @@ -1832,6 +1991,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> typedef _Rp (_FnType) (_P0, _P1); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> { @@ -1840,6 +2007,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, f typedef _Rp (_FnType) (_P0, _P1, _P2); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> { @@ -1848,6 +2023,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> typedef _Rp (_FnType) (); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false> +{ + typedef _Class volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> { @@ -1856,6 +2039,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> typedef _Rp (_FnType) (_P0); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false> +{ + typedef _Class volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (_P0, ...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> { @@ -1864,6 +2055,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, fal typedef _Rp (_FnType) (_P0, _P1); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> { @@ -1872,6 +2071,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true typedef _Rp (_FnType) (_P0, _P1, _P2); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> { @@ -1880,6 +2087,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false typedef _Rp (_FnType) (); }; +template +struct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false> +{ + typedef _Class const volatile _ClassType; + typedef _Rp _ReturnType; + typedef _Rp (_FnType) (...); +}; + template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> { @@ -1888,6 +2103,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, fa typedef _Rp (_FnType) (_P0); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> { @@ -1896,6 +2119,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, tru typedef _Rp (_FnType) (_P0, _P1); }; +template +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 struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> { @@ -1904,6 +2135,14 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile typedef _Rp (_FnType) (_P0, _P1, _P2); }; +template +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 @@ -2076,10 +2315,24 @@ class _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> #endif // _LIBCPP_HAS_NO_VARIADICS -#ifndef _LIBCPP_HAS_NO_VARIADICS - // template struct is_constructible; +namespace __is_construct +{ +struct __nat {}; +} + +#if __has_feature(is_constructible) + +template +struct _LIBCPP_TYPE_VIS_ONLY is_constructible + : public integral_constant + {}; + +#else + +#ifndef _LIBCPP_HAS_NO_VARIADICS + // main is_constructible test template @@ -2307,13 +2560,6 @@ struct __is_constructible2_void_check // is_constructible entry point -namespace __is_construct -{ - -struct __nat {}; - -} - template struct _LIBCPP_TYPE_VIS_ONLY is_constructible @@ -2378,6 +2624,7 @@ struct __is_constructible2_imp {}; #endif // _LIBCPP_HAS_NO_VARIADICS +#endif // __has_feature(is_constructible) // is_default_constructible @@ -2426,7 +2673,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> -#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2555,7 +2802,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructibl // is_trivially_assignable -#if __has_feature(is_trivially_constructible) +#if __has_feature(is_trivially_assignable) template struct is_trivially_assignable @@ -2563,7 +2810,7 @@ struct is_trivially_assignable { }; -#else // !__has_feature(is_trivially_constructible) +#else // !__has_feature(is_trivially_assignable) template struct is_trivially_assignable @@ -2589,7 +2836,7 @@ struct is_trivially_assignable<_Tp&, _Tp&&> #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif // !__has_feature(is_trivially_constructible) +#endif // !__has_feature(is_trivially_assignable) // is_trivially_copy_assignable @@ -2611,12 +2858,12 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable // is_trivially_destructible -#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible : public integral_constant {}; -#else // _LIBCPP_HAS_TYPE_TRAITS +#else template struct __libcpp_trivial_destructor : public integral_constant::value || @@ -2625,7 +2872,7 @@ template struct __libcpp_trivial_destructor template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible : public __libcpp_trivial_destructor::type> {}; -#endif // _LIBCPP_HAS_TYPE_TRAITS +#endif // is_nothrow_constructible @@ -2640,7 +2887,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible #ifndef _LIBCPP_HAS_NO_VARIADICS -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template struct __libcpp_is_nothrow_constructible; @@ -2678,7 +2925,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> -#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2692,7 +2939,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> #else struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> #endif -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2702,7 +2949,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2712,7 +2959,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2734,7 +2981,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> -#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2745,7 +2992,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2756,7 +3003,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2767,7 +3014,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) : integral_constant #else : integral_constant::value> @@ -2802,7 +3049,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible // is_nothrow_assignable -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template struct __libcpp_is_nothrow_assignable; @@ -2832,7 +3079,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) : integral_constant {}; #else : integral_constant::value> {}; @@ -2840,7 +3087,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) : integral_constant {}; #else : integral_constant::value> {}; @@ -2848,7 +3095,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) : integral_constant {}; #else : integral_constant::value> {}; @@ -2858,7 +3105,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> template struct is_nothrow_assignable<_Tp&, _Tp&&> -#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) : integral_constant {}; #else : integral_constant::value> {}; @@ -2888,7 +3135,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable // is_nothrow_destructible -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template struct __libcpp_is_nothrow_destructible; @@ -2945,12 +3192,12 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible // is_pod -#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#if __has_feature(is_pod) || (_GNUC_VER >= 403) template struct _LIBCPP_TYPE_VIS_ONLY is_pod : public integral_constant {}; -#else // _LIBCPP_HAS_TYPE_TRAITS +#else template struct _LIBCPP_TYPE_VIS_ONLY is_pod : public integral_constant::value && @@ -2958,13 +3205,13 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_pod is_trivially_copy_assignable<_Tp>::value && is_trivially_destructible<_Tp>::value> {}; -#endif // _LIBCPP_HAS_TYPE_TRAITS +#endif // is_literal_type; template struct _LIBCPP_TYPE_VIS_ONLY is_literal_type -#if __has_feature(is_literal) - : public integral_constant +#ifdef _LIBCPP_IS_LITERAL + : public integral_constant #else : integral_constant::type>::value || is_reference::type>::value> @@ -2974,7 +3221,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_literal_type // is_standard_layout; template struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout -#if __has_feature(is_standard_layout) +#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) : public integral_constant #else : integral_constant::type>::value> @@ -2994,7 +3241,7 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable // is_trivial; template struct _LIBCPP_TYPE_VIS_ONLY is_trivial -#if __has_feature(is_trivial) +#if __has_feature(is_trivial) || (_GNUC_VER >= 407) : public integral_constant #else : integral_constant::value && @@ -3324,7 +3571,7 @@ struct __is_swappable { }; -#if __has_feature(cxx_noexcept) +#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) template struct __is_nothrow_swappable_imp @@ -3355,19 +3602,19 @@ struct __is_nothrow_swappable #endif // __has_feature(cxx_noexcept) -#ifdef _LIBCXX_UNDERLYING_TYPE +#ifdef _LIBCPP_UNDERLYING_TYPE template struct underlying_type { - typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; + typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; }; #if _LIBCPP_STD_VER > 11 template using underlying_type_t = typename underlying_type<_Tp>::type; #endif -#else // _LIBCXX_UNDERLYING_TYPE +#else // _LIBCPP_UNDERLYING_TYPE template struct underlying_type @@ -3377,7 +3624,7 @@ struct underlying_type "libc++ does not know how to use it."); }; -#endif // _LIBCXX_UNDERLYING_TYPE +#endif // _LIBCPP_UNDERLYING_TYPE #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE diff --git a/include/typeinfo b/include/typeinfo index 7fcc82440..14ef77b31 100644 --- a/include/typeinfo +++ b/include/typeinfo @@ -116,7 +116,7 @@ public: {return *reinterpret_cast(&__type_name);} #else {if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name; - const char *__ptr = __name_for_load(); + const char *__ptr = name(); size_t __hash = 5381; while (unsigned char __c = static_cast(*__ptr++)) __hash = (__hash * 33) ^ __c; @@ -141,15 +141,7 @@ public: private: _LIBCPP_INLINE_VISIBILITY int __compare_nonunique_names(const type_info &__arg) const _NOEXCEPT - {return __builtin_strcmp(__name_for_load(), __arg.__name_for_load());} - - _LIBCPP_INLINE_VISIBILITY - const char *__name_for_load() const _NOEXCEPT - {uintptr_t __data = __type_name; -#if 1 - __data &= ~_LIBCPP_NONUNIQUE_RTTI_BIT; -#endif - return reinterpret_cast(__data);} + {return __builtin_strcmp(name(), __arg.name());} #endif }; diff --git a/include/utility b/include/utility index 8a7e1dcb9..4eafda416 100644 --- a/include/utility +++ b/include/utility @@ -345,9 +345,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 pair(_Tuple&& __p) : first(_VSTD::forward::type>::type>(get<0>(__p))), + typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<0>(__p))), second(_VSTD::forward::type>::type>(get<1>(__p))) + typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<1>(__p))) {} diff --git a/include/valarray b/include/valarray index 5113516e9..2b942046d 100644 --- a/include/valarray +++ b/include/valarray @@ -345,6 +345,7 @@ template unspecified2 end(const valarray& v); #include #include #include +#include #include <__undef_min_max> @@ -1219,6 +1220,7 @@ slice_array<_Tp>::operator=(const slice_array& __sa) const const value_type* __s = __sa.__vp_; for (size_t __n = __size_; __n; --__n, __t += __stride_, __s += __sa.__stride_) *__t = *__s; + return *this; } template @@ -2089,6 +2091,7 @@ mask_array<_Tp>::operator=(const mask_array& __ma) const size_t __n = __1d_.size(); for (size_t __i = 0; __i < __n; ++__i) __vp_[__1d_[__i]] = __ma.__vp_[__1d_[__i]]; + return *this; } template @@ -2636,7 +2639,7 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(result_type))); + static_cast(_VSTD::__allocate(__n * sizeof(result_type))); for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) ::new (__r.__end_) result_type(__expr_[__i]); } @@ -2670,7 +2673,7 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n) { if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2695,7 +2698,7 @@ valarray<_Tp>::valarray(const valarray& __v) { if (__v.size()) { - __begin_ = __end_ = static_cast(::operator new(__v.size() * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__v.size() * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2736,7 +2739,7 @@ valarray<_Tp>::valarray(initializer_list __il) size_t __n = __il.size(); if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2764,7 +2767,7 @@ valarray<_Tp>::valarray(const slice_array& __sa) size_t __n = __sa.__size_; if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2790,7 +2793,7 @@ valarray<_Tp>::valarray(const gslice_array& __ga) size_t __n = __ga.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2819,7 +2822,7 @@ valarray<_Tp>::valarray(const mask_array& __ma) size_t __n = __ma.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -2848,7 +2851,7 @@ valarray<_Tp>::valarray(const indirect_array& __ia) size_t __n = __ia.__1d_.size(); if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { @@ -3133,7 +3136,7 @@ valarray<_Tp>::operator+() const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(+*__p); } @@ -3150,7 +3153,7 @@ valarray<_Tp>::operator-() const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(-*__p); } @@ -3167,7 +3170,7 @@ valarray<_Tp>::operator~() const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(~*__p); } @@ -3184,7 +3187,7 @@ valarray<_Tp>::operator!() const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(bool))); + static_cast(_VSTD::__allocate(__n * sizeof(bool))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) bool(!*__p); } @@ -3504,7 +3507,7 @@ valarray<_Tp>::shift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); const value_type* __sb; value_type* __tb; value_type* __te; @@ -3542,7 +3545,7 @@ valarray<_Tp>::cshift(int __i) const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); __i %= static_cast(__n); const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) @@ -3563,7 +3566,7 @@ valarray<_Tp>::apply(value_type __f(value_type)) const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3580,7 +3583,7 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const { __r.__begin_ = __r.__end_ = - static_cast(::operator new(__n * sizeof(value_type))); + static_cast(_VSTD::__allocate(__n * sizeof(value_type))); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) ::new (__r.__end_) value_type(__f(*__p)); } @@ -3595,12 +3598,12 @@ valarray<_Tp>::resize(size_t __n, value_type __x) { while (__end_ != __begin_) (--__end_)->~value_type(); - ::operator delete(__begin_); + _VSTD::__deallocate(__begin_); __begin_ = __end_ = nullptr; } if (__n) { - __begin_ = __end_ = static_cast(::operator new(__n * sizeof(value_type))); + __begin_ = __end_ = static_cast(_VSTD::__allocate(__n * sizeof(value_type))); #ifndef _LIBCPP_NO_EXCEPTIONS try { diff --git a/include/vector b/include/vector index 6ac78d5d5..5d41bd110 100644 --- a/include/vector +++ b/include/vector @@ -483,6 +483,7 @@ class _LIBCPP_TYPE_VIS_ONLY vector { private: typedef __vector_base<_Tp, _Allocator> __base; + typedef allocator<_Tp> __default_allocator_type; public: typedef vector __self; typedef _Tp value_type; @@ -749,7 +750,9 @@ public: _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT { + size_type __old_size = size(); __base::clear(); + __annotate_shrink(__old_size); __invalidate_all_iterators(); } @@ -816,7 +819,9 @@ private: } __get_db()->unlock(); #endif + size_type __old_size = size(); __base::__destruct_at_end(__new_last); + __annotate_shrink(__old_size); } template void @@ -830,17 +835,52 @@ private: void __emplace_back_slow_path(_Args&&... __args); #endif + // The following functions are no-ops outside of AddressSanitizer mode. + // We call annotatations only for the default Allocator because other allocators + // 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) + { +#ifndef _LIBCPP_HAS_NO_ASAN + if (__beg && is_same::value) + __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); +#endif + } + + void __annotate_new(size_type __current_size) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + capacity(), data() + __current_size); + } + void __annotate_delete() + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + size(), data() + capacity()); + } + void __annotate_increase(size_type __n) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + size(), data() + size() + __n); + } + void __annotate_shrink(size_type __old_size) + { + __annotate_contiguous_container(data(), data() + capacity(), + data() + __old_size, data() + size()); + } }; template void vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v) { + __annotate_delete(); __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; + __annotate_new(size()); __invalidate_all_iterators(); } @@ -848,6 +888,7 @@ template typename vector<_Tp, _Allocator>::pointer vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer& __v, pointer __p) { + __annotate_delete(); pointer __r = __v.__begin_; __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_); __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_); @@ -855,6 +896,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; + __annotate_new(size()); __invalidate_all_iterators(); return __r; } @@ -874,6 +916,7 @@ vector<_Tp, _Allocator>::allocate(size_type __n) this->__throw_length_error(); this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n); this->__end_cap() = this->__begin_ + __n; + __annotate_new(0); } template @@ -920,6 +963,7 @@ void vector<_Tp, _Allocator>::__construct_at_end(size_type __n) { allocator_type& __a = this->__alloc(); + __annotate_increase(__n); do { __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); @@ -940,6 +984,7 @@ void vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { allocator_type& __a = this->__alloc(); + __annotate_increase(__n); do { __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); @@ -960,6 +1005,7 @@ vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIt allocator_type& __a = this->__alloc(); for (; __first != __last; ++__first) { + __annotate_increase(1); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); ++this->__end_; } @@ -972,6 +1018,7 @@ 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)); ++this->__end_; @@ -1284,10 +1331,10 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) { deallocate(); + __base::__move_assign_alloc(__c); // this can throw this->__begin_ = __c.__begin_; this->__end_ = __c.__end_; this->__end_cap() = __c.__end_cap(); - __base::__move_assign_alloc(__c); __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr; #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__c); @@ -1535,6 +1582,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) { if (this->__end_ != this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), __x); ++this->__end_; @@ -1552,6 +1600,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) { if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(__x)); @@ -1584,6 +1633,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) { if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::forward<_Args>(__args)...); @@ -1666,6 +1716,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1705,6 +1756,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1743,6 +1795,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { + __annotate_increase(1); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), @@ -1794,6 +1847,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_ } if (__n > 0) { + __annotate_increase(__n); __move_range(__p, __old_last, __p + __old_n); const_pointer __xr = pointer_traits::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) @@ -1904,6 +1958,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __fi } if (__n > 0) { + __annotate_increase(__n); __move_range(__p, __old_last, __p + __old_n); _VSTD::copy(__first, __m, __p); } @@ -2297,7 +2352,7 @@ private: void deallocate() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY static size_type __align_it(size_type __new_size) _NOEXCEPT - {return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);}; + {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);}; _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x); template @@ -2796,10 +2851,10 @@ vector::__move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) { deallocate(); + __move_assign_alloc(__c); this->__begin_ = __c.__begin_; this->__size_ = __c.__size_; this->__cap() = __c.__cap(); - __move_assign_alloc(__c); __c.__begin_ = nullptr; __c.__cap() = __c.__size_ = 0; } diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index cec0bee14..d56ade4f2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -32,7 +32,7 @@ else() endif() if (DEFINED LIBCXX_CXX_ABI_DEPS) - add_dependencies(cxx ${LIBCXX_CXX_ABI_DEPS}) + add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) endif() # Generate library list. @@ -54,7 +54,7 @@ if ( APPLE ) list(APPEND compile_flags "-U__STRICT_ANSI__") list(APPEND 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" @@ -84,6 +84,7 @@ if ( APPLE ) endif() endif() +string(REPLACE ";" " " compile_flags "${compile_flags}") string(REPLACE ";" " " link_flags "${link_flags}") set_target_properties(cxx @@ -96,6 +97,6 @@ set_target_properties(cxx ) install(TARGETS cxx - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} ) diff --git a/lib/buildit b/lib/buildit index 7e42c1bd9..7e3bc2ed2 100755 --- a/lib/buildit +++ b/lib/buildit @@ -50,7 +50,7 @@ case $TRIPLE in RC_CFLAGS="-arch i386 -arch x86_64" fi SOEXT=dylib - if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ] + if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ] then EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__" LDSHARED_FLAGS="-o libc++.1.dylib \ @@ -106,7 +106,7 @@ case $TRIPLE in hostOS=`echo $hostOS | sed -e "s/\s+$//"` hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'` - if [ $hostOS == "linux" ] + if [ $hostOS = "linux" ] then LDSHARED_FLAGS="-o libc++.so.1 \ -qmkshrobj -Wl,-soname,libc++.so.1 \ @@ -158,7 +158,7 @@ case $TRIPLE in *-*-mingw*) ;; *-ibm-*) - if [ $hostOS == "linux" ] + if [ $hostOS = "linux" ] then rm -f libc++.so ln -s libc++.so.1 libc++.so diff --git a/src/hash.cpp b/src/hash.cpp index 388ab2ebe..dc90f789c 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -136,7 +136,7 @@ const unsigned indices[] = // The algorithm creates a list of small primes, plus an open-ended list of // potential primes. All prime numbers are potential prime numbers. However // some potential prime numbers are not prime. In an ideal world, all potential -// prime numbers would be prime. Candiate prime numbers are chosen as the next +// prime numbers would be prime. Candidate prime numbers are chosen as the next // highest potential prime. Then this number is tested for prime by dividing it // by all potential prime numbers less than the sqrt of the candidate. // diff --git a/src/ios.cpp b/src/ios.cpp index 35cb03020..e24139460 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -305,7 +305,7 @@ void ios_base::copyfmt(const ios_base& rhs) { // If we can't acquire the needed resources, throw bad_alloc (can't set badbit) - // Don't alter *this until all needed resources are aquired + // Don't alter *this until all needed resources are acquired unique_ptr new_callbacks(0, free); unique_ptr new_ints(0, free); unique_ptr new_longs(0, free); diff --git a/src/random.cpp b/src/random.cpp index bd24f2e50..86017ef0d 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -49,7 +49,7 @@ random_device::operator()() random_device::random_device(const string& __token) : __f_(open(__token.c_str(), O_RDONLY)) { - if (__f_ <= 0) + if (__f_ < 0) __throw_system_error(errno, ("random_device failed to open " + __token).c_str()); } @@ -62,7 +62,22 @@ unsigned random_device::operator()() { unsigned r; - read(__f_, &r, sizeof(r)); + size_t n = sizeof(r); + char* p = reinterpret_cast(&r); + while (n > 0) + { + ssize_t s = read(__f_, p, n); + if (s == 0) + __throw_system_error(ENODATA, "random_device got EOF"); + if (s == -1) + { + if (errno != EINTR) + __throw_system_error(errno, "random_device got an unexpected error"); + continue; + } + n -= static_cast(s); + p += static_cast(s); + } return r; } #endif // defined(_WIN32) diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp index 6ee31e0cb..e989681a6 100644 --- a/src/support/win32/support.cpp +++ b/src/support/win32/support.cpp @@ -107,8 +107,8 @@ size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src, // Converts max_source_chars from the wide character buffer pointer to by *src, // into the multi byte character sequence buffer stored at dst which must be // dst_size_bytes bytes in size. -// Returns >= 0: the number of bytes in the sequence sequence -// converted frome *src, excluding the null terminator. +// Returns >= 0: the number of bytes in the sequence +// converted from *src, excluding the null terminator. // Returns size_t(-1) if an error occurs, also sets errno. // If dst is NULL dst_size_bytes is ignored and no bytes are copied to dst // and no "out" parameters are updated. diff --git a/src/thread.cpp b/src/thread.cpp index bd2b7c392..e6f57c46a 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -121,7 +121,9 @@ sleep_for(const chrono::nanoseconds& ns) ts.tv_sec = ts_sec_max; ts.tv_nsec = giga::num - 1; } - nanosleep(&ts, 0); + + while (nanosleep(&ts, &ts) == -1 && errno == EINTR) + ; } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4810b2c57..7236decfc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,7 +14,7 @@ if(PYTHONINTERP_FOUND) 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 @@ if(PYTHONINTERP_FOUND) 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.modifying.operations/alg.remove/remove_if.pass.cpp b/test/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp index 6da3a677a..b23443129 100644 --- a/test/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp +++ b/test/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp @@ -23,6 +23,9 @@ #endif #include "test_iterators.h" +#include "counting_predicates.hpp" + +bool equal2 ( int i ) { return i == 2; } template void @@ -30,7 +33,9 @@ test() { int ia[] = {0, 1, 2, 3, 4, 2, 3, 4, 2}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); - int* r = std::remove_if(ia, ia+sa, std::bind2nd(std::equal_to(), 2)); +// int* r = std::remove_if(ia, ia+sa, std::bind2nd(std::equal_to(), 2)); + unary_counting_predicate cp(equal2); + int* r = std::remove_if(ia, ia+sa, std::ref(cp)); assert(r == ia + sa-3); assert(ia[0] == 0); assert(ia[1] == 1); @@ -38,6 +43,7 @@ test() assert(ia[3] == 4); assert(ia[4] == 3); assert(ia[5] == 4); + assert(cp.count() == sa); } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp index ed76fa2f9..4cde1a7d3 100644 --- a/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp @@ -17,6 +17,9 @@ #include #include #include + +#include "counting_predicates.hpp" + #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include @@ -32,11 +35,43 @@ struct indirect_less void test(unsigned N) { int* ia = new int [N]; + { for (int i = 0; i < N; ++i) ia[i] = i; std::random_shuffle(ia, ia+N); std::make_heap(ia, ia+N, std::greater()); assert(std::is_heap(ia, ia+N, std::greater())); + } + +// Ascending + { + binary_counting_predicate, int, int> pred ((std::greater())); + for (int i = 0; i < N; ++i) + ia[i] = i; + std::make_heap(ia, ia+N, std::ref(pred)); + assert(pred.count() <= 3*N); + assert(std::is_heap(ia, ia+N, pred)); + } + +// Descending + { + binary_counting_predicate, int, int> pred ((std::greater())); + for (int i = 0; i < N; ++i) + ia[N-1-i] = i; + std::make_heap(ia, ia+N, std::ref(pred)); + assert(pred.count() <= 3*N); + assert(std::is_heap(ia, ia+N, pred)); + } + +// Random + { + binary_counting_predicate, int, int> pred ((std::greater())); + std::random_shuffle(ia, ia+N); + std::make_heap(ia, ia+N, std::ref(pred)); + assert(pred.count() <= 3*N); + assert(std::is_heap(ia, ia+N, pred)); + } + delete [] ia; } @@ -48,6 +83,8 @@ int main() test(3); test(10); test(1000); + test(10000); + test(100000); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { diff --git a/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp b/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp index 3fa8b2c6e..71dfeefe7 100644 --- a/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp +++ b/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare.pass.cpp @@ -27,12 +27,12 @@ test() int ia[] = {1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[] = {1, 2, 3}; - assert(!std::lexicographical_compare(ia, ia+sa, ib, ib+2)); - assert(std::lexicographical_compare(ib, ib+2, ia, ia+sa)); - assert(!std::lexicographical_compare(ia, ia+sa, ib, ib+3)); - assert(std::lexicographical_compare(ib, ib+3, ia, ia+sa)); - assert(std::lexicographical_compare(ia, ia+sa, ib+1, ib+3)); - assert(!std::lexicographical_compare(ib+1, ib+3, ia, ia+sa)); + assert(!std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+2))); + assert( std::lexicographical_compare(Iter1(ib), Iter1(ib+2), Iter2(ia), Iter2(ia+sa))); + assert(!std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+3))); + assert( std::lexicographical_compare(Iter1(ib), Iter1(ib+3), Iter2(ia), Iter2(ia+sa))); + assert( std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib+1), Iter2(ib+3))); + assert(!std::lexicographical_compare(Iter1(ib+1), Iter1(ib+3), Iter2(ia), Iter2(ia+sa))); } int main() diff --git a/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp b/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp index f5f1c07fa..c1851560e 100644 --- a/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.lex.comparison/lexicographical_compare_comp.pass.cpp @@ -31,12 +31,12 @@ test() int ib[] = {1, 2, 3}; typedef std::greater C; C c; - assert(!std::lexicographical_compare(ia, ia+sa, ib, ib+2, c)); - assert(std::lexicographical_compare(ib, ib+2, ia, ia+sa, c)); - assert(!std::lexicographical_compare(ia, ia+sa, ib, ib+3, c)); - assert(std::lexicographical_compare(ib, ib+3, ia, ia+sa, c)); - assert(!std::lexicographical_compare(ia, ia+sa, ib+1, ib+3, c)); - assert(std::lexicographical_compare(ib+1, ib+3, ia, ia+sa, c)); + assert(!std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+2), c)); + assert( std::lexicographical_compare(Iter1(ib), Iter1(ib+2), Iter2(ia), Iter2(ia+sa), c)); + assert(!std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib), Iter2(ib+3), c)); + assert( std::lexicographical_compare(Iter1(ib), Iter1(ib+3), Iter2(ia), Iter2(ia+sa), c)); + assert(!std::lexicographical_compare(Iter1(ia), Iter1(ia+sa), Iter2(ib+1), Iter2(ib+3), c)); + assert( std::lexicographical_compare(Iter1(ib+1), Iter1(ib+3), Iter2(ia), Iter2(ia+sa), c)); } int main() diff --git a/test/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp index c99c6936e..74e9fe602 100644 --- a/test/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp @@ -58,10 +58,28 @@ test() test(1000); } +template +void test_eq0(Iter first, Iter last, Pred p) +{ + assert(first == std::max_element(first, last, p)); +} + +void test_eq() +{ + const size_t N = 10; + int* a = new int[N]; + for (int i = 0; i < N; ++i) + a[i] = 10; // all the same + test_eq0(a, a+N, std::less()); + test_eq0(a, a+N, std::greater()); + delete [] a; +} + int main() { test >(); test >(); test >(); test(); + test_eq(); } diff --git a/test/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp index 55d7215a4..2b5fdb1e0 100644 --- a/test/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp @@ -58,10 +58,28 @@ test() test(1000); } +template +void test_eq0(Iter first, Iter last, Pred p) +{ + assert(first == std::min_element(first, last, p)); +} + +void test_eq() +{ + const size_t N = 10; + int* a = new int[N]; + for (int i = 0; i < N; ++i) + a[i] = 10; // all the same + test_eq0(a, a+N, std::less()); + test_eq0(a, a+N, std::greater()); + delete [] a; +} + int main() { test >(); test >(); test >(); test(); + test_eq(); } diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp index 1774ffd7a..6ac972a25 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax.pass.cpp @@ -48,7 +48,7 @@ int main() #if _LIBCPP_STD_VER > 11 { // Note that you can't take a reference to a local var, since -// it's address is not a compile-time constant. +// its address is not a compile-time constant. constexpr static int x = 1; constexpr static int y = 0; constexpr auto p1 = std::minmax (x, y); diff --git a/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp b/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp index 66b2e7808..771c8f84a 100644 --- a/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp +++ b/test/algorithms/alg.sorting/alg.min.max/minmax_comp.pass.cpp @@ -51,7 +51,7 @@ int main() #if _LIBCPP_STD_VER > 11 { // Note that you can't take a reference to a local var, since -// it's address is not a compile-time constant. +// its address is not a compile-time constant. constexpr static int x = 1; constexpr static int y = 0; constexpr auto p1 = std::minmax(x, y, std::greater<>()); diff --git a/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp b/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp new file mode 100644 index 000000000..49ec06945 --- /dev/null +++ b/test/atomics/atomics.types.generic/trivially_copyable.fail.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// struct atomic +// { +// bool is_lock_free() const volatile noexcept; +// bool is_lock_free() const noexcept; +// void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; +// void store(T desr, memory_order m = memory_order_seq_cst) noexcept; +// T load(memory_order m = memory_order_seq_cst) const volatile noexcept; +// T load(memory_order m = memory_order_seq_cst) const noexcept; +// operator T() const volatile noexcept; +// operator T() const noexcept; +// T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; +// T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order s, memory_order f) volatile noexcept; +// bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order s, memory_order f) volatile noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order s, memory_order f) noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order m = memory_order_seq_cst) volatile noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order m = memory_order_seq_cst) noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order m = memory_order_seq_cst) volatile noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order m = memory_order_seq_cst) noexcept; +// +// atomic() noexcept = default; +// constexpr atomic(T desr) noexcept; +// atomic(const atomic&) = delete; +// atomic& operator=(const atomic&) = delete; +// atomic& operator=(const atomic&) volatile = delete; +// T operator=(T) volatile noexcept; +// T operator=(T) noexcept; +// }; + +#include +#include +#include +#include // for thread_id +#include // for nanoseconds + +struct NotTriviallyCopyable { + NotTriviallyCopyable ( int i ) : i_(i) {} + NotTriviallyCopyable ( const NotTriviallyCopyable &rhs) : i_(rhs.i_) {} + int i_; + }; + +template +void test ( T t ) { + std::atomic t0(t); + } + +int main() +{ + 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 new file mode 100644 index 000000000..8cdd0878d --- /dev/null +++ b/test/atomics/atomics.types.generic/trivially_copyable.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template +// struct atomic +// { +// bool is_lock_free() const volatile noexcept; +// bool is_lock_free() const noexcept; +// void store(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; +// void store(T desr, memory_order m = memory_order_seq_cst) noexcept; +// T load(memory_order m = memory_order_seq_cst) const volatile noexcept; +// T load(memory_order m = memory_order_seq_cst) const noexcept; +// operator T() const volatile noexcept; +// operator T() const noexcept; +// T exchange(T desr, memory_order m = memory_order_seq_cst) volatile noexcept; +// T exchange(T desr, memory_order m = memory_order_seq_cst) noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order s, memory_order f) volatile noexcept; +// bool compare_exchange_weak(T& expc, T desr, memory_order s, memory_order f) noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order s, memory_order f) volatile noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order s, memory_order f) noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order m = memory_order_seq_cst) volatile noexcept; +// bool compare_exchange_weak(T& expc, T desr, +// memory_order m = memory_order_seq_cst) noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order m = memory_order_seq_cst) volatile noexcept; +// bool compare_exchange_strong(T& expc, T desr, +// memory_order m = memory_order_seq_cst) noexcept; +// +// atomic() noexcept = default; +// constexpr atomic(T desr) noexcept; +// atomic(const atomic&) = delete; +// atomic& operator=(const atomic&) = delete; +// atomic& operator=(const atomic&) volatile = delete; +// T operator=(T) volatile noexcept; +// T operator=(T) noexcept; +// }; + +#include +#include +#include +#include // for thread_id +#include // for nanoseconds + +struct TriviallyCopyable { + TriviallyCopyable ( int i ) : i_(i) {} + int i_; + }; + +template +void test ( T t ) { + std::atomic t0(t); + } + +int main() +{ + test(TriviallyCopyable(42)); + test(std::this_thread::get_id()); + test(std::chrono::nanoseconds(2)); +} diff --git a/test/containers/associative/map/map.ops/count.pass.cpp b/test/containers/associative/map/map.ops/count.pass.cpp index 6628e3d89..9668055b8 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 #include "min_allocator.h" +#include "private_constructor.hpp" int main() { @@ -96,4 +97,77 @@ int main() } } #endif +#if _LIBCPP_STD_VER > 11 + { + typedef std::pair V; + typedef std::map> 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> 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/map/types.pass.cpp b/test/containers/associative/map/types.pass.cpp index 487b69f8c..d117deff6 100644 --- a/test/containers/associative/map/types.pass.cpp +++ b/test/containers/associative/map/types.pass.cpp @@ -37,31 +37,34 @@ int main() { { - static_assert((std::is_same::key_type, int>::value), ""); - static_assert((std::is_same::mapped_type, double>::value), ""); - static_assert((std::is_same::value_type, std::pair >::value), ""); - static_assert((std::is_same::key_compare, std::less >::value), ""); - static_assert((std::is_same::allocator_type, std::allocator > >::value), ""); - static_assert((std::is_same::reference, std::pair&>::value), ""); - static_assert((std::is_same::const_reference, const std::pair&>::value), ""); - static_assert((std::is_same::pointer, std::pair*>::value), ""); - static_assert((std::is_same::const_pointer, const std::pair*>::value), ""); - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + typedef std::map C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same > >::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same*>::value), ""); + static_assert((std::is_same*>::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); } #if __cplusplus >= 201103L { - static_assert((std::is_same, min_allocator>>::key_type, int>::value), ""); - static_assert((std::is_same, min_allocator>>::mapped_type, double>::value), ""); - static_assert((std::is_same, min_allocator>>::value_type, std::pair >::value), ""); - static_assert((std::is_same, min_allocator>>::key_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>>::allocator_type, min_allocator > >::value), ""); - static_assert((std::is_same, min_allocator>>::reference, std::pair&>::value), ""); - static_assert((std::is_same, min_allocator>>::const_reference, const std::pair&>::value), ""); - static_assert((std::is_same, min_allocator>>::pointer, min_pointer>>::value), ""); - static_assert((std::is_same, min_allocator>>::const_pointer, min_pointer>>::value), ""); - static_assert((std::is_same, min_allocator>>::size_type, std::size_t>::value), ""); - static_assert((std::is_same, min_allocator>>::difference_type, std::ptrdiff_t>::value), ""); + typedef std::map, min_allocator>> C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same > >::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same>>::value), ""); + static_assert((std::is_same>>::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); + static_assert((std::is_same::value), ""); } #endif } diff --git a/test/containers/associative/multimap/multimap.ops/count.pass.cpp b/test/containers/associative/multimap/multimap.ops/count.pass.cpp index 34c041328..2f172d11d 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 #include "min_allocator.h" +#include "private_constructor.hpp" int main() { @@ -89,4 +90,70 @@ int main() } } #endif + +#if _LIBCPP_STD_VER > 11 + { + typedef std::multimap> 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> M; + typedef M::size_type R; + + M m; + m.insert ( std::make_pair ( PC::make(5), 1 )); + m.insert ( std::make_pair ( PC::make(5), 2 )); + m.insert ( std::make_pair ( PC::make(5), 3 )); + m.insert ( std::make_pair ( PC::make(7), 1 )); + m.insert ( std::make_pair ( PC::make(7), 2 )); + m.insert ( std::make_pair ( PC::make(7), 3 )); + m.insert ( std::make_pair ( PC::make(9), 1 )); + m.insert ( std::make_pair ( PC::make(9), 2 )); + m.insert ( std::make_pair ( 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/multimap/types.pass.cpp b/test/containers/associative/multimap/types.pass.cpp index 82132f15d..a0f4db056 100644 --- a/test/containers/associative/multimap/types.pass.cpp +++ b/test/containers/associative/multimap/types.pass.cpp @@ -37,31 +37,34 @@ int main() { { - static_assert((std::is_same::key_type, int>::value), ""); - static_assert((std::is_same::mapped_type, double>::value), ""); - static_assert((std::is_same::value_type, std::pair >::value), ""); - static_assert((std::is_same::key_compare, std::less >::value), ""); - static_assert((std::is_same::allocator_type, std::allocator > >::value), ""); - static_assert((std::is_same::reference, std::pair&>::value), ""); - static_assert((std::is_same::const_reference, const std::pair&>::value), ""); - static_assert((std::is_same::pointer, std::pair*>::value), ""); - static_assert((std::is_same::const_pointer, const std::pair*>::value), ""); - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + typedef std::multimap C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same > >::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same*>::value), ""); + static_assert((std::is_same*>::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); } #if __cplusplus >= 201103L { - static_assert((std::is_same, min_allocator>>::key_type, int>::value), ""); - static_assert((std::is_same, min_allocator>>::mapped_type, double>::value), ""); - static_assert((std::is_same, min_allocator>>::value_type, std::pair >::value), ""); - static_assert((std::is_same, min_allocator>>::key_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>>::allocator_type, min_allocator > >::value), ""); - static_assert((std::is_same, min_allocator>>::reference, std::pair&>::value), ""); - static_assert((std::is_same, min_allocator>>::const_reference, const std::pair&>::value), ""); - static_assert((std::is_same, min_allocator>>::pointer, min_pointer>>::value), ""); - static_assert((std::is_same, min_allocator>>::const_pointer, min_pointer>>::value), ""); - static_assert((std::is_same, min_allocator>>::size_type, std::size_t>::value), ""); - static_assert((std::is_same, min_allocator>>::difference_type, std::ptrdiff_t>::value), ""); + typedef std::multimap, min_allocator>> C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same > >::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same&>::value), ""); + static_assert((std::is_same>>::value), ""); + static_assert((std::is_same>>::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); + static_assert((std::is_same::value), ""); } #endif } diff --git a/test/containers/associative/multiset/count.pass.cpp b/test/containers/associative/multiset/count.pass.cpp index 12af167a1..93bd6f80e 100644 --- a/test/containers/associative/multiset/count.pass.cpp +++ b/test/containers/associative/multiset/count.pass.cpp @@ -17,6 +17,7 @@ #include #include "min_allocator.h" +#include "private_constructor.hpp" int main() { @@ -90,4 +91,70 @@ int main() } } #endif +#if _LIBCPP_STD_VER > 11 + { + typedef int V; + typedef std::multiset> 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> 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/multiset/types.pass.cpp b/test/containers/associative/multiset/types.pass.cpp index da9c8d6b5..e1e3ad910 100644 --- a/test/containers/associative/multiset/types.pass.cpp +++ b/test/containers/associative/multiset/types.pass.cpp @@ -37,31 +37,34 @@ int main() { { - static_assert((std::is_same::key_type, int>::value), ""); - static_assert((std::is_same::value_type, int>::value), ""); - static_assert((std::is_same::key_compare, std::less >::value), ""); - static_assert((std::is_same::value_compare, std::less >::value), ""); - static_assert((std::is_same::allocator_type, std::allocator >::value), ""); - static_assert((std::is_same::reference, int&>::value), ""); - static_assert((std::is_same::const_reference, const int&>::value), ""); - static_assert((std::is_same::pointer, int*>::value), ""); - static_assert((std::is_same::const_pointer, const int*>::value), ""); - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + typedef std::multiset C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); } #if __cplusplus >= 201103L { - static_assert((std::is_same, min_allocator>::key_type, int>::value), ""); - static_assert((std::is_same, min_allocator>::value_type, int>::value), ""); - static_assert((std::is_same, min_allocator>::key_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>::value_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>::allocator_type, min_allocator>::value), ""); - static_assert((std::is_same, min_allocator>::reference, int&>::value), ""); - static_assert((std::is_same, min_allocator>::const_reference, const int&>::value), ""); - static_assert((std::is_same, min_allocator>::pointer, min_pointer>::value), ""); - static_assert((std::is_same, min_allocator>::const_pointer, min_pointer>::value), ""); - static_assert((std::is_same, min_allocator>::size_type, std::size_t>::value), ""); - static_assert((std::is_same, min_allocator>::difference_type, std::ptrdiff_t>::value), ""); + typedef std::multiset, min_allocator> C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same>::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same>::value), ""); + static_assert((std::is_same>::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); + static_assert((std::is_same::value), ""); } #endif } diff --git a/test/containers/associative/set/count.pass.cpp b/test/containers/associative/set/count.pass.cpp index a2dc177f2..32fe0b8bc 100644 --- a/test/containers/associative/set/count.pass.cpp +++ b/test/containers/associative/set/count.pass.cpp @@ -17,6 +17,7 @@ #include #include "min_allocator.h" +#include "private_constructor.hpp" int main() { @@ -92,4 +93,76 @@ int main() assert(r == 0); } #endif +#if _LIBCPP_STD_VER > 11 + { + typedef int V; + typedef std::set> 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> 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/associative/set/types.pass.cpp b/test/containers/associative/set/types.pass.cpp index 8d7bb68f0..3362c42ae 100644 --- a/test/containers/associative/set/types.pass.cpp +++ b/test/containers/associative/set/types.pass.cpp @@ -37,31 +37,34 @@ int main() { { - static_assert((std::is_same::key_type, int>::value), ""); - static_assert((std::is_same::value_type, int>::value), ""); - static_assert((std::is_same::key_compare, std::less >::value), ""); - static_assert((std::is_same::value_compare, std::less >::value), ""); - static_assert((std::is_same::allocator_type, std::allocator >::value), ""); - static_assert((std::is_same::reference, int&>::value), ""); - static_assert((std::is_same::const_reference, const int&>::value), ""); - static_assert((std::is_same::pointer, int*>::value), ""); - static_assert((std::is_same::const_pointer, const int*>::value), ""); - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + typedef std::set C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); } #if __cplusplus >= 201103L { - static_assert((std::is_same, min_allocator>::key_type, int>::value), ""); - static_assert((std::is_same, min_allocator>::value_type, int>::value), ""); - static_assert((std::is_same, min_allocator>::key_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>::value_compare, std::less >::value), ""); - static_assert((std::is_same, min_allocator>::allocator_type, min_allocator >::value), ""); - static_assert((std::is_same, min_allocator>::reference, int&>::value), ""); - static_assert((std::is_same, min_allocator>::const_reference, const int&>::value), ""); - static_assert((std::is_same, min_allocator>::pointer, min_pointer>::value), ""); - static_assert((std::is_same, min_allocator>::const_pointer, min_pointer>::value), ""); - static_assert((std::is_same, min_allocator>::size_type, std::size_t>::value), ""); - static_assert((std::is_same, min_allocator>::difference_type, std::ptrdiff_t>::value), ""); + typedef std::set, min_allocator> C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same>::value), ""); + static_assert((std::is_same>::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); + static_assert((std::is_same::value), ""); } #endif } diff --git a/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp b/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp index 15f49df39..8f732a06c 100644 --- a/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp +++ b/test/containers/sequences/deque/deque.capacity/resize_size.pass.cpp @@ -43,7 +43,7 @@ void test(C& c1, int size) { typedef typename C::const_iterator CI; - std::size_t c1_osize = c1.size(); + typename C::size_type c1_osize = c1.size(); c1.resize(size); assert(c1.size() == size); assert(distance(c1.begin(), c1.end()) == c1.size()); diff --git a/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp b/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp index 727b5d5d8..1d1522cbc 100644 --- a/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp +++ b/test/containers/sequences/deque/deque.capacity/resize_size_value.pass.cpp @@ -43,7 +43,7 @@ void test(C& c1, int size, int x) { typedef typename C::const_iterator CI; - std::size_t c1_osize = c1.size(); + typename C::size_type c1_osize = c1.size(); c1.resize(size, x); assert(c1.size() == size); assert(distance(c1.begin(), c1.end()) == c1.size()); diff --git a/test/containers/sequences/deque/types.pass.cpp b/test/containers/sequences/deque/types.pass.cpp index d32b65c90..da9470d8a 100644 --- a/test/containers/sequences/deque/types.pass.cpp +++ b/test/containers/sequences/deque/types.pass.cpp @@ -82,7 +82,8 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same>::value), ""); static_assert((std::is_same>::value), ""); - static_assert((std::is_same::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif diff --git a/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp b/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp index a15e786cd..ae381e65b 100644 --- a/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp +++ b/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp @@ -17,6 +17,17 @@ #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_; + }; + + int main() { { @@ -66,6 +77,32 @@ int main() c1.remove(0); assert(c1 == c2); } + { // LWG issue #526 + typedef int T; + typedef std::forward_list C; + int t1[] = {1, 2, 1, 3, 5, 8, 11}; + int t2[] = { 2, 3, 5, 8, 11}; + C c1(std::begin(t1), std::end(t1)); + C c2(std::begin(t2), std::end(t2)); + c1.remove(c1.front()); + assert(c1 == c2); + } + { + typedef S T; + typedef std::forward_list C; + int t1[] = {1, 2, 1, 3, 5, 8, 11, 1}; + int t2[] = { 2, 3, 5, 8, 11 }; + C c; + for(int *ip = std::end(t1); ip != std::begin(t1);) + c.push_front(S(*--ip)); + 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 ( *ip == it->get()); + } + assert ( it == c.end ()); + } #if __cplusplus >= 201103L { typedef int T; diff --git a/test/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp b/test/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp index 4c4e80c3d..ed408fbd6 100644 --- a/test/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp +++ b/test/containers/sequences/forwardlist/forwardlist.ops/remove_if.pass.cpp @@ -16,6 +16,8 @@ #include #include "min_allocator.h" +#include "counting_predicates.hpp" + bool g(int i) { @@ -26,98 +28,128 @@ int main() { { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list C; const T t1[] = {0, 5, 5, 0, 0, 0, 5}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list C; const T t1[] = {0, 0, 0, 0}; C c1(std::begin(t1), std::end(t1)); C c2; - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list C; const T t1[] = {5, 5, 5}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list C; C c1; C c2; - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == 0); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list C; const T t1[] = {5, 5, 5, 0}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } #if __cplusplus >= 201103L { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list> C; const T t1[] = {0, 5, 5, 0, 0, 0, 5}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list> C; const T t1[] = {0, 0, 0, 0}; C c1(std::begin(t1), std::end(t1)); C c2; - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list> C; const T t1[] = {5, 5, 5}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list> C; C c1; C c2; - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == 0); } { typedef int T; + typedef unary_counting_predicate Predicate; typedef std::forward_list> C; const T t1[] = {5, 5, 5, 0}; const T t2[] = {5, 5, 5}; C c1(std::begin(t1), std::end(t1)); C c2(std::begin(t2), std::end(t2)); - c1.remove_if(g); + Predicate cp(g); + c1.remove_if(std::ref(cp)); assert(c1 == c2); + assert(cp.count() == std::distance(std::begin(t1), std::end(t1))); } #endif } diff --git a/test/containers/sequences/forwardlist/types.pass.cpp b/test/containers/sequences/forwardlist/types.pass.cpp index 68cebf978..c95548710 100644 --- a/test/containers/sequences/forwardlist/types.pass.cpp +++ b/test/containers/sequences/forwardlist/types.pass.cpp @@ -32,22 +32,29 @@ int main() { - static_assert((std::is_same::value_type, char>::value), ""); - static_assert((std::is_same::allocator_type, std::allocator >::value), ""); - static_assert((std::is_same::reference, char&>::value), ""); - static_assert((std::is_same::const_reference, const char&>::value), ""); - static_assert((std::is_same::pointer, char*>::value), ""); - static_assert((std::is_same::const_pointer, const char*>::value), ""); - static_assert((std::is_same::size_type, std::size_t>::value), ""); - static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); + { + typedef std::forward_list C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + } #if __cplusplus >= 201103L - static_assert((std::is_same>::value_type, char>::value), ""); - static_assert((std::is_same>::allocator_type, min_allocator >::value), ""); - static_assert((std::is_same>::reference, char&>::value), ""); - static_assert((std::is_same>::const_reference, const char&>::value), ""); - static_assert((std::is_same>::pointer, min_pointer>::value), ""); - static_assert((std::is_same>::const_pointer, min_pointer>::value), ""); - static_assert((std::is_same>::size_type, std::size_t>::value), ""); - static_assert((std::is_same>::difference_type, std::ptrdiff_t>::value), ""); + { + typedef std::forward_list> C; + static_assert((std::is_same::value), ""); + static_assert((std::is_same >::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same>::value), ""); + static_assert((std::is_same>::value), ""); +// min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); + static_assert((std::is_same::value), ""); + } #endif } diff --git a/test/containers/sequences/list/list.ops/remove.pass.cpp b/test/containers/sequences/list/list.ops/remove.pass.cpp index 76d878d02..106c0527f 100644 --- a/test/containers/sequences/list/list.ops/remove.pass.cpp +++ b/test/containers/sequences/list/list.ops/remove.pass.cpp @@ -16,6 +16,17 @@ #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_; + }; + + int main() { { @@ -25,6 +36,27 @@ int main() c.remove(3); assert(c == std::list(a2, a2+3)); } + { // LWG issue #526 + int a1[] = {1, 2, 1, 3, 5, 8, 11}; + int a2[] = { 2, 3, 5, 8, 11}; + std::list c(a1, a1+7); + c.remove(c.front()); + assert(c == std::list(a2, a2+5)); + } + { + int a1[] = {1, 2, 1, 3, 5, 8, 11, 1}; + int a2[] = { 2, 3, 5, 8, 11 }; + std::list c; + for(int *ip = a1; ip < a1+8; ++ip) + c.push_back(S(*ip)); + c.remove(c.front()); + std::list::const_iterator it = c.begin(); + for(int *ip = a2; ip < a2+5; ++ip, ++it) { + assert ( it != c.end()); + assert ( *ip == it->get()); + } + assert ( it == c.end ()); + } #if __cplusplus >= 201103L { int a1[] = {1, 2, 3, 4}; diff --git a/test/containers/sequences/list/list.ops/remove_if.pass.cpp b/test/containers/sequences/list/list.ops/remove_if.pass.cpp index b45562abd..162919ed8 100644 --- a/test/containers/sequences/list/list.ops/remove_if.pass.cpp +++ b/test/containers/sequences/list/list.ops/remove_if.pass.cpp @@ -16,28 +16,49 @@ #include #include "min_allocator.h" +#include "counting_predicates.hpp" + +bool even(int i) +{ + return i % 2 == 0; +} bool g(int i) { return i < 3; } +typedef unary_counting_predicate Predicate; + int main() { { int a1[] = {1, 2, 3, 4}; int a2[] = {3, 4}; std::list c(a1, a1+4); - c.remove_if(g); + Predicate cp(g); + c.remove_if(std::ref(cp)); assert(c == std::list(a2, a2+2)); + assert(cp.count() == 4); + } + { + int a1[] = {1, 2, 3, 4}; + int a2[] = {1, 3}; + std::list c(a1, a1+4); + Predicate cp(even); + c.remove_if(std::ref(cp)); + assert(c == std::list(a2, a2+2)); + assert(cp.count() == 4); } #if __cplusplus >= 201103L { int a1[] = {1, 2, 3, 4}; int a2[] = {3, 4}; std::list> c(a1, a1+4); - c.remove_if(g); + Predicate cp(g); + c.remove_if(std::ref(cp)); assert((c == std::list>(a2, a2+2))); + assert(cp.count() == 4); } #endif } diff --git a/test/containers/sequences/vector.bool/find.pass.cpp b/test/containers/sequences/vector.bool/find.pass.cpp index 8bad87eff..75567a9b7 100644 --- a/test/containers/sequences/vector.bool/find.pass.cpp +++ b/test/containers/sequences/vector.bool/find.pass.cpp @@ -25,6 +25,7 @@ int main() std::vector b(i,true); std::vector::iterator j = std::find(b.begin()+1, b.end(), false); assert(j-b.begin() == i); + assert(b.end() == j); } } { @@ -33,6 +34,7 @@ int main() std::vector b(i,false); std::vector::iterator j = std::find(b.begin()+1, b.end(), true); assert(j-b.begin() == i); + assert(b.end() == j); } } } diff --git a/test/containers/sequences/vector/asan.pass.cpp b/test/containers/sequences/vector/asan.pass.cpp new file mode 100644 index 000000000..86c02b295 --- /dev/null +++ b/test/containers/sequences/vector/asan.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. +// +//===----------------------------------------------------------------------===// + +// + +// reference operator[](size_type n); + +#include +#include +#include + +#include "min_allocator.h" +#include "asan_testing.h" + +#ifndef _LIBCPP_HAS_NO_ASAN +extern "C" void __asan_set_error_exit_code(int); + +int main() +{ +#if __cplusplus >= 201103L + { + typedef int T; + typedef std::vector> C; + const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + C c(std::begin(t), std::end(t)); + c.reserve(2*c.size()); + T foo = c[c.size()]; // bad, but not caught by ASAN + } +#endif + + __asan_set_error_exit_code(0); + { + typedef int T; + typedef std::vector C; + const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + C c(std::begin(t), std::end(t)); + c.reserve(2*c.size()); + assert(is_contiguous_container_asan_correct(c)); + assert(!__sanitizer_verify_contiguous_container ( c.data(), c.data() + 1, c.data() + c.capacity())); + T foo = c[c.size()]; // should trigger ASAN + assert(false); // if we got here, ASAN didn't trigger + } +} +#else +int main () { return 0; } +#endif diff --git a/test/containers/sequences/vector/vector.capacity/capacity.pass.cpp b/test/containers/sequences/vector/vector.capacity/capacity.pass.cpp index a22c6dae3..21082c839 100644 --- a/test/containers/sequences/vector/vector.capacity/capacity.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/capacity.pass.cpp @@ -15,29 +15,34 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { { std::vector v; assert(v.capacity() == 0); + assert(is_contiguous_container_asan_correct(v)); } { std::vector v(100); assert(v.capacity() == 100); v.push_back(0); assert(v.capacity() > 101); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { std::vector> v; assert(v.capacity() == 0); + assert(is_contiguous_container_asan_correct(v)); } { std::vector> v(100); assert(v.capacity() == 100); v.push_back(0); assert(v.capacity() > 101); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.capacity/reserve.pass.cpp b/test/containers/sequences/vector/vector.capacity/reserve.pass.cpp index 2914af91a..4df5702f2 100644 --- a/test/containers/sequences/vector/vector.capacity/reserve.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/reserve.pass.cpp @@ -15,6 +15,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -22,6 +23,7 @@ int main() std::vector v; v.reserve(10); assert(v.capacity() >= 10); + assert(is_contiguous_container_asan_correct(v)); } { std::vector v(100); @@ -32,6 +34,7 @@ int main() v.reserve(150); assert(v.size() == 100); assert(v.capacity() == 150); + assert(is_contiguous_container_asan_correct(v)); } { std::vector > v(100); @@ -42,12 +45,14 @@ int main() v.reserve(150); assert(v.size() == 100); assert(v.capacity() == 150); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { std::vector> v; v.reserve(10); assert(v.capacity() >= 10); + assert(is_contiguous_container_asan_correct(v)); } { std::vector> v(100); @@ -58,6 +63,7 @@ int main() v.reserve(150); assert(v.size() == 100); assert(v.capacity() == 150); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/test/containers/sequences/vector/vector.capacity/resize_size.pass.cpp index e415cee04..a47c5131d 100644 --- a/test/containers/sequences/vector/vector.capacity/resize_size.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/resize_size.pass.cpp @@ -16,6 +16,7 @@ #include "../../../stack_allocator.h" #include "../../../MoveOnly.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -25,18 +26,22 @@ int main() v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } { std::vector > v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES { @@ -44,18 +49,22 @@ int main() v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } { std::vector > v(100); v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #if __cplusplus >= 201103L @@ -64,9 +73,11 @@ int main() v.resize(50); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp b/test/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp index 49f373a09..de5126b03 100644 --- a/test/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp @@ -15,6 +15,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -27,6 +28,7 @@ int main() v.resize(200, 1); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); for (unsigned i = 0; i < 50; ++i) assert(v[i] == 0); for (unsigned i = 50; i < 200; ++i) @@ -40,6 +42,7 @@ int main() v.resize(200, 1); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { @@ -47,10 +50,12 @@ int main() v.resize(50, 1); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); assert((v == std::vector>(50))); v.resize(200, 1); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); for (unsigned i = 0; i < 50; ++i) assert(v[i] == 0); for (unsigned i = 50; i < 200; ++i) @@ -61,9 +66,11 @@ int main() v.resize(50, 1); assert(v.size() == 50); assert(v.capacity() == 100); + assert(is_contiguous_container_asan_correct(v)); v.resize(200, 1); assert(v.size() == 200); assert(v.capacity() >= 200); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp b/test/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp index 6b0cce4eb..49ab9cc71 100644 --- a/test/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -15,39 +15,48 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { { std::vector v(100); v.push_back(1); + assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); assert(v.capacity() == 101); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); } { std::vector > v(100); v.push_back(1); + assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); assert(v.capacity() == 101); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); } #ifndef _LIBCPP_NO_EXCEPTIONS { std::vector > v(100); v.push_back(1); + assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); assert(v.capacity() == 200); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); } #endif #if __cplusplus >= 201103L { std::vector> v(100); v.push_back(1); + assert(is_contiguous_container_asan_correct(v)); v.shrink_to_fit(); assert(v.capacity() == 101); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.capacity/swap.pass.cpp b/test/containers/sequences/vector/vector.capacity/swap.pass.cpp index 46d84033a..f3d9289c3 100644 --- a/test/containers/sequences/vector/vector.capacity/swap.pass.cpp +++ b/test/containers/sequences/vector/vector.capacity/swap.pass.cpp @@ -15,27 +15,36 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { { std::vector v1(100); std::vector v2(200); + assert(is_contiguous_container_asan_correct(v1)); + assert(is_contiguous_container_asan_correct(v2)); v1.swap(v2); assert(v1.size() == 200); assert(v1.capacity() == 200); + assert(is_contiguous_container_asan_correct(v1)); assert(v2.size() == 100); assert(v2.capacity() == 100); + assert(is_contiguous_container_asan_correct(v2)); } #if __cplusplus >= 201103L { std::vector> v1(100); std::vector> v2(200); + assert(is_contiguous_container_asan_correct(v1)); + assert(is_contiguous_container_asan_correct(v2)); v1.swap(v2); assert(v1.size() == 200); assert(v1.capacity() == 200); + assert(is_contiguous_container_asan_correct(v1)); assert(v2.size() == 100); assert(v2.capacity() == 100); + assert(is_contiguous_container_asan_correct(v2)); } #endif } diff --git a/test/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/test/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp index c0dafce02..f5c06b1a1 100644 --- a/test/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp @@ -15,6 +15,7 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -23,6 +24,7 @@ int main() std::vector d; d.assign({3, 4, 5, 6}); assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); @@ -33,6 +35,7 @@ int main() std::vector> d; d.assign({3, 4, 5, 6}); assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); diff --git a/test/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/test/containers/sequences/vector/vector.cons/assign_move.pass.cpp index 1365038cb..d87ac8636 100644 --- a/test/containers/sequences/vector/vector.cons/assign_move.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/assign_move.pass.cpp @@ -16,6 +16,7 @@ #include "../../../MoveOnly.h" #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -28,54 +29,72 @@ int main() l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(test_allocator(5)); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(test_allocator(6)); l2 = std::move(l); assert(l2 == lo); assert(!l.empty()); assert(l2.get_allocator() == test_allocator(6)); + assert(is_contiguous_container_asan_correct(l2)); } { std::vector > l(other_allocator(5)); std::vector > lo(other_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(other_allocator(6)); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } #if __cplusplus >= 201103L { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(min_allocator{}); l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/test/containers/sequences/vector/vector.cons/construct_default.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_default.pass.cpp index 48c8cf810..75772bef7 100644 --- a/test/containers/sequences/vector/vector.cons/construct_default.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_default.pass.cpp @@ -18,6 +18,7 @@ #include "../../../NotConstructible.h" #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -27,11 +28,13 @@ test0() assert(c.__invariants()); assert(c.empty()); assert(c.get_allocator() == typename C::allocator_type()); + assert(is_contiguous_container_asan_correct(c)); #if __cplusplus >= 201103L C c1 = {}; assert(c1.__invariants()); assert(c1.empty()); assert(c1.get_allocator() == typename C::allocator_type()); + assert(is_contiguous_container_asan_correct(c1)); #endif } @@ -43,6 +46,7 @@ test1(const typename C::allocator_type& a) assert(c.__invariants()); assert(c.empty()); assert(c.get_allocator() == a); + assert(is_contiguous_container_asan_correct(c)); } int main() diff --git a/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp index 8dde17fb3..36e231acc 100644 --- a/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp @@ -17,6 +17,7 @@ #include "test_iterators.h" #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -25,6 +26,7 @@ test(Iterator first, Iterator last) C c(first, last); assert(c.__invariants()); assert(c.size() == std::distance(first, last)); + assert(is_contiguous_container_asan_correct(c)); for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) assert(*i == *first); } diff --git a/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp index 9edc10c80..7fa748a90 100644 --- a/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp @@ -18,6 +18,7 @@ #include "test_iterators.h" #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -26,6 +27,7 @@ test(Iterator first, Iterator last, const A& a) C c(first, last, a); assert(c.__invariants()); assert(c.size() == std::distance(first, last)); + assert(is_contiguous_container_asan_correct(c)); for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i, ++first) assert(*i == *first); } diff --git a/test/containers/sequences/vector/vector.cons/construct_size.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_size.pass.cpp index c6bbf6eca..e03389593 100644 --- a/test/containers/sequences/vector/vector.cons/construct_size.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_size.pass.cpp @@ -17,6 +17,7 @@ #include "DefaultOnly.h" #include "min_allocator.h" #include "test_allocator.h" +#include "asan_testing.h" template void @@ -27,6 +28,7 @@ test2(typename C::size_type n, typename C::allocator_type const& a = typename C: assert(c.__invariants()); assert(c.size() == n); assert(c.get_allocator() == a); + assert(is_contiguous_container_asan_correct(c)); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) assert(*i == typename C::value_type()); @@ -42,6 +44,7 @@ test1(typename C::size_type n) assert(c.__invariants()); assert(c.size() == n); assert(c.get_allocator() == typename C::allocator_type()); + assert(is_contiguous_container_asan_correct(c)); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) assert(*i == typename C::value_type()); diff --git a/test/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp index 6a52d52af..5b6c49857 100644 --- a/test/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp @@ -16,6 +16,7 @@ #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -24,6 +25,7 @@ test(typename C::size_type n, const typename C::value_type& x) C c(n, x); assert(c.__invariants()); assert(c.size() == n); + assert(is_contiguous_container_asan_correct(c)); for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) assert(*i == x); } diff --git a/test/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp b/test/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp index 5653521f2..c62b84104 100644 --- a/test/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/construct_size_value_alloc.pass.cpp @@ -14,6 +14,7 @@ #include #include #include "min_allocator.h" +#include "asan_testing.h" template void @@ -24,6 +25,7 @@ test(typename C::size_type n, const typename C::value_type& x, assert(c.__invariants()); assert(a == c.get_allocator()); assert(c.size() == n); + assert(is_contiguous_container_asan_correct(c)); for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i) assert(*i == x); } diff --git a/test/containers/sequences/vector/vector.cons/copy.pass.cpp b/test/containers/sequences/vector/vector.cons/copy.pass.cpp index 6962f7035..677963dee 100644 --- a/test/containers/sequences/vector/vector.cons/copy.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/copy.pass.cpp @@ -15,6 +15,7 @@ #include #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -25,6 +26,7 @@ test(const C& x) assert(c.__invariants()); assert(c.size() == s); assert(c == x); + assert(is_contiguous_container_asan_correct(c)); } int main() @@ -37,15 +39,23 @@ int main() { std::vector > v(3, 2, test_allocator(5)); std::vector > v2 = v; + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); assert(v2 == v); assert(v2.get_allocator() == v.get_allocator()); + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); } #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE { std::vector > v(3, 2, other_allocator(5)); std::vector > v2 = v; + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); assert(v2 == v); assert(v2.get_allocator() == other_allocator(-2)); + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); } #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE #if __cplusplus >= 201103L @@ -57,8 +67,12 @@ int main() { std::vector > v(3, 2, min_allocator()); std::vector > v2 = v; + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); assert(v2 == v); assert(v2.get_allocator() == v.get_allocator()); + assert(is_contiguous_container_asan_correct(v)); + assert(is_contiguous_container_asan_correct(v2)); } #endif } diff --git a/test/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp b/test/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp index 7ff2a1e17..128328c2a 100644 --- a/test/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp @@ -15,6 +15,7 @@ #include #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" template void @@ -25,6 +26,7 @@ test(const C& x, const typename C::allocator_type& a) assert(c.__invariants()); assert(c.size() == s); assert(c == x); + assert(is_contiguous_container_asan_correct(c)); } int main() diff --git a/test/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/test/containers/sequences/vector/vector.cons/initializer_list.pass.cpp index f231fcf8a..7eb834ff3 100644 --- a/test/containers/sequences/vector/vector.cons/initializer_list.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/initializer_list.pass.cpp @@ -14,6 +14,7 @@ #include #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -21,6 +22,7 @@ int main() { std::vector d = {3, 4, 5, 6}; assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); @@ -30,6 +32,7 @@ int main() { std::vector> d = {3, 4, 5, 6}; assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); diff --git a/test/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/test/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp index b57d2ed17..5d7ae884e 100644 --- a/test/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp @@ -16,6 +16,7 @@ #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -24,6 +25,7 @@ int main() std::vector> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); @@ -34,6 +36,7 @@ int main() std::vector> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); diff --git a/test/containers/sequences/vector/vector.cons/move.pass.cpp b/test/containers/sequences/vector/vector.cons/move.pass.cpp index f09e3467a..bb61d5494 100644 --- a/test/containers/sequences/vector/vector.cons/move.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/move.pass.cpp @@ -16,6 +16,7 @@ #include "../../../MoveOnly.h" #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -23,58 +24,79 @@ int main() { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } { std::vector > l(other_allocator(5)); std::vector > lo(other_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } { int a1[] = {1, 3, 7, 9, 10}; std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0])); + assert(is_contiguous_container_asan_correct(c1)); std::vector::const_iterator i = c1.begin(); std::vector c2 = std::move(c1); + assert(is_contiguous_container_asan_correct(c2)); std::vector::iterator j = c2.erase(i); assert(*j == 3); + assert(is_contiguous_container_asan_correct(c2)); } #if __cplusplus >= 201103L { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2 = std::move(l); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } { int a1[] = {1, 3, 7, 9, 10}; std::vector> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); + assert(is_contiguous_container_asan_correct(c1)); std::vector>::const_iterator i = c1.begin(); std::vector> c2 = std::move(c1); + assert(is_contiguous_container_asan_correct(c2)); std::vector>::iterator j = c2.erase(i); assert(*j == 3); + assert(is_contiguous_container_asan_correct(c2)); } #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/test/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/test/containers/sequences/vector/vector.cons/move_alloc.pass.cpp index 0aac64dc0..1923e68f7 100644 --- a/test/containers/sequences/vector/vector.cons/move_alloc.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/move_alloc.pass.cpp @@ -16,6 +16,7 @@ #include "../../../MoveOnly.h" #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -23,55 +24,75 @@ int main() { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(std::move(l), test_allocator(6)); assert(l2 == lo); assert(!l.empty()); assert(l2.get_allocator() == test_allocator(6)); + assert(is_contiguous_container_asan_correct(l2)); } { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(std::move(l), test_allocator(5)); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == test_allocator(5)); + assert(is_contiguous_container_asan_correct(l2)); } { std::vector > l(other_allocator(5)); std::vector > lo(other_allocator(5)); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(std::move(l), other_allocator(4)); assert(l2 == lo); assert(!l.empty()); assert(l2.get_allocator() == other_allocator(4)); + assert(is_contiguous_container_asan_correct(l2)); } #if __cplusplus >= 201103L { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); for (int i = 1; i <= 3; ++i) { l.push_back(i); lo.push_back(i); } + assert(is_contiguous_container_asan_correct(l)); + assert(is_contiguous_container_asan_correct(lo)); std::vector > l2(std::move(l), min_allocator()); assert(l2 == lo); assert(l.empty()); assert(l2.get_allocator() == min_allocator()); + assert(is_contiguous_container_asan_correct(l2)); } #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/test/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/test/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp index 13ec845ec..592b71462 100644 --- a/test/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp @@ -15,6 +15,7 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -23,6 +24,7 @@ int main() std::vector d; d = {3, 4, 5, 6}; assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); @@ -33,6 +35,7 @@ int main() std::vector> d; d = {3, 4, 5, 6}; assert(d.size() == 4); + assert(is_contiguous_container_asan_correct(d)); assert(d[0] == 3); assert(d[1] == 4); assert(d[2] == 5); diff --git a/test/containers/sequences/vector/vector.data/data.pass.cpp b/test/containers/sequences/vector/vector.data/data.pass.cpp index 4bda599a8..aed56bc09 100644 --- a/test/containers/sequences/vector/vector.data/data.pass.cpp +++ b/test/containers/sequences/vector/vector.data/data.pass.cpp @@ -15,25 +15,30 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { { std::vector v; assert(v.data() == 0); + assert(is_contiguous_container_asan_correct(v)); } { std::vector v(100); assert(v.data() == &v.front()); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { std::vector> v; assert(v.data() == 0); + assert(is_contiguous_container_asan_correct(v)); } { std::vector> v(100); assert(v.data() == &v.front()); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.data/data_const.pass.cpp b/test/containers/sequences/vector/vector.data/data_const.pass.cpp index 7cb64f85d..cb6062694 100644 --- a/test/containers/sequences/vector/vector.data/data_const.pass.cpp +++ b/test/containers/sequences/vector/vector.data/data_const.pass.cpp @@ -15,25 +15,30 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { { const std::vector v; assert(v.data() == 0); + assert(is_contiguous_container_asan_correct(v)); } { const std::vector v(100); assert(v.data() == &v.front()); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { const std::vector> v; assert(v.data() == 0); + assert(is_contiguous_container_asan_correct(v)); } { const std::vector> v(100); assert(v.data() == &v.front()); + assert(is_contiguous_container_asan_correct(v)); } #endif } diff --git a/test/containers/sequences/vector/vector.modifiers/emplace.pass.cpp b/test/containers/sequences/vector/vector.modifiers/emplace.pass.cpp index 37298a534..8af6bdacd 100644 --- a/test/containers/sequences/vector/vector.modifiers/emplace.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/emplace.pass.cpp @@ -19,6 +19,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -66,6 +67,7 @@ int main() assert(c.size() == 1); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); + assert(is_contiguous_container_asan_correct(c)); i = c.emplace(c.cend(), 3, 4.5); assert(i == c.end()-1); assert(c.size() == 2); @@ -73,6 +75,7 @@ int main() assert(c.front().getd() == 3.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); i = c.emplace(c.cbegin()+1, 4, 6.5); assert(i == c.begin()+1); assert(c.size() == 3); @@ -82,6 +85,7 @@ int main() assert(c[1].getd() == 6.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); } { std::vector > c; @@ -90,6 +94,7 @@ int main() assert(c.size() == 1); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); + assert(is_contiguous_container_asan_correct(c)); i = c.emplace(c.cend(), 3, 4.5); assert(i == c.end()-1); assert(c.size() == 2); @@ -97,6 +102,7 @@ int main() assert(c.front().getd() == 3.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); i = c.emplace(c.cbegin()+1, 4, 6.5); assert(i == c.begin()+1); assert(c.size() == 3); @@ -106,6 +112,7 @@ int main() assert(c[1].getd() == 6.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); } #if _LIBCPP_DEBUG >= 1 { diff --git a/test/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp b/test/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp index a399433ce..bbf91a425 100644 --- a/test/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/emplace_back.pass.cpp @@ -15,6 +15,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -61,12 +62,14 @@ int main() assert(c.size() == 1); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); + assert(is_contiguous_container_asan_correct(c)); c.emplace_back(3, 4.5); assert(c.size() == 2); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); } { std::vector > c; @@ -74,12 +77,14 @@ int main() assert(c.size() == 1); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); + assert(is_contiguous_container_asan_correct(c)); c.emplace_back(3, 4.5); assert(c.size() == 2); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); } #if __cplusplus >= 201103L { @@ -88,12 +93,14 @@ int main() assert(c.size() == 1); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); + assert(is_contiguous_container_asan_correct(c)); c.emplace_back(3, 4.5); assert(c.size() == 2); assert(c.front().geti() == 2); assert(c.front().getd() == 3.5); assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); + assert(is_contiguous_container_asan_correct(c)); } #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES diff --git a/test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp index 04ff22831..85a47073b 100644 --- a/test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp @@ -15,6 +15,7 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -22,31 +23,39 @@ int main() { std::vector v; v.reserve(3); + assert(is_contiguous_container_asan_correct(v)); v = { 1, 2, 3 }; v.emplace(v.begin(), v.back()); assert(v[0] == 3); + assert(is_contiguous_container_asan_correct(v)); } { std::vector v; v.reserve(4); + assert(is_contiguous_container_asan_correct(v)); v = { 1, 2, 3 }; v.emplace(v.begin(), v.back()); assert(v[0] == 3); + assert(is_contiguous_container_asan_correct(v)); } #if __cplusplus >= 201103L { std::vector> v; v.reserve(3); + assert(is_contiguous_container_asan_correct(v)); v = { 1, 2, 3 }; v.emplace(v.begin(), v.back()); assert(v[0] == 3); + assert(is_contiguous_container_asan_correct(v)); } { std::vector> v; v.reserve(4); + assert(is_contiguous_container_asan_correct(v)); v = { 1, 2, 3 }; v.emplace(v.begin(), v.back()); assert(v[0] == 3); + assert(is_contiguous_container_asan_correct(v)); } #endif #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS diff --git a/test/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/test/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp index fb9d8084f..7a850edda 100644 --- a/test/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -15,6 +15,7 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -22,6 +23,7 @@ int main() int a1[] = {1, 2, 3}; std::vector l1(a1, a1+3); std::vector::const_iterator i = l1.begin(); + assert(is_contiguous_container_asan_correct(l1)); ++i; std::vector::iterator j = l1.erase(i); assert(l1.size() == 2); @@ -29,21 +31,25 @@ int main() assert(*j == 3); assert(*l1.begin() == 1); assert(*next(l1.begin()) == 3); + assert(is_contiguous_container_asan_correct(l1)); j = l1.erase(j); assert(j == l1.end()); assert(l1.size() == 1); assert(distance(l1.begin(), l1.end()) == 1); assert(*l1.begin() == 1); + assert(is_contiguous_container_asan_correct(l1)); j = l1.erase(l1.begin()); assert(j == l1.end()); assert(l1.size() == 0); assert(distance(l1.begin(), l1.end()) == 0); + assert(is_contiguous_container_asan_correct(l1)); } #if __cplusplus >= 201103L { int a1[] = {1, 2, 3}; std::vector> l1(a1, a1+3); std::vector>::const_iterator i = l1.begin(); + assert(is_contiguous_container_asan_correct(l1)); ++i; std::vector>::iterator j = l1.erase(i); assert(l1.size() == 2); @@ -51,15 +57,18 @@ int main() assert(*j == 3); assert(*l1.begin() == 1); assert(*next(l1.begin()) == 3); + assert(is_contiguous_container_asan_correct(l1)); j = l1.erase(j); assert(j == l1.end()); assert(l1.size() == 1); assert(distance(l1.begin(), l1.end()) == 1); assert(*l1.begin() == 1); + assert(is_contiguous_container_asan_correct(l1)); j = l1.erase(l1.begin()); assert(j == l1.end()); assert(l1.size() == 0); assert(distance(l1.begin(), l1.end()) == 0); + assert(is_contiguous_container_asan_correct(l1)); } #endif } diff --git a/test/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/test/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp index e82d3a0dd..bfc18bc48 100644 --- a/test/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -15,84 +15,113 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { int a1[] = {1, 2, 3}; { std::vector l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector::iterator i = l1.erase(l1.cbegin(), l1.cbegin()); assert(l1.size() == 3); assert(distance(l1.cbegin(), l1.cend()) == 3); assert(i == l1.begin()); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin())); assert(l1.size() == 2); assert(distance(l1.cbegin(), l1.cend()) == 2); assert(i == l1.begin()); assert(l1 == std::vector(a1+1, a1+3)); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2)); assert(l1.size() == 1); assert(distance(l1.cbegin(), l1.cend()) == 1); assert(i == l1.begin()); assert(l1 == std::vector(a1+2, a1+3)); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3)); assert(l1.size() == 0); assert(distance(l1.cbegin(), l1.cend()) == 0); assert(i == l1.begin()); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector > outer(2, std::vector(1)); + assert(is_contiguous_container_asan_correct(outer)); + assert(is_contiguous_container_asan_correct(outer[0])); + assert(is_contiguous_container_asan_correct(outer[1])); outer.erase(outer.begin(), outer.begin()); assert(outer.size() == 2); assert(outer[0].size() == 1); assert(outer[1].size() == 1); + assert(is_contiguous_container_asan_correct(outer)); + assert(is_contiguous_container_asan_correct(outer[0])); + assert(is_contiguous_container_asan_correct(outer[1])); } #if __cplusplus >= 201103L { std::vector> l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector>::iterator i = l1.erase(l1.cbegin(), l1.cbegin()); assert(l1.size() == 3); assert(distance(l1.cbegin(), l1.cend()) == 3); assert(i == l1.begin()); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector> l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin())); assert(l1.size() == 2); assert(distance(l1.cbegin(), l1.cend()) == 2); assert(i == l1.begin()); assert((l1 == std::vector>(a1+1, a1+3))); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector> l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 2)); assert(l1.size() == 1); assert(distance(l1.cbegin(), l1.cend()) == 1); assert(i == l1.begin()); assert((l1 == std::vector>(a1+2, a1+3))); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector> l1(a1, a1+3); + assert(is_contiguous_container_asan_correct(l1)); std::vector>::iterator i = l1.erase(l1.cbegin(), next(l1.cbegin(), 3)); assert(l1.size() == 0); assert(distance(l1.cbegin(), l1.cend()) == 0); assert(i == l1.begin()); + assert(is_contiguous_container_asan_correct(l1)); } { std::vector>, min_allocator>>> outer(2, std::vector>(1)); + assert(is_contiguous_container_asan_correct(outer)); + assert(is_contiguous_container_asan_correct(outer[0])); + assert(is_contiguous_container_asan_correct(outer[1])); outer.erase(outer.begin(), outer.begin()); assert(outer.size() == 2); assert(outer[0].size() == 1); assert(outer[1].size() == 1); + assert(is_contiguous_container_asan_correct(outer)); + assert(is_contiguous_container_asan_correct(outer[0])); + assert(is_contiguous_container_asan_correct(outer[1])); } #endif } diff --git a/test/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/test/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp index 386a4f6b3..30b801788 100644 --- a/test/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp @@ -15,6 +15,7 @@ #include #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -23,6 +24,7 @@ int main() std::vector d(10, 1); std::vector::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); assert(d.size() == 14); + assert(is_contiguous_container_asan_correct(d)); assert(i == d.begin() + 2); assert(d[0] == 1); assert(d[1] == 1); @@ -44,6 +46,7 @@ int main() std::vector> d(10, 1); std::vector>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); assert(d.size() == 14); + assert(is_contiguous_container_asan_correct(d)); assert(i == d.begin() + 2); assert(d[0] == 1); assert(d[1] == 1); 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 97255b0b1..cf24a8714 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 @@ -21,6 +21,7 @@ #include "../../../stack_allocator.h" #include "test_iterators.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -31,6 +32,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, input_iterator(a), input_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -47,6 +49,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, forward_iterator(a), forward_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -63,6 +66,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, input_iterator(a), input_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -79,6 +83,7 @@ int main() std::vector::iterator i = v.insert(v.cbegin() + 10, forward_iterator(a), forward_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -107,6 +112,7 @@ int main() std::vector>::iterator i = v.insert(v.cbegin() + 10, input_iterator(a), input_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -123,6 +129,7 @@ int main() std::vector>::iterator i = v.insert(v.cbegin() + 10, forward_iterator(a), forward_iterator(a+N)); assert(v.size() == 100 + N); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) diff --git a/test/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp b/test/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp index 7ceb9332b..cf3715ccb 100644 --- a/test/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/insert_iter_rvalue.pass.cpp @@ -20,6 +20,7 @@ #include "../../../stack_allocator.h" #include "../../../MoveOnly.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -28,6 +29,7 @@ int main() std::vector v(100); std::vector::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3)); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -40,6 +42,7 @@ int main() std::vector > v(100); std::vector >::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3)); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -61,6 +64,7 @@ int main() std::vector> v(100); std::vector>::iterator i = v.insert(v.cbegin() + 10, MoveOnly(3)); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) 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 322c9ff71..42effc723 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 @@ -19,6 +19,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -26,6 +27,7 @@ int main() std::vector v(100); std::vector::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -39,6 +41,7 @@ int main() std::vector > v(100); std::vector >::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -61,6 +64,7 @@ int main() std::vector> v(100); std::vector>::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -74,6 +78,7 @@ int main() std::vector> v(100); std::vector>::iterator i = v.insert(v.cbegin() + 10, 5, 1); assert(v.size() == 105); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) 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 28c771817..feb74c059 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 @@ -19,6 +19,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -26,6 +27,7 @@ int main() std::vector v(100); std::vector::iterator i = v.insert(v.cbegin() + 10, 1); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -38,6 +40,7 @@ int main() std::vector > v(100); std::vector >::iterator i = v.insert(v.cbegin() + 10, 1); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) @@ -60,6 +63,7 @@ int main() std::vector> v(100); std::vector>::iterator i = v.insert(v.cbegin() + 10, 1); assert(v.size() == 101); + assert(is_contiguous_container_asan_correct(v)); assert(i == v.begin() + 10); int j; for (j = 0; j < 10; ++j) diff --git a/test/containers/sequences/vector/vector.modifiers/push_back.pass.cpp b/test/containers/sequences/vector/vector.modifiers/push_back.pass.cpp index 5446b7409..eeeba6242 100644 --- a/test/containers/sequences/vector/vector.modifiers/push_back.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/push_back.pass.cpp @@ -15,6 +15,7 @@ #include #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -22,22 +23,27 @@ int main() std::vector c; c.push_back(0); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(1); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(2); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(3); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(4); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); } @@ -45,22 +51,27 @@ int main() std::vector > c; c.push_back(0); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(1); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(2); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(3); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(4); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); } @@ -69,22 +80,27 @@ int main() std::vector> c; c.push_back(0); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(1); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(2); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(3); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); c.push_back(4); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == j); } diff --git a/test/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp b/test/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp index f232743b5..6615a25a6 100644 --- a/test/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp @@ -14,6 +14,8 @@ #include #include +#include "asan_testing.h" + // Flag that makes the copy constructor for CMyClass throw an exception static bool gCopyConstructorShouldThow = false; @@ -70,6 +72,8 @@ int main() vec.push_back(instance); std::vector vec2(vec); + assert(is_contiguous_container_asan_correct(vec)); + assert(is_contiguous_container_asan_correct(vec2)); gCopyConstructorShouldThow = true; try { @@ -77,5 +81,6 @@ int main() } catch (...) { assert(vec==vec2); + assert(is_contiguous_container_asan_correct(vec)); } } diff --git a/test/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/test/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp index bb1af29d3..be4889312 100644 --- a/test/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp +++ b/test/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp @@ -16,6 +16,7 @@ #include "../../../MoveOnly.h" #include "../../../stack_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -24,22 +25,27 @@ int main() std::vector c; c.push_back(MoveOnly(0)); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(1)); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(2)); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(3)); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(4)); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); } @@ -47,22 +53,27 @@ int main() std::vector > c; c.push_back(MoveOnly(0)); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(1)); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(2)); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(3)); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(4)); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); } @@ -71,22 +82,27 @@ int main() std::vector> c; c.push_back(MoveOnly(0)); assert(c.size() == 1); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(1)); assert(c.size() == 2); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(2)); assert(c.size() == 3); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(3)); assert(c.size() == 4); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); c.push_back(MoveOnly(4)); assert(c.size() == 5); + assert(is_contiguous_container_asan_correct(c)); for (int j = 0; j < c.size(); ++j) assert(c[j] == MoveOnly(j)); } diff --git a/test/containers/sequences/vector/vector.special/swap.pass.cpp b/test/containers/sequences/vector/vector.special/swap.pass.cpp index a7d0c40d6..27001aef7 100644 --- a/test/containers/sequences/vector/vector.special/swap.pass.cpp +++ b/test/containers/sequences/vector/vector.special/swap.pass.cpp @@ -16,6 +16,7 @@ #include #include "test_allocator.h" #include "min_allocator.h" +#include "asan_testing.h" int main() { @@ -24,40 +25,56 @@ int main() int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0])); std::vector c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1 == std::vector(a2, a2+sizeof(a2)/sizeof(a2[0]))); assert(c2 == std::vector(a1, a1+sizeof(a1)/sizeof(a1[0]))); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector c1(a1, a1); std::vector c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1 == std::vector(a2, a2+sizeof(a2)/sizeof(a2[0]))); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0])); std::vector c2(a2, a2); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); assert(c2 == std::vector(a1, a1+sizeof(a1)/sizeof(a1[0]))); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector c1(a1, a1); std::vector c2(a2, a2); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } #ifndef _LIBCPP_DEBUG_LEVEL // This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1 @@ -80,11 +97,15 @@ int main() typedef other_allocator A; std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A(1)); std::vector c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A(2)); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert((c1 == std::vector(a2, a2+sizeof(a2)/sizeof(a2[0])))); assert(c1.get_allocator() == A(2)); assert((c2 == std::vector(a1, a1+sizeof(a1)/sizeof(a1[0])))); assert(c2.get_allocator() == A(1)); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } #if __cplusplus >= 201103L { @@ -92,40 +113,56 @@ int main() int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); std::vector> c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert((c1 == std::vector>(a2, a2+sizeof(a2)/sizeof(a2[0])))); assert((c2 == std::vector>(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector> c1(a1, a1); std::vector> c2(a2, a2+sizeof(a2)/sizeof(a2[0])); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert((c1 == std::vector>(a2, a2+sizeof(a2)/sizeof(a2[0])))); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); std::vector> c2(a2, a2); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); assert((c2 == std::vector>(a1, a1+sizeof(a1)/sizeof(a1[0])))); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } { int a1[] = {1, 3, 7, 9, 10}; int a2[] = {0, 2, 4, 5, 6, 8, 11}; std::vector> c1(a1, a1); std::vector> c2(a2, a2); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert(c1.empty()); assert(distance(c1.begin(), c1.end()) == 0); assert(c2.empty()); assert(distance(c2.begin(), c2.end()) == 0); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } #ifndef _LIBCPP_DEBUG_LEVEL // This test known to result in undefined behavior detected by _LIBCPP_DEBUG_LEVEL >= 1 @@ -135,11 +172,15 @@ int main() typedef min_allocator A; std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0]), A()); std::vector c2(a2, a2+sizeof(a2)/sizeof(a2[0]), A()); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); swap(c1, c2); assert((c1 == std::vector(a2, a2+sizeof(a2)/sizeof(a2[0])))); assert(c1.get_allocator() == A()); assert((c2 == std::vector(a1, a1+sizeof(a1)/sizeof(a1[0])))); assert(c2.get_allocator() == A()); + assert(is_contiguous_container_asan_correct(c1)); + assert(is_contiguous_container_asan_correct(c2)); } #endif #endif diff --git a/test/containers/unord/unord.map/bucket_count.pass.cpp b/test/containers/unord/unord.map/bucket_count.pass.cpp index 9b8b4abf5..d3e80d863 100644 --- a/test/containers/unord/unord.map/bucket_count.pass.cpp +++ b/test/containers/unord/unord.map/bucket_count.pass.cpp @@ -39,7 +39,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -67,7 +67,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/count.pass.cpp b/test/containers/unord/unord.map/count.pass.cpp index ebacf2baa..50abb5346 100644 --- a/test/containers/unord/unord.map/count.pass.cpp +++ b/test/containers/unord/unord.map/count.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -51,7 +51,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/eq.pass.cpp b/test/containers/unord/unord.map/eq.pass.cpp index 17184e6a6..9258378eb 100644 --- a/test/containers/unord/unord.map/eq.pass.cpp +++ b/test/containers/unord/unord.map/eq.pass.cpp @@ -35,7 +35,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -73,7 +73,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -101,7 +101,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -121,7 +121,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -141,7 +141,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/equal_range_const.pass.cpp b/test/containers/unord/unord.map/equal_range_const.pass.cpp index d61c2e22c..fe166c965 100644 --- a/test/containers/unord/unord.map/equal_range_const.pass.cpp +++ b/test/containers/unord/unord.map/equal_range_const.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -57,7 +57,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/equal_range_non_const.pass.cpp b/test/containers/unord/unord.map/equal_range_non_const.pass.cpp index 508205aa6..9e8d1a964 100644 --- a/test/containers/unord/unord.map/equal_range_non_const.pass.cpp +++ b/test/containers/unord/unord.map/equal_range_non_const.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -57,7 +57,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/find_const.pass.cpp b/test/containers/unord/unord.map/find_const.pass.cpp index ee897d9ca..120efa306 100644 --- a/test/containers/unord/unord.map/find_const.pass.cpp +++ b/test/containers/unord/unord.map/find_const.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/find_non_const.pass.cpp b/test/containers/unord/unord.map/find_non_const.pass.cpp index efab12bba..7582a796d 100644 --- a/test/containers/unord/unord.map/find_non_const.pass.cpp +++ b/test/containers/unord/unord.map/find_non_const.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/load_factor.pass.cpp b/test/containers/unord/unord.map/load_factor.pass.cpp index 3b12480b0..472e41abf 100644 --- a/test/containers/unord/unord.map/load_factor.pass.cpp +++ b/test/containers/unord/unord.map/load_factor.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -57,7 +57,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.map/swap_member.pass.cpp b/test/containers/unord/unord.map/swap_member.pass.cpp index 6e6503e30..8ab1eb621 100644 --- a/test/containers/unord/unord.map/swap_member.pass.cpp +++ b/test/containers/unord/unord.map/swap_member.pass.cpp @@ -66,7 +66,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -82,7 +82,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -165,7 +165,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -181,7 +181,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -247,7 +247,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -263,7 +263,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -346,7 +346,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -362,7 +362,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -428,7 +428,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -444,7 +444,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -527,7 +527,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -543,7 +543,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); diff --git a/test/containers/unord/unord.map/types.pass.cpp b/test/containers/unord/unord.map/types.pass.cpp index 2f3eab151..b53ff8e15 100644 --- a/test/containers/unord/unord.map/types.pass.cpp +++ b/test/containers/unord/unord.map/types.pass.cpp @@ -64,7 +64,8 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same>::value), ""); static_assert((std::is_same>::value), ""); - static_assert((std::is_same::value), ""); + // min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif diff --git a/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp b/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp index 6993a7e3f..7e04b8db1 100644 --- a/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp +++ b/test/containers/unord/unord.map/unord.map.swap/swap_non_member.pass.cpp @@ -66,7 +66,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -82,7 +82,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -165,7 +165,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -181,7 +181,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -247,7 +247,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -263,7 +263,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -346,7 +346,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -362,7 +362,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -428,7 +428,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -444,7 +444,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); @@ -527,7 +527,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -543,7 +543,7 @@ int main() assert(c1.at(10) == "ten"); assert(c1.at(20) == "twenty"); assert(c1.at(30) == "thirty"); - assert(c1.at(40) == "fourty"); + assert(c1.at(40) == "forty"); assert(c1.at(50) == "fifty"); assert(c1.at(60) == "sixty"); assert(c1.at(70) == "seventy"); diff --git a/test/containers/unord/unord.multimap/bucket_count.pass.cpp b/test/containers/unord/unord.multimap/bucket_count.pass.cpp index 66d84e93d..d44412fed 100644 --- a/test/containers/unord/unord.multimap/bucket_count.pass.cpp +++ b/test/containers/unord/unord.multimap/bucket_count.pass.cpp @@ -37,7 +37,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.multimap/count.pass.cpp b/test/containers/unord/unord.multimap/count.pass.cpp index 66ac28c6b..efaf02e3a 100644 --- a/test/containers/unord/unord.multimap/count.pass.cpp +++ b/test/containers/unord/unord.multimap/count.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), diff --git a/test/containers/unord/unord.multimap/eq.pass.cpp b/test/containers/unord/unord.multimap/eq.pass.cpp index 3e6eaf64c..3604e7792 100644 --- a/test/containers/unord/unord.multimap/eq.pass.cpp +++ b/test/containers/unord/unord.multimap/eq.pass.cpp @@ -36,7 +36,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), @@ -58,7 +58,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), @@ -80,7 +80,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), @@ -111,7 +111,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), @@ -134,7 +134,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), @@ -157,7 +157,7 @@ int main() P(20, "twenty"), P(20, "twenty 2"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fifty 2"), P(50, "fifty 3"), diff --git a/test/containers/unord/unord.multimap/equal_range_const.pass.cpp b/test/containers/unord/unord.multimap/equal_range_const.pass.cpp index 11116e95f..67613b094 100644 --- a/test/containers/unord/unord.multimap/equal_range_const.pass.cpp +++ b/test/containers/unord/unord.multimap/equal_range_const.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), @@ -68,7 +68,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), diff --git a/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp b/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp index 98d686234..eb4c019af 100644 --- a/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp +++ b/test/containers/unord/unord.multimap/equal_range_non_const.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), @@ -68,7 +68,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(50, "fiftyA"), P(50, "fiftyB"), diff --git a/test/containers/unord/unord.multimap/find_const.pass.cpp b/test/containers/unord/unord.multimap/find_const.pass.cpp index 0d9ccaa69..bc2650d11 100644 --- a/test/containers/unord/unord.multimap/find_const.pass.cpp +++ b/test/containers/unord/unord.multimap/find_const.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.multimap/find_non_const.pass.cpp b/test/containers/unord/unord.multimap/find_non_const.pass.cpp index fd623d99f..5a128c0f3 100644 --- a/test/containers/unord/unord.multimap/find_non_const.pass.cpp +++ b/test/containers/unord/unord.multimap/find_non_const.pass.cpp @@ -31,7 +31,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -54,7 +54,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.multimap/load_factor.pass.cpp b/test/containers/unord/unord.multimap/load_factor.pass.cpp index 0d25ef52e..f407097dc 100644 --- a/test/containers/unord/unord.multimap/load_factor.pass.cpp +++ b/test/containers/unord/unord.multimap/load_factor.pass.cpp @@ -32,7 +32,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -57,7 +57,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), diff --git a/test/containers/unord/unord.multimap/swap_member.pass.cpp b/test/containers/unord/unord.multimap/swap_member.pass.cpp index 12822a9e3..225eccd47 100644 --- a/test/containers/unord/unord.multimap/swap_member.pass.cpp +++ b/test/containers/unord/unord.multimap/swap_member.pass.cpp @@ -67,7 +67,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -83,7 +83,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -168,7 +168,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -184,7 +184,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -252,7 +252,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -268,7 +268,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -353,7 +353,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -369,7 +369,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -437,7 +437,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -453,7 +453,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -538,7 +538,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -554,7 +554,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); diff --git a/test/containers/unord/unord.multimap/types.pass.cpp b/test/containers/unord/unord.multimap/types.pass.cpp index 5235415c4..55ae74974 100644 --- a/test/containers/unord/unord.multimap/types.pass.cpp +++ b/test/containers/unord/unord.multimap/types.pass.cpp @@ -64,7 +64,8 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same>::value), ""); static_assert((std::is_same>::value), ""); - static_assert((std::is_same::value), ""); + // min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif diff --git a/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp b/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp index a73d7fc51..0f579e091 100644 --- a/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp +++ b/test/containers/unord/unord.multimap/unord.multimap.swap/swap_non_member.pass.cpp @@ -66,7 +66,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -82,7 +82,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -167,7 +167,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -183,7 +183,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -251,7 +251,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -267,7 +267,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -352,7 +352,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -368,7 +368,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -436,7 +436,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -452,7 +452,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); @@ -537,7 +537,7 @@ int main() P(10, "ten"), P(20, "twenty"), P(30, "thirty"), - P(40, "fourty"), + P(40, "forty"), P(50, "fifty"), P(60, "sixty"), P(70, "seventy"), @@ -553,7 +553,7 @@ int main() assert(c1.find(10)->second == "ten"); assert(c1.find(20)->second == "twenty"); assert(c1.find(30)->second == "thirty"); - assert(c1.find(40)->second == "fourty"); + assert(c1.find(40)->second == "forty"); assert(c1.find(50)->second == "fifty"); assert(c1.find(60)->second == "sixty"); assert(c1.find(70)->second == "seventy"); diff --git a/test/containers/unord/unord.multiset/types.pass.cpp b/test/containers/unord/unord.multiset/types.pass.cpp index 82b403daa..5222222d8 100644 --- a/test/containers/unord/unord.multiset/types.pass.cpp +++ b/test/containers/unord/unord.multiset/types.pass.cpp @@ -61,7 +61,8 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same>::value), ""); static_assert((std::is_same>::value), ""); - static_assert((std::is_same::value), ""); + // min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif diff --git a/test/containers/unord/unord.set/types.pass.cpp b/test/containers/unord/unord.set/types.pass.cpp index be0b359b2..7e752a434 100644 --- a/test/containers/unord/unord.set/types.pass.cpp +++ b/test/containers/unord/unord.set/types.pass.cpp @@ -61,7 +61,8 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same>::value), ""); static_assert((std::is_same>::value), ""); - static_assert((std::is_same::value), ""); + // min_allocator doesn't have a size_type, so one gets synthesized + static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif diff --git a/test/depr/depr.c.headers/math_h.pass.cpp b/test/depr/depr.c.headers/math_h.pass.cpp index 858e19066..b03a61b15 100644 --- a/test/depr/depr.c.headers/math_h.pass.cpp +++ b/test/depr/depr.c.headers/math_h.pass.cpp @@ -9,6 +9,8 @@ // +// XFAIL: linux + #include #include #include diff --git a/test/depr/depr.c.headers/stdio_h.pass.cpp b/test/depr/depr.c.headers/stdio_h.pass.cpp index 8e236e32b..d4cfbc80a 100644 --- a/test/depr/depr.c.headers/stdio_h.pass.cpp +++ b/test/depr/depr.c.headers/stdio_h.pass.cpp @@ -117,7 +117,9 @@ int main() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); +#if _LIBCPP_STD_VER < 14 static_assert((std::is_same::value), ""); +#endif static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp b/test/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp index 01a565634..eb15facad 100644 --- a/test/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp +++ b/test/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp @@ -19,23 +19,6 @@ #include #include -template -struct test_buf - : public std::basic_filebuf -{ - typedef std::basic_filebuf base; - typedef typename base::char_type char_type; - typedef typename base::int_type int_type; - typedef typename base::pos_type pos_type; - - char_type* eback() const {return base::eback();} - char_type* gptr() const {return base::gptr();} - char_type* egptr() const {return base::egptr();} - void gbump(int n) {base::gbump(n);} - - virtual int_type underflow() {return base::underflow();} -}; - int main() { { 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 18c8b8621..17ff642dc 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template T9 get_time(struct tm* tmb, const charT* fmt); @@ -46,7 +43,7 @@ int main() 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); @@ -62,7 +59,7 @@ int main() 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_time.pass.cpp b/test/input.output/iostream.format/ext.manip/put_time.pass.cpp index d64ca07f8..52a98a1b5 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 @@ int main() 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 @@ int main() 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.manip/ws.pass.cpp b/test/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp index d1fd89b68..3c8159a6d 100644 --- a/test/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp @@ -56,4 +56,24 @@ int main() assert(is.good()); assert(is.peek() == L'1'); } + { + testbuf sb(" "); + std::istream is(&sb); + ws(is); + assert(!is.fail()); + assert(is.eof()); + ws(is); + assert(is.eof()); + assert(is.fail()); + } + { + testbuf sb(L" "); + std::wistream is(&sb); + ws(is); + assert(!is.fail()); + assert(is.eof()); + ws(is); + assert(is.eof()); + assert(is.fail()); + } } diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index 3d4df9cbb..41a721d50 100644 --- a/test/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp index d060ccce4..cf06e343b 100644 --- a/test/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp index 545f94dd0..ccc354548 100644 --- a/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp index 636cf078d..20e70cfbd 100644 --- a/test/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // diff --git a/test/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp b/test/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp index 60f816df1..01eecb5d8 100644 --- a/test/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp +++ b/test/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // 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 59f381c85..61db67cd5 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 @@ int main() testbuf sb(" 123456789"); std::istream is(&sb); assert(is.sync() == 0); - assert(sync_called = 1); + assert(sync_called == 1); } { testbuf 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/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp b/test/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp index 3b2e15668..c46e2c054 100644 --- a/test/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp +++ b/test/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp b/test/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp index 9fa447659..509b83668 100644 --- a/test/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp +++ b/test/input.output/iostreams.base/ios/basic.ios.members/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.fr_FR.UTF-8 // diff --git a/test/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp b/test/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp index e19e18881..e44f4b325 100644 --- a/test/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp +++ b/test/input.output/iostreams.base/ios/basic.ios.members/swap.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp b/test/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp index 5df52d44a..deb2dc7c1 100644 --- a/test/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp +++ b/test/input.output/stream.buffers/streambuf/streambuf.members/streambuf.locales/locales.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp b/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp index fadc01563..6a609963d 100644 --- a/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp +++ b/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp @@ -26,24 +26,24 @@ test() int main() { test(); - test(); - test(); +// test(); // don't know + test(); test(); - test(); +// test(); // don't know #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS test(); test(); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS - test(); + test(); test(); - test(); + test(); test(); - test(); + test(); test(); - test(); + test(); test(); #ifndef _LIBCPP_HAS_NO_INT128 - test<__int128_t, true>(); + test<__int128_t, false>(); test<__uint128_t, true>(); #endif test(); diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 5343eda54..3362d99e0 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -1,11 +1,12 @@ @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@" +config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@" +config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" # Let the main config do the real work. lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg") diff --git a/test/localization/locale.categories/__scan_keyword.pass.cpp b/test/localization/locale.categories/__scan_keyword.pass.cpp index 6f75fbb75..b33aab9a7 100644 --- a/test/localization/locale.categories/__scan_keyword.pass.cpp +++ b/test/localization/locale.categories/__scan_keyword.pass.cpp @@ -22,7 +22,7 @@ // no keyword match is found. If no keyword match is found, __ke is returned. // Else an iterator pointing to the matching keyword is found. If more than // one keyword matches, an iterator to the first matching keyword is returned. -// If on exit __b == __e, eofbit is set in __err. If __case_senstive is false, +// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false, // __ct is used to force to lower case before comparing characters. // Examples: // Keywords: "a", "abb" 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 93408a804..6d9e1cde6 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 @@ -19,7 +19,7 @@ unsigned delete_called = 0; -void* operator new[](size_t sz) +void* operator new[](size_t sz) throw(std::bad_alloc) { return operator new(sz); } 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 43c131b34..91da9f781 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 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// Bionic's wchar_t ctype functions are only valid for the ASCII range. // XFAIL: android // XFAIL: androideabi 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 61fb0b0c1..cc6471994 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 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// Bionic's wchar_t ctype functions are only valid for the ASCII range. // XFAIL: android // XFAIL: androideabi 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 a73044501..904ced323 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 @@ -7,10 +7,8 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 -// REQUIRES: locale.fr_CA.UTF-8 +// REQUIRES: locale.fr_CA.ISO8859-1 // 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 6b7f38532..6f25b9cad 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 @@ -7,10 +7,8 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 -// REQUIRES: locale.fr_CA.UTF-8 +// REQUIRES: locale.fr_CA.ISO8859-1 // 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 b2e3e7a27..5a26dc657 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 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// Bionic's wchar_t ctype functions are only valid for the ASCII range. // XFAIL: android // XFAIL: androideabi 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 29b494ca3..bc07fcf03 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 @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +// Bionic's wchar_t ctype functions are only valid for the ASCII range. // XFAIL: android // XFAIL: androideabi 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 09230935d..f95714904 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,7 @@ // XFAIL: with_system_lib=x86_64-apple-darwin11 // XFAIL: with_system_lib=x86_64-apple-darwin12 +// XFAIL: linux #include #include 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 2bc7f678b..9579f4df8 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,7 @@ // XFAIL: with_system_lib=x86_64-apple-darwin11 // XFAIL: with_system_lib=x86_64-apple-darwin12 +// XFAIL: linux #include #include 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 73df7ab87..9b09e819a 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,7 @@ // XFAIL: with_system_lib=x86_64-apple-darwin11 // XFAIL: with_system_lib=x86_64-apple-darwin12 +// XFAIL: linux #include #include 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 51fbb04ce..87e9b9776 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,7 @@ // XFAIL: with_system_lib=x86_64-apple-darwin11 // XFAIL: with_system_lib=x86_64-apple-darwin12 +// XFAIL: linux #include #include 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 8d4c8526c..320e08db2 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,8 @@ // I doubt this test is portable +// XFAIL: linux + #include #include #include 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 a9ee704bb..b46ae3223 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 @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi - // // template class ctype_byname; @@ -18,6 +15,8 @@ // I doubt this test is portable +// XFAIL: linux + #include #include #include diff --git a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp index c631a7be3..d7ce1033a 100644 --- a/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // XFAIL: apple-darwin // REQUIRES: locale.fr_FR.UTF-8 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 731e49f5f..ec563fe4c 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 @@ -7,10 +7,14 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // 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 // 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 245336939..374443a2a 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.zh_CN.UTF-8 // diff --git a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp index 6d1e18496..8b620bca3 100644 --- a/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // XFAIL: apple-darwin // REQUIRES: locale.fr_FR.UTF-8 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 57fb73dd2..54bfcfb5c 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 @@ -7,10 +7,14 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // 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 // 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 334687b4c..242701e26 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.zh_CN.UTF-8 // diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp index c926db7e7..6d23d6361 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/curr_symbol.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // // XFAIL: apple-darwin -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 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 3174f0cef..6db1f56d2 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,8 +7,14 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi + +// 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 // diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp index d98285c68..4967914b3 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/frac_digits.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp index f53161de0..b0b9da0b6 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/grouping.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // // XFAIL: apple-darwin -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp index e12963983..3fe9faf84 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/neg_format.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // // XFAIL: apple-darwin -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp index 0e8c708be..45c58ef7e 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/negative_sign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp index 29ebb6c54..7038ab16e 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/pos_format.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // // XFAIL: apple-darwin -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp index c7fe4de1d..dadf0da3e 100644 --- a/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp +++ b/test/localization/locale.categories/category.monetary/locale.moneypunct.byname/positive_sign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 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 1674c0ef9..640b7cb70 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp index bad067116..963974d11 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/date_order.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp index cfec09555..c44debf35 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/date_order_wide.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 04351055a..9a06157ad 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 @@ -7,13 +7,15 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // 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 + // // class time_get_byname @@ -81,6 +83,7 @@ int main() 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 4e4175777..170f33ad9 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 @@ -7,13 +7,15 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // 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 + // // class time_get_byname 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 b3c0089f2..a924cef8c 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 60fa9a050..009dc490e 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 1cfd5d306..536859e93 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 5b0b48ed6..36c8a8e54 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp index 008f68a7d..8cea95de8 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_time.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp index 1c76ab7b9..452a35440 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_time_wide.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 89fb37513..db070be90 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 a5fe751fe..ac607bacc 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp index b1a90d866..676e7fff8 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_year.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/test/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp b/test/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp index 5c98996ce..1bdb8de60 100644 --- a/test/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.get.byname/get_year_wide.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 d892f9225..ff3bb823a 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 @@ -59,19 +57,19 @@ int main() std::ios ios(0); { const my_facet f(LOCALE_en_US_UTF_8, 1); - std::string pat("Today is %A which is abreviated %a."); + std::string pat("Today is %A which is abbreviated %a."); iter = f.put(output_iterator(str), ios, '*', &t, pat.data(), pat.data() + pat.size()); std::string ex(str, iter.base()); - assert(ex == "Today is Saturday which is abreviated Sat."); + assert(ex == "Today is Saturday which is abbreviated Sat."); } { const my_facet f(LOCALE_fr_FR_UTF_8, 1); - std::string pat("Today is %A which is abreviated %a."); + std::string pat("Today is %A which is abbreviated %a."); iter = f.put(output_iterator(str), ios, '*', &t, pat.data(), pat.data() + pat.size()); std::string ex(str, iter.base()); - assert((ex == "Today is Samedi which is abreviated Sam.")|| - (ex == "Today is samedi which is abreviated sam." )); + assert((ex == "Today is Samedi which is abbreviated Sam.")|| + (ex == "Today is samedi which is abbreviated sam." )); } } diff --git a/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp b/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp index 408141d7d..93d595206 100644 --- a/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp +++ b/test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put1.pass.cpp @@ -45,11 +45,11 @@ int main() t.tm_isdst = 1; std::ios ios(0); { - std::string pat("Today is %A which is abreviated %a."); + std::string pat("Today is %A which is abbreviated %a."); iter = f.put(output_iterator(str), ios, '*', &t, pat.data(), pat.data() + pat.size()); std::string ex(str, iter.base()); - assert(ex == "Today is Saturday which is abreviated Sat."); + assert(ex == "Today is Saturday which is abbreviated Sat."); } { std::string pat("The number of the month is %Om."); diff --git a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp index cb480e60a..b1f225cd8 100644 --- a/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp +++ b/test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi + +// REQUIRES: locale.en_US.UTF-8 +// REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 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 a38883084..b1da92d2f 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// // -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 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 1ac08ca8d..80b440ac9 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 @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 diff --git a/test/localization/locales/locale/locale.cons/assign.pass.cpp b/test/localization/locales/locale/locale.cons/assign.pass.cpp index f3268907a..4aca35440 100644 --- a/test/localization/locales/locale/locale.cons/assign.pass.cpp +++ b/test/localization/locales/locale/locale.cons/assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.ru_RU.UTF-8 // 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 090087a4b..8b4509bad 100644 --- a/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp +++ b/test/localization/locales/locale/locale.cons/char_pointer.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.zh_CN.UTF-8 diff --git a/test/localization/locales/locale/locale.cons/copy.pass.cpp b/test/localization/locales/locale/locale.cons/copy.pass.cpp index d48acb467..7dd7cf4c0 100644 --- a/test/localization/locales/locale/locale.cons/copy.pass.cpp +++ b/test/localization/locales/locale/locale.cons/copy.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.fr_FR.UTF-8 // 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 b7750bf8b..6bd1f6325 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 b223dda14..f7349aad8 100644 --- a/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp +++ b/test/localization/locales/locale/locale.cons/locale_facetptr.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.ru_RU.UTF-8 // 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 2978d16fa..05d87a481 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 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 8f30ec126..34718c8fb 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 @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.ru_RU.UTF-8 // diff --git a/test/localization/locales/locale/locale.cons/string.pass.cpp b/test/localization/locales/locale/locale.cons/string.pass.cpp index d2efff189..6c80df0de 100644 --- a/test/localization/locales/locale/locale.cons/string.pass.cpp +++ b/test/localization/locales/locale/locale.cons/string.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.ru_RU.UTF-8 // REQUIRES: locale.zh_CN.UTF-8 diff --git a/test/numerics/c.math/cmath.pass.cpp b/test/numerics/c.math/cmath.pass.cpp index 7c74d5b5b..973bea015 100644 --- a/test/numerics/c.math/cmath.pass.cpp +++ b/test/numerics/c.math/cmath.pass.cpp @@ -9,6 +9,9 @@ // +// NOTE: isinf and isnan are tested separately because they are expected to fail +// on linux. We don't want their expected failure to hide other failures in this file. + #include #include #include @@ -475,30 +478,6 @@ void test_isfinite() assert(std::isfinite(-1.0) == true); } -void test_isinf() -{ -#ifdef isinf -#error isinf defined -#endif - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - assert(std::isinf(-1.0) == false); -} - -void test_isnan() -{ -#ifdef isnan -#error isnan defined -#endif - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - static_assert((std::is_same::value), ""); - assert(std::isnan(-1.0) == false); -} - void test_isnormal() { #ifdef isnormal @@ -1318,8 +1297,6 @@ int main() test_signbit(); test_fpclassify(); test_isfinite(); - test_isinf(); - test_isnan(); test_isnormal(); test_isgreater(); test_isgreaterequal(); diff --git a/test/numerics/c.math/cmath_isinf.pass.cpp b/test/numerics/c.math/cmath_isinf.pass.cpp new file mode 100644 index 000000000..6cde04d9b --- /dev/null +++ b/test/numerics/c.math/cmath_isinf.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// isinf + +// XFAIL: linux + +#include +#include +#include + +int main() +{ +#ifdef isinf +#error isinf defined +#endif + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + assert(std::isinf(-1.0) == false); +} \ No newline at end of file diff --git a/test/numerics/c.math/cmath_isnan.pass.cpp b/test/numerics/c.math/cmath_isnan.pass.cpp new file mode 100644 index 000000000..7b33b9647 --- /dev/null +++ b/test/numerics/c.math/cmath_isnan.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// isnan + +// XFAIL: linux + +#include +#include +#include + +int main() +{ +#ifdef isnan +#error isnan defined +#endif + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + assert(std::isnan(-1.0) == false); +} diff --git a/test/numerics/complex.number/complex.ops/stream_input.pass.cpp b/test/numerics/complex.number/complex.ops/stream_input.pass.cpp index 107eefc01..24644e307 100644 --- a/test/numerics/complex.number/complex.ops/stream_input.pass.cpp +++ b/test/numerics/complex.number/complex.ops/stream_input.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// XFAIL: with_system_lib=x86_64-apple-darwin11 -// XFAIL: with_system_lib=x86_64-apple-darwin12 // 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 3bab0dfc9..29cb787d0 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 @@ int main() 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 v1(a1, 3); + std::valarray v2(a2, 3); + std::valarray const vb1(b1, 3); + std::mask_array m1 = v1[vb1]; + std::mask_array const m2 = v2[vb1]; + std::mask_array 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 b2b111ad7..79be4bdb0 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 v1(a1, sizeof(a1)/sizeof(a1[0])); @@ -40,4 +41,16 @@ int main() 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 v1(a1, 3); + const std::valarray v2(a2, 3); + std::slice_array s1 = v1[std::slice(1, 2, 3)]; + std::slice_array s2 = v1[std::slice(2, 2, 3)]; + std::slice_array 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 a7c38d4c1..dfa546be7 100644 --- a/test/numerics/rand/rand.device/ctor.pass.cpp +++ b/test/numerics/rand/rand.device/ctor.pass.cpp @@ -15,6 +15,7 @@ #include #include +#include int main() { @@ -29,6 +30,16 @@ 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::random_device r("/dev/urandom");; } diff --git a/test/numerics/rand/rand.device/eval.pass.cpp b/test/numerics/rand/rand.device/eval.pass.cpp index 2422635c9..72aff076a 100644 --- a/test/numerics/rand/rand.device/eval.pass.cpp +++ b/test/numerics/rand/rand.device/eval.pass.cpp @@ -18,6 +18,18 @@ int main() { - std::random_device r; - std::random_device::result_type e = r(); + { + std::random_device r; + std::random_device::result_type e = r(); + } + + try + { + std::random_device r("/dev/null"); + r(); + assert(false); + } + catch (const std::system_error& e) + { + } } 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 b8a2b7418..d63817d03 100644 --- a/test/re/re.alg/re.alg.match/basic.pass.cpp +++ b/test/re/re.alg/re.alg.match/basic.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 818e137b7..67df41028 100644 --- a/test/re/re.alg/re.alg.match/ecma.pass.cpp +++ b/test/re/re.alg/re.alg.match/ecma.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 0effeec3d..733c16ec4 100644 --- a/test/re/re.alg/re.alg.match/extended.pass.cpp +++ b/test/re/re.alg/re.alg.match/extended.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 e2959df57..74c25c1a5 100644 --- a/test/re/re.alg/re.alg.search/awk.pass.cpp +++ b/test/re/re.alg/re.alg.search/awk.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 e8f95a873..c8a5051d5 100644 --- a/test/re/re.alg/re.alg.search/basic.pass.cpp +++ b/test/re/re.alg/re.alg.search/basic.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 e9f86d7d6..965c29d6c 100644 --- a/test/re/re.alg/re.alg.search/ecma.pass.cpp +++ b/test/re/re.alg/re.alg.search/ecma.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // 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 00c57e224..c181cff47 100644 --- a/test/re/re.alg/re.alg.search/extended.pass.cpp +++ b/test/re/re.alg/re.alg.search/extended.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // diff --git a/test/re/re.traits/lookup_collatename.pass.cpp b/test/re/re.traits/lookup_collatename.pass.cpp index e73fc2020..049246ed1 100644 --- a/test/re/re.traits/lookup_collatename.pass.cpp +++ b/test/re/re.traits/lookup_collatename.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // diff --git a/test/re/re.traits/transform.pass.cpp b/test/re/re.traits/transform.pass.cpp index de5419421..c3bce7939 100644 --- a/test/re/re.traits/transform.pass.cpp +++ b/test/re/re.traits/transform.pass.cpp @@ -8,8 +8,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // diff --git a/test/re/re.traits/transform_primary.pass.cpp b/test/re/re.traits/transform_primary.pass.cpp index ee4b296f8..28734d621 100644 --- a/test/re/re.traits/transform_primary.pass.cpp +++ b/test/re/re.traits/transform_primary.pass.cpp @@ -8,8 +8,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: android -// XFAIL: androideabi // REQUIRES: locale.cs_CZ.ISO8859-2 // diff --git a/test/strings/basic.string/string.cons/move_alloc.pass.cpp b/test/strings/basic.string/string.cons/move_alloc.pass.cpp index 4e8b038ee..1f9631449 100644 --- a/test/strings/basic.string/string.cons/move_alloc.pass.cpp +++ b/test/strings/basic.string/string.cons/move_alloc.pass.cpp @@ -45,6 +45,16 @@ int main() test(S("1"), A(5)); test(S("1234567890123456789012345678901234567890123456789012345678901234567890"), A(7)); } + + int alloc_count = test_alloc_base::alloc_count; + { + typedef test_allocator A; + typedef std::basic_string, A> S; + S s1 ( "Twas brillig, and the slivy toves did gyre and gymbal in the wabe" ); + S s2 (std::move(s1), A(1)); + } + assert ( test_alloc_base::alloc_count == alloc_count ); + #if __cplusplus >= 201103L { typedef min_allocator A; diff --git a/test/strings/c.strings/cuchar.pass.cpp b/test/strings/c.strings/cuchar.pass.cpp index d4c15db89..022c656e8 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: * // diff --git a/test/strings/c.strings/version_cuchar.pass.cpp b/test/strings/c.strings/version_cuchar.pass.cpp index fa47f0ffc..dcfdcc37a 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: * // diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp index e395d74a1..af87052ff 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/assign2.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char16_t c = u'\0'; std::char_traits::assign(c, u'a'); assert(c == u'a'); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp index e63113f4d..9f8461e0b 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/compare.pass.cpp @@ -19,6 +19,7 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::compare(u"", u"", 0) == 0); assert(std::char_traits::compare(u"1", u"1", 1) == 0); @@ -38,5 +39,6 @@ int main() assert(std::char_traits::compare(u"223", u"123", 3) > 0); assert(std::char_traits::compare(u"133", u"123", 3) > 0); assert(std::char_traits::compare(u"124", u"123", 3) > 0); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp index 8ac9443aa..821693465 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char16_t c = u'\0'; assert(std::char_traits::eq(u'a', u'a')); assert(!std::char_traits::eq(u'a', u'A')); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp index f07f9d6f3..a20aa7d47 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq_int_type.pass.cpp @@ -19,9 +19,11 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert( std::char_traits::eq_int_type(u'a', u'a')); assert(!std::char_traits::eq_int_type(u'a', u'A')); assert(!std::char_traits::eq_int_type(std::char_traits::eof(), u'A')); +#endif assert( std::char_traits::eq_int_type(std::char_traits::eof(), std::char_traits::eof())); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp index 5cb4629a2..9f6acca83 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/length.pass.cpp @@ -19,10 +19,12 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::length(u"") == 0); assert(std::char_traits::length(u"a") == 1); assert(std::char_traits::length(u"aa") == 2); assert(std::char_traits::length(u"aaa") == 3); assert(std::char_traits::length(u"aaaa") == 4); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp index d01059ffd..135ecc05e 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char16_t c = u'\0'; assert(!std::char_traits::lt(u'a', u'a')); assert( std::char_traits::lt(u'A', u'a')); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp index 126663f3c..3c213e6e0 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/not_eof.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::not_eof(u'a') == u'a'); assert(std::char_traits::not_eof(u'A') == u'A'); +#endif assert(std::char_traits::not_eof(0) == 0); assert(std::char_traits::not_eof(std::char_traits::eof()) != std::char_traits::eof()); diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp index d8abfc5f9..ab47403db 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_char_type.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::to_char_type(u'a') == u'a'); assert(std::char_traits::to_char_type(u'A') == u'A'); +#endif assert(std::char_traits::to_char_type(0) == 0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp index 40c33656b..11eb8f525 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/to_int_type.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::to_int_type(u'a') == u'a'); assert(std::char_traits::to_int_type(u'A') == u'A'); +#endif assert(std::char_traits::to_int_type(0) == 0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp index 5950898cd..35dcd9602 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char32_t c = U'\0'; std::char_traits::assign(c, U'a'); assert(c == U'a'); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp index 87dd6f212..ee3019cf2 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp @@ -19,6 +19,7 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::compare(U"", U"", 0) == 0); assert(std::char_traits::compare(U"1", U"1", 1) == 0); @@ -38,5 +39,6 @@ int main() assert(std::char_traits::compare(U"223", U"123", 3) > 0); assert(std::char_traits::compare(U"133", U"123", 3) > 0); assert(std::char_traits::compare(U"124", U"123", 3) > 0); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp index 9ed703427..ffeff0cf4 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char32_t c = U'\0'; assert(std::char_traits::eq(U'a', U'a')); assert(!std::char_traits::eq(U'a', U'A')); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp index ec43abc07..eb5c69661 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp @@ -19,9 +19,11 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert( std::char_traits::eq_int_type(U'a', U'a')); assert(!std::char_traits::eq_int_type(U'a', U'A')); assert(!std::char_traits::eq_int_type(std::char_traits::eof(), U'A')); +#endif assert( std::char_traits::eq_int_type(std::char_traits::eof(), std::char_traits::eof())); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp index 5f55add64..d80ce051d 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp @@ -19,10 +19,12 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::length(U"") == 0); assert(std::char_traits::length(U"a") == 1); assert(std::char_traits::length(U"aa") == 2); assert(std::char_traits::length(U"aaa") == 3); assert(std::char_traits::length(U"aaaa") == 4); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp index cb1c00876..f667507f0 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L char32_t c = U'\0'; assert(!std::char_traits::lt(U'a', U'a')); assert( std::char_traits::lt(U'A', U'a')); +#endif #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp index 2d4768f90..d794417bf 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::not_eof(U'a') == U'a'); assert(std::char_traits::not_eof(U'A') == U'A'); +#endif assert(std::char_traits::not_eof(0) == 0); assert(std::char_traits::not_eof(std::char_traits::eof()) != std::char_traits::eof()); diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp index 481835c55..1f67242b2 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::to_char_type(U'a') == U'a'); assert(std::char_traits::to_char_type(U'A') == U'A'); +#endif assert(std::char_traits::to_char_type(0) == 0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp index 2d35d7f6a..a378186bd 100644 --- a/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp +++ b/test/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp @@ -19,8 +19,10 @@ int main() { #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L assert(std::char_traits::to_int_type(U'a') == U'a'); assert(std::char_traits::to_int_type(U'A') == U'A'); +#endif assert(std::char_traits::to_int_type(0) == 0); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS } diff --git a/test/support/asan_testing.h b/test/support/asan_testing.h new file mode 100644 index 000000000..c8797bde6 --- /dev/null +++ b/test/support/asan_testing.h @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef ASAN_TESTING_H +#define ASAN_TESTING_H + +#include <__config> + +#ifndef _LIBCPP_HAS_NO_ASAN +extern "C" int __sanitizer_verify_contiguous_container + ( const void *beg, const void *mid, const void *end ); + +template +bool is_contiguous_container_asan_correct ( const std::vector &c ) +{ + if ( std::is_same>::value && c.data() != NULL) + return __sanitizer_verify_contiguous_container ( + c.data(), c.data() + c.size(), c.data() + c.capacity()) != 0; + return true; +} + +#else +template +bool is_contiguous_container_asan_correct ( const std::vector &c ) +{ + return true; +} +#endif + + +#endif // ASAN_TESTING_H \ No newline at end of file diff --git a/test/support/constexpr_char_traits.hpp b/test/support/constexpr_char_traits.hpp new file mode 100644 index 000000000..a2a690e9e --- /dev/null +++ b/test/support/constexpr_char_traits.hpp @@ -0,0 +1,138 @@ +// -*- C++ -*- +//===-------_------------ constexpr_char_traits ---------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _CONSTEXPR_CHAR_TRAITS +#define _CONSTEXPR_CHAR_TRAITS + +#include <__config> +#include + + +template +struct constexpr_char_traits +{ + typedef _CharT char_type; + typedef int int_type; + typedef std::streamoff off_type; + typedef std::streampos pos_type; + typedef std::mbstate_t state_type; + + static _LIBCPP_CONSTEXPR_AFTER_CXX11 void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT + {__c1 = __c2;} + + static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT + {return __c1 == __c2;} + + static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT + {return __c1 < __c2;} + + static _LIBCPP_CONSTEXPR_AFTER_CXX11 int compare(const char_type* __s1, const char_type* __s2, size_t __n); + static _LIBCPP_CONSTEXPR_AFTER_CXX11 size_t length(const char_type* __s); + static _LIBCPP_CONSTEXPR_AFTER_CXX11 const char_type* find(const char_type* __s, size_t __n, const char_type& __a); + static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* move(char_type* __s1, const char_type* __s2, size_t __n); + static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); + static _LIBCPP_CONSTEXPR_AFTER_CXX11 char_type* assign(char_type* __s, size_t __n, char_type __a); + + static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT + {return eq_int_type(__c, eof()) ? ~eof() : __c;} + + static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT + {return char_type(__c);} + + static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT + {return int_type(__c);} + + static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT + {return __c1 == __c2;} + + static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT + {return int_type(EOF);} +}; + + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 int +constexpr_char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) +{ + for (; __n; --__n, ++__s1, ++__s2) + { + if (lt(*__s1, *__s2)) + return -1; + if (lt(*__s2, *__s1)) + return 1; + } + return 0; +} + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 size_t +constexpr_char_traits<_CharT>::length(const char_type* __s) +{ + size_t __len = 0; + for (; !eq(*__s, char_type(0)); ++__s) + ++__len; + return __len; +} + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT* +constexpr_char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) +{ + for (; __n; --__n) + { + if (eq(*__s, __a)) + return __s; + ++__s; + } + return 0; +} + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +constexpr_char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) +{ + char_type* __r = __s1; + if (__s1 < __s2) + { + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + } + else if (__s2 < __s1) + { + __s1 += __n; + __s2 += __n; + for (; __n; --__n) + assign(*--__s1, *--__s2); + } + return __r; +} + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +constexpr_char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) +{ + _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + char_type* __r = __s1; + for (; __n; --__n, ++__s1, ++__s2) + assign(*__s1, *__s2); + return __r; +} + +template +_LIBCPP_CONSTEXPR_AFTER_CXX11 _CharT* +constexpr_char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) +{ + char_type* __r = __s; + for (; __n; --__n, ++__s) + assign(*__s, __a); + return __r; +} + +#endif // _CONSTEXPR_CHAR_TRAITS \ No newline at end of file diff --git a/test/support/counting_predicates.hpp b/test/support/counting_predicates.hpp new file mode 100644 index 000000000..e825848fc --- /dev/null +++ b/test/support/counting_predicates.hpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// 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 __COUNTING_PREDICATES_H +#define __COUNTING_PREDICATES_H + + +template +struct unary_counting_predicate : public std::unary_function { +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; } + +private: + Predicate p_; + mutable size_t count_; + }; + + +template +struct binary_counting_predicate : public std::binary_function { +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; } + +private: + 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 f3f08caa5..b643636e1 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 + +template +class bare_allocator +{ +public: + typedef T value_type; + + bare_allocator() {} + + template + bare_allocator(bare_allocator) {} + + T* allocate(std::size_t n) + { + return static_cast(::operator new(n*sizeof(T))); + } + + void deallocate(T* p, std::size_t) + { + return ::operator delete(static_cast(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 @@ -71,7 +99,7 @@ public: explicit min_pointer(min_pointer p) : ptr_(static_cast(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/nothing_to_do.pass.cpp b/test/support/nothing_to_do.pass.cpp index 9a59227ab..9125fe194 100644 --- a/test/support/nothing_to_do.pass.cpp +++ b/test/support/nothing_to_do.pass.cpp @@ -11,3 +11,4 @@ int main() { } + diff --git a/test/support/platform_support.h b/test/support/platform_support.h index 9ae2ae7cb..09bb29a65 100644 --- a/test/support/platform_support.h +++ b/test/support/platform_support.h @@ -44,19 +44,31 @@ #include #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) #include // _mktemp +#else +#include // 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_allocator.h b/test/support/test_allocator.h index 99f72a053..683fac239 100644 --- a/test/support/test_allocator.h +++ b/test/support/test_allocator.h @@ -92,6 +92,66 @@ public: {return !(x == y);} }; +template +class non_default_test_allocator + : public test_alloc_base +{ + int data_; + + template friend class non_default_test_allocator; +public: + + typedef unsigned size_type; + typedef int difference_type; + typedef T value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef typename std::add_lvalue_reference::type reference; + typedef typename std::add_lvalue_reference::type const_reference; + + template struct rebind {typedef non_default_test_allocator other;}; + +// non_default_test_allocator() throw() : data_(0) {++count;} + explicit non_default_test_allocator(int i) throw() : data_(i) {++count;} + non_default_test_allocator(const non_default_test_allocator& a) throw() + : data_(a.data_) {++count;} + template non_default_test_allocator(const non_default_test_allocator& a) throw() + : data_(a.data_) {++count;} + ~non_default_test_allocator() throw() {assert(data_ >= 0); --count; data_ = -1;} + pointer address(reference x) const {return &x;} + const_pointer address(const_reference x) const {return &x;} + pointer allocate(size_type n, const void* = 0) + { + assert(data_ >= 0); + if (time_to_throw >= throw_after) { +#ifndef _LIBCPP_NO_EXCEPTIONS + throw std::bad_alloc(); +#else + std::terminate(); +#endif + } + ++time_to_throw; + ++alloc_count; + return (pointer)std::malloc(n * sizeof(T)); + } + void deallocate(pointer p, size_type n) + {assert(data_ >= 0); --alloc_count; std::free(p);} + size_type max_size() const throw() + {return UINT_MAX / sizeof(T);} + void construct(pointer p, const T& val) + {::new(p) T(val);} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + void construct(pointer p, T&& val) + {::new(p) T(std::move(val));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + void destroy(pointer p) {p->~T();} + + friend bool operator==(const non_default_test_allocator& x, const non_default_test_allocator& y) + {return x.data_ == y.data_;} + friend bool operator!=(const non_default_test_allocator& x, const non_default_test_allocator& y) + {return !(x == y);} +}; + template <> class test_allocator : public test_alloc_base diff --git a/test/thread/futures/futures.future_error/what.pass.cpp b/test/thread/futures/futures.future_error/what.pass.cpp index 1c250a9f1..5e543504d 100644 --- a/test/thread/futures/futures.future_error/what.pass.cpp +++ b/test/thread/futures/futures.future_error/what.pass.cpp @@ -7,6 +7,13 @@ // //===----------------------------------------------------------------------===// +// LWG 2056 changed the values of future_errc, so if we're using new headers +// with an old library we'll get incorrect messages. +// +// XFAIL: with_system_lib=x86_64-apple-darwin11 +// XFAIL: with_system_lib=x86_64-apple-darwin12 +// XFAIL: with_system_lib=x86_64-apple-darwin13 + // // class future_error diff --git a/test/thread/futures/futures.promise/dtor.pass.cpp b/test/thread/futures/futures.promise/dtor.pass.cpp index 340160577..cd4fafb8f 100644 --- a/test/thread/futures/futures.promise/dtor.pass.cpp +++ b/test/thread/futures/futures.promise/dtor.pass.cpp @@ -100,7 +100,15 @@ int main() } catch (const std::future_error& e) { - assert(e.code() == make_error_code(std::future_errc::broken_promise)); + // LWG 2056 changed the values of future_errc, so if we're using new + // headers with an old library the error codes won't line up. + // + // Note that this particular check only applies to promise + // since the other specializations happen to be implemented in the + // header rather than the library. + assert( + e.code() == make_error_code(std::future_errc::broken_promise) || + e.code() == std::error_code(0, std::future_category())); } } } 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 7009f306d..58e9982fc 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 @@ -35,6 +35,8 @@ public: int A::n_moves = 0; int A::n_copies = 0; +int func(int i) { return i; } + int main() { { @@ -58,4 +60,18 @@ int main() assert(A::n_copies > 0); assert(A::n_moves > 0); } + { + std::packaged_task p(&func); + assert(p.valid()); + std::future f = p.get_future(); + p(4); + assert(f.get() == 4); + } + { + std::packaged_task p(func); + assert(p.valid()); + std::future f = p.get_future(); + p(4); + assert(f.get() == 4); + } } 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 2e0cf5d72..e7070c583 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 @@ -37,6 +37,8 @@ public: int A::n_moves = 0; int A::n_copies = 0; +int func(int i) { return i; } + int main() { { @@ -52,7 +54,7 @@ int main() } assert(test_alloc_base::count == 0); A::n_copies = 0; - A::n_copies = 0; + A::n_moves = 0; { A a(5); std::packaged_task p(std::allocator_arg, @@ -66,4 +68,28 @@ int main() assert(A::n_moves > 0); } assert(test_alloc_base::count == 0); + A::n_copies = 0; + A::n_moves = 0; + { + A a(5); + std::packaged_task p(std::allocator_arg, test_allocator(), &func); + assert(test_alloc_base::count > 0); + assert(p.valid()); + std::future f = p.get_future(); + p(4); + assert(f.get() == 4); + } + assert(test_alloc_base::count == 0); + A::n_copies = 0; + A::n_moves = 0; + { + A a(5); + std::packaged_task p(std::allocator_arg, test_allocator(), func); + assert(test_alloc_base::count > 0); + assert(p.valid()); + std::future f = p.get_future(); + p(4); + assert(f.get() == 4); + } + assert(test_alloc_base::count == 0); } 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 d66db3f9f..f66b96279 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 @@ -15,9 +15,29 @@ #include #include #include +#include +#include int main() { + int ec; + struct sigaction action; + action.sa_handler = [](int) {}; + sigemptyset(&action.sa_mask); + action.sa_flags = 0; + + ec = sigaction(SIGALRM, &action, nullptr); + assert(!ec); + + struct itimerval it; + it.it_interval = { 0 }; + it.it_value.tv_sec = 0; + it.it_value.tv_usec = 250000; + // This will result in a SIGALRM getting fired resulting in the nanosleep + // inside sleep_for getting EINTR. + ec = setitimer(ITIMER_REAL, &it, nullptr); + assert(!ec); + typedef std::chrono::system_clock Clock; typedef Clock::time_point time_point; typedef Clock::duration duration; 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 79fc1512a..f758a4d8c 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 @@ -92,6 +92,15 @@ int main() } assert(new_called == 0); { + assert(new_called == 0); + non_default_test_allocator> al(1); + std::function f2(std::allocator_arg, al, g); + assert(new_called == 0); + assert(f2.target()); + assert(f2.target() == 0); + } + assert(new_called == 0); + { std::function f; assert(new_called == 0); assert(f.target() == 0); 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 0efb4d9ac..cf7b96314 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 @@ -99,6 +99,18 @@ int main() assert(f2.target() == 0); assert(f2.target() == 0); } + { + std::function f; + assert(new_called == 0); + assert(f.target() == 0); + assert(f.target() == 0); + assert(!f); + std::function g = f; + assert(new_called == 0); + assert(g.target() == 0); + assert(g.target() == 0); + assert(!g); + } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES assert(new_called == 0); { diff --git a/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.pass.cpp b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.pass.cpp new file mode 100644 index 000000000..7099c45fa --- /dev/null +++ b/test/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/no-variadics.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. +// +//===----------------------------------------------------------------------===// + +// + +// class function + +// template function(F); + +#define _LIBCPP_HAS_NO_VARIADICS +#include +#include + +int main() +{ + std::function f(static_cast(0)); + assert(!f); +} 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 1eb92aa42..5a95097f6 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 @@ -16,10 +16,28 @@ #include #include +#include "counting_predicates.hpp" + +bool is5 ( int i ) { return i == 5; } + +template +bool call_pred ( T pred ) { return pred(5); } + int main() { + { int i = 0; std::reference_wrapper r1 = std::ref(i); std::reference_wrapper r2 = std::ref(r1); assert(&r2.get() == &i); + } + { + unary_counting_predicate cp(is5); + assert(!cp(6)); + assert(cp.count() == 1); + assert(call_pred(cp)); + assert(cp.count() == 1); + assert(call_pred(std::ref(cp))); + assert(cp.count() == 2); + } } 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 e0e38fb3a..a8ad936c9 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 main() { int i = 0; A a = std::pointer_traits >::pointer_to(i); - assert(a.t_ = &i); + assert(a.t_ == &i); } { (std::pointer_traits >::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 764a7ba96..fc44d9d77 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 main() { int i = 0; int* a = std::pointer_traits::pointer_to(i); - assert(a = &i); + assert(a == &i); } { (std::pointer_traits::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 a706c4072..00a08bcba 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 @@ -25,7 +25,7 @@ class Deleter public: Deleter(Deleter&) {} - Deleter& operator=(Deleter&) {} + Deleter& operator=(Deleter&) { return *this; } void operator()(void*) const {} }; 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 7de3b0daf..eb8e31c76 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 @@ int main() test_make_signed< unsigned long long, signed long long >(); test_make_signed< wchar_t, std::conditional::type >(); test_make_signed< const wchar_t, std::conditional::type >(); - test_make_signed< const Enum, const int >(); + test_make_signed< const Enum, std::conditional::type >(); test_make_signed< BigEnum, std::conditional::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 a13485a85..984440193 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 @@ int main() test_make_unsigned (); test_make_unsigned::type> (); test_make_unsigned::type> (); - test_make_unsigned (); + test_make_unsigned::type >(); test_make_unsigned::type> (); #ifndef _LIBCPP_HAS_NO_INT128 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 c5638702d..67ef3db2b 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 @@ int main() test_member_function_pointer(); test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + #if __cplusplus >= 201103L // reference qualifiers on functions are a C++11 extension test_member_function_pointer(); @@ -74,5 +86,17 @@ int main() test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); #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 000000000..e13e58632 --- /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 + +template +void test_member_function_pointer_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert( std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_member_function_pointer() +{ + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); +} diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp index e4af6de1c..b46a4d6bc 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -36,6 +36,7 @@ void test_is_not_assignable() struct D; +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES struct C { template @@ -46,6 +47,7 @@ struct E { C operator=(int); }; +#endif int main() { @@ -54,9 +56,10 @@ int main() test_is_assignable (); test_is_assignable (); test_is_assignable (); - test_is_assignable (); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_assignable (); + test_is_not_assignable (); test_is_not_assignable (); #endif diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 0753ab7bc..2b8f7efec 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -24,6 +24,16 @@ private: A(char); }; +class Abstract +{ + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; +}; + template void test_is_constructible() { @@ -71,4 +81,6 @@ int main() test_is_not_constructible (); test_is_not_constructible (); test_is_not_constructible (); + test_is_not_constructible (); + test_is_not_constructible (); } diff --git a/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp index 5cabb381d..807745ef6 100644 --- a/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp +++ b/test/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp @@ -31,9 +31,7 @@ void test_is_not_destructible() static_assert(!std::is_destructible::value, ""); } -class Empty -{ -}; +class Empty {}; class NotEmpty { @@ -47,11 +45,6 @@ struct bit_zero int : 0; }; -class Abstract -{ - virtual ~Abstract() = 0; -}; - struct A { ~A(); @@ -59,6 +52,31 @@ struct A typedef void (Function) (); +struct PublicAbstract { public: virtual void foo() = 0; }; +struct ProtectedAbstract { protected: virtual void foo() = 0; }; +struct PrivateAbstract { private: virtual void foo() = 0; }; + +struct PublicDestructor { public: ~PublicDestructor() {}}; +struct ProtectedDestructor { protected: ~ProtectedDestructor() {}}; +struct PrivateDestructor { private: ~PrivateDestructor() {}}; + +struct VirtualPublicDestructor { public: virtual ~VirtualPublicDestructor() {}}; +struct VirtualProtectedDestructor { protected: virtual ~VirtualProtectedDestructor() {}}; +struct VirtualPrivateDestructor { private: virtual ~VirtualPrivateDestructor() {}}; + +struct PurePublicDestructor { public: virtual ~PurePublicDestructor() = 0; }; +struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; }; +struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; }; + +struct DeletedPublicDestructor { public: ~DeletedPublicDestructor() = delete; }; +struct DeletedProtectedDestructor { protected: ~DeletedProtectedDestructor() = delete; }; +struct DeletedPrivateDestructor { private: ~DeletedPrivateDestructor() = delete; }; + +struct DeletedVirtualPublicDestructor { public: virtual ~DeletedVirtualPublicDestructor() = delete; }; +struct DeletedVirtualProtectedDestructor { protected: virtual ~DeletedVirtualProtectedDestructor() = delete; }; +struct DeletedVirtualPrivateDestructor { private: virtual ~DeletedVirtualPrivateDestructor() = delete; }; + + int main() { test_is_destructible(); @@ -72,10 +90,30 @@ int main() test_is_destructible(); test_is_destructible(); test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); test_is_not_destructible(); test_is_not_destructible(); - test_is_not_destructible(); + + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + +// test_is_not_destructible(); // currently fails due to clang bug #20268 + test_is_not_destructible(); + test_is_not_destructible(); + #if __has_feature(cxx_access_control_sfinae) test_is_not_destructible(); #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 a513d52f9..78717329a 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 @@ -49,7 +49,12 @@ struct bit_zero class Abstract { - virtual ~Abstract() = 0; + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; }; struct A @@ -60,7 +65,7 @@ struct A int main() { test_has_not_nothrow_destructor(); - test_has_not_nothrow_destructor(); + test_has_not_nothrow_destructor(); test_has_not_nothrow_destructor(); #if __has_feature(cxx_noexcept) @@ -79,6 +84,7 @@ int main() test_is_nothrow_destructible(); test_is_nothrow_destructible(); test_is_nothrow_destructible(); + test_is_nothrow_destructible(); #if __has_feature(cxx_noexcept) test_is_nothrow_destructible(); #endif 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 ebe10e320..1b34885ef 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 @@ -49,7 +49,12 @@ struct bit_zero class Abstract { - virtual ~Abstract() = 0; + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; }; struct A @@ -61,9 +66,10 @@ int main() { test_has_not_trivial_destructor(); test_has_not_trivial_destructor(); - test_has_not_trivial_destructor(); + test_has_not_trivial_destructor(); test_has_not_trivial_destructor(); + test_is_trivially_destructible(); test_is_trivially_destructible(); test_is_trivially_destructible(); test_is_trivially_destructible(); diff --git a/test/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp b/test/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp new file mode 100644 index 000000000..2862762f1 --- /dev/null +++ b/test/utilities/tuple/tuple.general/tuple.smartptr.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Tuples of smart pointers; based on bug #18350 +// auto_ptr doesn't have a copy constructor that takes a const &, but tuple does. + +#include +#include + +int main () { + { + std::tuple> up; + std::tuple> sp; + std::tuple> wp; +// std::tuple> ap; + } + { + std::tuple> up; + std::tuple> sp; + std::tuple> wp; +// std::tuple> ap; + } + { + std::tuple> up; + std::tuple> sp; + std::tuple> wp; +// std::tuple> ap; + } +} \ No newline at end of file diff --git a/test/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp b/test/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp new file mode 100644 index 000000000..df5fdff51 --- /dev/null +++ b/test/utilities/tuple/tuple.tuple/TupleFunction.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// This is for bugs 18853 and 19118 + +#if __cplusplus >= 201103L + +#include +#include + +struct X +{ + X() {} + + template + X(T); + + void operator()() {} +}; + +int +main() +{ + X x; + std::function f(x); +} +#else +int main () {} +#endif diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp index 04cb3d5f7..ca53cd3c5 100644 --- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp +++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/const_Types.pass.cpp @@ -17,6 +17,40 @@ #include #include + +template +struct never { + enum { value = 0 }; +}; + +struct NoValueCtor +{ + NoValueCtor() : id(++count) {} + NoValueCtor(NoValueCtor const & other) : id(other.id) { ++count; } + + // The constexpr is required to make is_constructible instantiate this template. + // The explicit is needed to test-around a similar bug with is_convertible. + template + constexpr explicit NoValueCtor(T) + { static_assert(never::value, "This should not be instantiated"); } + + static int count; + int id; +}; + +int NoValueCtor::count = 0; + + +struct NoValueCtorEmpty +{ + NoValueCtorEmpty() {} + NoValueCtorEmpty(NoValueCtorEmpty const &) {} + + template + constexpr explicit NoValueCtorEmpty(T) + { static_assert(never::value, "This should not be instantiated"); } +}; + int main() { { @@ -56,6 +90,23 @@ int main() assert(std::get<1>(t) == nullptr); assert(std::get<2>(t) == "text"); } + // __tuple_leaf uses is_constructible to disable its explicit converting + // constructor overload __tuple_leaf(U &&). Evaluating is_constructible can cause a compile error. + // This overload is evaluated when __tuple_leafs copy or move ctor is called. + // This checks that is_constructible is not evaluated when U == __tuple_leaf. + { + std::tuple t(1, NoValueCtor(), 2, 3); + assert(std::get<0>(t) == 1); + assert(std::get<1>(t).id == 1); + assert(std::get<2>(t) == 2); + assert(std::get<3>(t) == 3); + } + { + std::tuple t(1, NoValueCtorEmpty(), 2, 3); + assert(std::get<0>(t) == 1); + assert(std::get<2>(t) == 2); + assert(std::get<3>(t) == 3); + } // extensions { std::tuple t(2); diff --git a/test/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp b/test/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp index 41e4b6607..8dc7d21ec 100644 --- a/test/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp +++ b/test/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp @@ -18,6 +18,18 @@ #include "../MoveOnly.h" +struct ConstructsWithTupleLeaf +{ + ConstructsWithTupleLeaf() {} + + ConstructsWithTupleLeaf(ConstructsWithTupleLeaf const &) { assert(false); } + ConstructsWithTupleLeaf(ConstructsWithTupleLeaf &&) {} + + template + ConstructsWithTupleLeaf(T t) + { assert(false); } +}; + int main() { { @@ -46,4 +58,12 @@ int main() assert(std::get<1>(t) == 1); assert(std::get<2>(t) == 2); } + // A bug in tuple caused __tuple_leaf to use its explicit converting constructor + // as its move constructor. This tests that ConstructsWithTupleLeaf is not called + // (w/ __tuple_leaf) + { + typedef std::tuple d_t; + d_t d((ConstructsWithTupleLeaf())); + d_t d2(static_cast(d)); + } } diff --git a/test/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp b/test/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp index ec63a3974..d9554560e 100644 --- a/test/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp +++ b/test/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type1.fail.cpp @@ -18,7 +18,7 @@ int main() #if _LIBCPP_STD_VER > 11 typedef std::complex cf; auto t1 = std::make_tuple ( 42, "Hi" ); - assert ( std::get(t1) == cf {1,2} ); // no such type + assert (( std::get(t1) == cf {1,2} )); // no such type #else #error #endif diff --git a/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp b/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp index 1c01ed74d..27194effe 100644 --- a/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp +++ b/test/utilities/utility/pairs/pair.astuple/pairs.by.type1.fail.cpp @@ -17,7 +17,7 @@ int main() #if _LIBCPP_STD_VER > 11 typedef std::complex cf; auto t1 = std::make_pair ( 42, 3.4 ); - assert ( std::get(t1) == cf {1,2} ); // no such type + assert (( std::get(t1) == cf {1,2} )); // no such type #else #error #endif diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html index 83126a855..ce7f21612 100644 --- a/www/cxx1y_status.html +++ b/www/cxx1y_status.html @@ -96,7 +96,6 @@ 3779LWGUser-defined Literals for std::complexChicagoComplete3.4 3789LWGConstexpr Library Additions: functionalChicagoComplete3.4 - 3778CWGSized deallocationChicago 3924LWGDiscouraging rand() in C++14IssaquahComplete3.5 @@ -133,7 +132,7 @@ 2071std::valarray move-assignmentPortlandComplete 2074Off by one error in std::reverse_copyPortlandComplete - 2081Allocator requirements should include CopyConstructible 2083 const-qualification on weak_ptr::owner_beforePortlandComplete + 2081Allocator requirements should include CopyConstructiblePortlandComplete 2083const-qualification on weak_ptr::owner_beforePortlandComplete 2086Overly generic type support for math functionsPortlandComplete 2099Unnecessary constraints of va_start() usagePortlandComplete diff --git a/www/debug_mode.html b/www/debug_mode.html index 647478294..943c47db0 100644 --- a/www/debug_mode.html +++ b/www/debug_mode.html @@ -11,6 +11,11 @@ Work is beginning on a libc++ debug mode. The purpose of this table is to record which parts of libc++ have debug mode support.

+

+Note: Debug mode is currently not functional. Defining _LIBCPP_DEBUG will result +in fairly nasty compile errors. +

+ @@ -151,6 +156,7 @@ At present the table is known to not be a complete list. It is currently ordere in approximate priority order.

+

Last Updated: 3-June-2014

diff --git a/www/index.html b/www/index.html index 02470ea9a..d4adfe786 100644 --- a/www/index.html +++ b/www/index.html @@ -103,13 +103,20 @@

Platform Support

-

libc++ is known to work on the following platforms, using g++-4.2 and - clang (lack of C++11 language support disables some functionality).

+

+ libc++ is known to work on the following platforms, using g++-4.2 and + clang (lack of C++11 language support disables some functionality). Note + that functionality provided by <atomic> is only functional with + clang. +

-
    -
  • Mac OS X i386
  • -
  • Mac OS X x86_64
  • -
+
    +
  • Mac OS X i386
  • +
  • Mac OS X x86_64
  • +
  • FreeBSD 10+ i386
  • +
  • FreeBSD 10+ x86_64
  • +
  • FreeBSD 10+ ARM
  • +

Current Status

@@ -117,15 +124,35 @@

libc++ is a 100% complete C++11 implementation on Apple's OS X.

LLVM and Clang can self host in C++ and C++11 mode with libc++ on Linux.

-

C++1Y (C++14) implementation is in progress. The current status is - here

- +

libc++ is also a 100% complete C++14 implementation. A list of new features and changes for + C++14 can be found here.

+

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 here.

Ports to other platforms are underway. Here are recent test results for Windows and Linux.

+ +

Build Bots

+ +

These are the libc++ build bots

+ +

Get it and get involved!

@@ -133,12 +160,6 @@

First please review our Developer's Policy. -

To check out the code, use:

- -
    -
  • svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
  • -
-

On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install Xcode 4.2 or later. However if you want to install tip-of-trunk from here @@ -147,25 +168,106 @@ /usr/lib.

-

- Next: -

- +

To check out the code, use:

+
    -
  • cd libcxx/lib
  • -
  • export TRIPLE=-apple-
  • -
  • ./buildit
  • -
  • ln -sf libc++.1.dylib libc++.dylib
  • +
  • svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
- +

- That should result in a libc++.1.dylib and libc++.dylib. The safest thing - to do is to use it from where your libcxx is installed instead of replacing - these in your Mac OS. + Note that for an in-tree build, you should check out libcxx to + llvm/projects.

- To use your system-installed libc++ with clang you can: + The following instructions are for building libc++ on FreeBSD, Linux, or Mac + using libc++abi as the C++ ABI + library. On Linux, it is also possible to use + libsupc++ or libcxxrt. +

+ +

In-tree build:

+
    +
  • Check out libcxx and libcxxabi + into llvm/projects
  • +
  • cd llvm
  • +
  • mkdir build && cd build
  • +
  • cmake .. # Linux may require -DCMAKE_C_COMPILER=clang + -DCMAKE_CXX_COMPILER=clang++
  • +
  • make cxx
  • +
+ +

Out-of-tree build:

+
    +
  • Check out libcxx
  • +
  • If not on a Mac, also check out + libcxxabi
  • +
  • cd libcxx
  • +
  • mkdir build && cd build
  • +
  • cmake -DLIBCXX_CXX_ABI=libcxxabi + -DLIBCXX_LIBCXXABI_INCLUDE_PATHS=path/to/libcxxabi/include + -DLIT_EXECUTABLE=path/to/llvm/utils/lit/lit.py .. # Linux may require + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
  • +
  • make
  • +
+ +

To run the tests:

+
    +
  • make check-libcxx
  • +
+ +

If you wish to run a subset of the test suite:

+
    +
  • cd path/to/libcxx/libcxx
  • +
  • alias lit='python path/to/llvm/utils/lit/lit.py'
  • +
  • ln -s path/to/build/dir/projects/libcxx/test/lit.site.cfg + test/lit.site.cfg
  • +
  • lit -sv test/re/ # or whichever subset of tests you're interested + in
  • +
+

The above is currently quite inconvenient. Sorry! We're working on it!

+ +

More information on using LIT can be found + here. For more + general information about the LLVM testing infrastructure, see the + LLVM Testing Infrastructure + Guide +

+ +

+ Shared libraries for libc++ should now be present in llvm/build/lib. Note + that it is safest to use this from its current location rather than + replacing your system's libc++ (if it has one, if not, go right ahead). +

+ +

+ Mac users, remember to be careful when replacing the system's libc++. + Your system will not be able to boot without a funcioning + libc++. +

+ + +

Notes

+ + +

+ Building libc++ with -fno-rtti is not supported. However + linking against it with -fno-rtti is supported. +

+ +

Send discussions to the + clang mailing list.

+ + +

Using libc++ in your programs

+ + + +

FreeBSD and Mac OS X

+ + +

+ To use your system-installed libc++ with clang you can:

    @@ -174,41 +276,66 @@

- To use your tip-of-trunk libc++ on Mac OS with clang you can: + To use your tip-of-trunk libc++ on Mac OS with clang you can:

    -
  • export DYLD_LIBRARY_PATH=<path-to-libcxx>/lib +
  • export DYLD_LIBRARY_PATH=path/to/build/lib
  • clang++ -std=c++11 -stdlib=libc++ -nostdinc++ -I<path-to-libcxx>/include -L<path-to-libcxx>/lib test.cpp
-

To run the libc++ test suite (recommended):

+ +

Linux

+ + +

+ You will need to keep the source tree of + libc++abi available on your build + machine and your copy of the libc++abi shared library must be placed where + your linker will find it. +

+ +

+ Unfortunately you can't simply run clang with "-stdlib=libc++" at this + point, as clang is set up to link for libc++ linked to libsupc++. To get + around this you'll have to set up your linker yourself (or patch clang). + For example: +

    -
  • cd libcxx/test
  • -
  • ./testit
  • -
      -
    • You can alter the command line options testit uses - with export OPTIONS="whatever you need"
    • -
    +
  • clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
  • +
+ +

+ Alternately, you could just add libc++abi to your libraries list, which in + most situations will give the same result: +

+ +
    +
  • clang++ -stdlib=libc++ helloworld.cpp -lc++abi
-

Notes

+

Bug reports and patches

-Building libc++ with -fno-rtti is not supported. However linking -against it with -fno-rtti is supported. +If you think you've found a bug in libc++, please report it using +the LLVM Bugzilla. If you're not sure, you +can post a message to the cfe-dev +mailing list or on IRC. Please include "libc++" in your subject.

-

Send discussions to the - (clang mailing list).

+

+If you want to contribute a patch to libc++, the best place for that is the +cfe-commits +mailing list. Please include "libc++" and "PATCH" in your subject. +

-

Build on Linux using CMake and libsupc++.

+

Build on Linux using CMake and libsupc++.

@@ -269,44 +396,7 @@ End of search list.

-

Build on Linux using CMake and libc++abi.

- - -

- You will need to keep the source tree of libc++abi - available on your build machine and your copy of the libc++abi shared library must - be placed where your linker will find it. -

- -

- We can now run CMake: -

    -
  • CC=clang CXX=clang++ cmake -G "Unix Makefiles" - -DLIBCXX_CXX_ABI=libcxxabi - -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="<libc++abi-source-dir>/include" - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=/usr - <libc++-source-dir>
  • -
  • make
  • -
  • sudo make install
  • -
-

- Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, as - clang is set up to link for libc++ linked to libsupc++. To get around this - you'll have to set up your linker yourself (or patch clang). For example, -

    -
  • clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
  • -
- Alternately, you could just add libc++abi to your libraries list, which in most - situations will give the same result: -
    -
  • clang++ -stdlib=libc++ helloworld.cpp -lc++abi
  • -
-

-

- - -

Build on Linux using CMake and libcxxrt.

+

Build on Linux using CMake and libcxxrt.

diff --git a/www/results.Linux.html b/www/results.Linux.html index 5e3eaf135..82416a36e 100644 --- a/www/results.Linux.html +++ b/www/results.Linux.html @@ -5,118 +5,509 @@

+All failures in the libc++ test suite will be documented here.
+Note: glibc >= 2.16 is required for full C11 compatibility.
 
-All failures in the libc++ test suite will be documented here. Last
-run was with Clang (pre-3.2) on Debian unstable x86_64 with eglibc
-2.13 and kernel 3.2.0-3-amd64. The ABI library used was libc++abi.
+Test Suite Run Information:
+Date: 8/18/2014
+Compiler: Clang Tip-of-Tree (r215809)
+ABI: libc++abi
+C Library: eglibc 2.19
+Platform: x86_64-linux-gnu
+Kernel: 3.13.0-32-generic
+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.
- uchar_h.pass.cpp:
-   My libc doesn't seem to provide uchar.h yet.
- exception.unexpected/
-  set.unexpected/
-   get_unexpected.pass.cpp: This seems to be a problem with libc++abi:
-    its default unexpected handler does not call the terminate handler?
-   set_unexpected.pass.cpp: idem.
-diagnostics/
- syserr/
-  syserr.errcat/
-   syserr.errcat.objects/
-    system_category.pass.cpp: Always maps back to generic category
-     when it should stay system category, because the implementation
-     dependson ELAST, which Linux lacks.
-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.
-language.support/
- support.start.term/
-  quick_exit.pass.cpp: Fails because it doesn't know about
-   std::at_quick_exit. Interestingly my libc does seem to know about
-   std::[at_]quick_exit, so this needs some investigation.
-localization/
- locale.categories/
-  category.collate/
-   locale.collate.byname/
-    compare.pass.cpp: In the C local, sorting order seems OK, but not
-     in the "" and en UTF8 locals. Needs investigation.
-  category.ctype/
-   locale.codecvt/
-    locale.codecvt.members/
-     wchar_t_out.pass.cpp: Needs investigation.
-    widen_1.pass.cpp: Fails due to not converting some out of bounds
-     characters the same way as expected. Needs investigation.
-    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_monthname.pass.cpp: idem.
-    get_monthname_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/
-   awk.pass.cpp: Needs investigation.
-   basic.pass.cpp: idem.
-   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.
-utilities/
- memory/
-  unique.ptr/
-   unique.ptr.runtime/
-    unique.ptr.runtime.ctor/
-     default02.pass.cpp:
-      test previously passed, recently started crashing clang. Needs investigation.
-     pointer02.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
+        - <cuchar> 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]: 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!
+********************
 
diff --git a/www/ts1z_status.html b/www/ts1z_status.html new file mode 100644 index 000000000..c06ef7b51 --- /dev/null +++ b/www/ts1z_status.html @@ -0,0 +1,89 @@ + + + + + + libc++ C++1Y Status + + + + + + + +
+ +

Post-C++14 TS Implementation Status

+ + +

In April 2013, the C++ standard committee approved the draft for the next version of the C++ standard, known as "C++1Y" (probably to be C++14)

+

The draft standard includes papers and issues that were voted on at the previous three meetings (Kona, Portland, and Bristol)

+

This page shows the status of libc++; the status of clang's support of the language features is here.

+ +

Technical Specifications

+
Section
+ + + + + +
Paper NumberTS Title
4023C++ Extensions for Library Fundamentals
3940Technical Specification - File System
+ +

Features in Library Fundamentals

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Feature NameStatus
Uses-allocator constructionNot started
Changes to std::shared_ptr and weak_ptrNot started
Additions to std::functionNot started
Changes to std::common_typeNot started
Changes to std::iterator_traitsNot started
Additions to std::promiseNot started
Additions to std::packaged_taskNot started
Class erased_typeNot started
Calling a function with a tuple of argumentsNot started
Other type transformationsNot started
Compile-time Rational ArithmeticNot started
Time UtilitiesNot started
System Error SupportNot started
SearchersNot started
Optional ObjectsInitial implementation complete
class anyNot started
string_viewImplementation in progress
memoryNot started
Algorithms libraryNot started
NetworkingNot started
+ +

Features in Filesystem

+ + + + +
Feature NameStatus
All featuresNot started
+ +

Last Updated: 2-June-2014

+ + +