diff --git a/.clang-format b/.clang-format index dd596813f..2d1d3bee6 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,6 @@ BasedOnStyle: LLVM --- Language: Cpp -Standard: Cpp03 AlwaysBreakTemplateDeclarations: true PointerAlignment: Left diff --git a/CMakeLists.txt b/CMakeLists.txt index 33d888b80..9e9360ea9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(libcxx CXX C) set(PACKAGE_NAME libcxx) - set(PACKAGE_VERSION 5.0.0svn) + set(PACKAGE_VERSION 4.0.0svn) set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "llvm-bugs@lists.llvm.org") @@ -64,12 +64,8 @@ option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." O option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) -set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) -if (WIN32) - set(ENABLE_FILESYSTEM_DEFAULT OFF) -endif() -option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a" - ${ENABLE_FILESYSTEM_DEFAULT}) +option(LIBCXX_ENABLE_FILESYSTEM + "Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) # Benchmark options ----------------------------------------------------------- @@ -120,19 +116,21 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include NO_DEFAULT_PATH ) - if (LIBCXX_TARGETING_MSVC) - # FIXME: Figure out how to configure the ABI library on Windows. - set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") - elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND - IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") + if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND + IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) - elseif (APPLE) - set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") - set(LIBCXX_CXX_ABI_SYSTEM 1) else() - set(LIBCXX_CXX_ABI_LIBNAME "default") + if (LIBCXX_TARGETING_MSVC) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") + elseif(APPLE) + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_CXX_ABI_SYSTEM 1) + else() + set(LIBCXX_CXX_ABI_LIBNAME "default") + endif() endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") @@ -144,7 +142,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF) # Generate and install a linker script inplace of libc++.so. The linker script # will link libc++ to the correct ABI library. This option is on by default -# on UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' +# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' # is on. This option is also disabled when the ABI library is not specified # or is specified to be "none". set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF) @@ -163,7 +161,7 @@ option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT set(ENABLE_NEW_DELETE_DEFAULT ON) if (LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS) # FIXME: This option should default to off. Unfortunatly GCC 4.9 fails to link -# programs due to undefined references to new/delete in libc++abi so to work +# programs to due undefined references to new/delete in libc++abi so to work # around this libc++abi currently defaults LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS # to ON. Once the GCC bug has been worked around this option should be changed # back to OFF. @@ -344,16 +342,11 @@ set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER}) set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LIBCXX_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build") -if (LLVM_LIBRARY_OUTPUT_INTDIR) - set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) -else() - set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) -endif() +set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBCXX_LIBRARY_DIR}) # Declare libc++ configuration variables. # They are intended for use as follows: @@ -376,9 +369,9 @@ include(HandleLibcxxFlags) # 'config-ix' use them during feature checks. It also adds them to both # 'LIBCXX_COMPILE_FLAGS' and 'LIBCXX_LINK_FLAGS' add_target_flags_if(LIBCXX_BUILD_32_BITS "-m32") -add_target_flags_if(LIBCXX_TARGET_TRIPLE "--target=${LIBCXX_TARGET_TRIPLE}") +add_target_flags_if(LIBCXX_TARGET_TRIPLE "-target ${LIBCXX_TARGET_TRIPLE}") add_target_flags_if(LIBCXX_SYSROOT "--sysroot=${LIBCXX_SYSROOT}") -add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") +add_target_flags_if(LIBCXX_GCC_TOOLCHAIN "-gcc-toolchain ${LIBCXX_GCC_TOOLCHAIN}") if (LIBCXX_TARGET_TRIPLE) set(TARGET_TRIPLE "${LIBCXX_TARGET_TRIPLE}") endif() @@ -421,9 +414,9 @@ remove_flags(-stdlib=libc++ -stdlib=libstdc++) # non-debug DLLs remove_flags("/D_DEBUG" "/MTd" "/MDd" "/MT" "/Md") -# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. +# FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEqDANTIC. # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors -# so they don't get transformed into -Wno and -errors respectively. +# so they don't get transformed into -Wno and -errors respectivly. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) # Required flags ============================================================== @@ -452,11 +445,6 @@ add_compile_flags_if_supported(-nostdinc++) # the dylib when get ODR used by another function. add_compile_flags_if_supported(-fvisibility-inlines-hidden) -if (LIBCXX_CONFIGURE_IDE) - # This simply allows IDE to process - add_compile_flags_if_supported(-fcoroutines-ts) -endif() - # Let the library headers know they are currently being used to build the # library. add_definitions(-D_LIBCPP_BUILDING_LIBRARY) @@ -478,8 +466,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") add_compile_flags_if_supported( -Wno-literal-suffix - -Wno-c++14-compat - -Wno-noexcept-type) + -Wno-c++14-compat) endif() if (LIBCXX_ENABLE_WERROR) add_compile_flags_if_supported(-Werror) @@ -636,12 +623,7 @@ endif() # Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or # LLVM_FOUND is OFF. This allows users to run the tests manually using # LIT without requiring a full LLVM checkout. -# -# However, since some submission systems strip test/ subdirectories, check for -# it before adding it. -if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") - add_subdirectory(test) -endif() +add_subdirectory(test) if (LIBCXX_INCLUDE_TESTS) add_subdirectory(lib/abi) endif() diff --git a/appveyor-reqs-install.cmd b/appveyor-reqs-install.cmd deleted file mode 100644 index e5b30cf43..000000000 --- a/appveyor-reqs-install.cmd +++ /dev/null @@ -1,53 +0,0 @@ -@echo on - -if NOT EXIST C:\projects\deps ( - mkdir C:\projects\deps -) -cd C:\projects\deps - -::########################################################################### -:: Setup Compiler -::########################################################################### -if NOT EXIST llvm-installer.exe ( - appveyor DownloadFile http://llvm.org/pre-releases/win-snapshots/LLVM-5.0.0-r303050-win32.exe -FileName llvm-installer.exe -) -if "%CLANG_VERSION%"=="ToT" ( - START /WAIT llvm-installer.exe /S /D=C:\"Program Files\LLVM" -) -if DEFINED CLANG_VERSION @set PATH="C:\Program Files\LLVM\bin";%PATH% -if DEFINED CLANG_VERSION clang-cl -v - -if DEFINED MINGW_PATH rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe" -if DEFINED MINGW_PATH @set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%" -if DEFINED MINGW_PATH @set "PATH=%PATH%;%MINGW_PATH%" -if DEFINED MINGW_PATH g++ -v - -::########################################################################### -:: Install a recent CMake -::########################################################################### -if NOT EXIST cmake ( - appveyor DownloadFile https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.zip -FileName cmake.zip - 7z x cmake.zip -oC:\projects\deps > nul - move C:\projects\deps\cmake-* C:\projects\deps\cmake - rm cmake.zip -) -@set PATH=C:\projects\deps\cmake\bin;%PATH% -cmake --version - -::########################################################################### -:: Install Ninja -::########################################################################### -if NOT EXIST ninja ( - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.6.0/ninja-win.zip -FileName ninja.zip - 7z x ninja.zip -oC:\projects\deps\ninja > nul - rm ninja.zip -) -@set PATH=C:\projects\deps\ninja;%PATH% -ninja --version - -::########################################################################### -:: Setup the cached copy of LLVM -::########################################################################### -git clone --depth=1 http://llvm.org/git/llvm.git - -@echo off diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index be69a555d..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,78 +0,0 @@ -version: '{build}' - -shallow_clone: true - -build: - verbosity: detailed - -configuration: - - Debug - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_OPTIONS: -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe - CLANG_VERSION: ToT - MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat - MSVC_SETUP_ARG: x86 - GENERATOR: Ninja - MAKE_PROGRAM: ninja - APPVEYOR_SAVE_CACHE_ON_ERROR: true - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_OPTIONS: -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER=clang-cl.exe - CLANG_VERSION: 4 - MSVC_SETUP_PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat - MSVC_SETUP_ARG: x86_amd64 - GENERATOR: Ninja - MAKE_PROGRAM: ninja - APPVEYOR_SAVE_CACHE_ON_ERROR: true - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - MINGW_PATH: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin - GENERATOR: MinGW Makefiles - MAKE_PROGRAM: mingw32-make - APPVEYOR_SAVE_CACHE_ON_ERROR: true - -install: - ############################################################################ - # All external dependencies are installed in C:\projects\deps - ############################################################################ - - call "%APPVEYOR_BUILD_FOLDER%\\appveyor-reqs-install.cmd" - -before_build: - - if DEFINED MSVC_SETUP_PATH call "%MSVC_SETUP_PATH%" %MSVC_SETUP_ARG% - - cd %APPVEYOR_BUILD_FOLDER% - -build_script: - - md C:\projects\build-libcxx - - cd C:\projects\build-libcxx - - echo %configuration% - - ############################################################################# - # Configuration Step - ############################################################################# - - cmake -G "%GENERATOR%" %CMAKE_OPTIONS% - "-DCMAKE_BUILD_TYPE=%configuration%" - "-DLLVM_PATH=C:\projects\deps\llvm" -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF - -DLLVM_LIT_ARGS="-sv --show-xfail --show-unsupported" - %APPVEYOR_BUILD_FOLDER% - - ############################################################################# - # Build Step - ############################################################################# - - "%MAKE_PROGRAM%" - -test_script: - - "%MAKE_PROGRAM% check-cxx" - -on_failure: - - appveyor PushArtifact CMakeFiles/CMakeOutput.log - - appveyor PushArtifact CMakeFiles/CMakeError.log - -artifacts: - - path: '_build/CMakeFiles/*.log' - name: logs - -cache: - - C:\projects\deps\ninja - - C:\projects\deps\cmake - - C:\projects\deps\llvm-installer.exe diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 8211ebd00..a4105be08 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -63,7 +63,7 @@ endif() # Benchmark tests configuration #============================================================================== add_custom_target(cxx-benchmarks) -set(BENCHMARK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx) set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native) set(BENCHMARK_TEST_COMPILE_FLAGS @@ -111,7 +111,6 @@ macro(add_benchmark_test name source_file) set_target_properties(${libcxx_target} PROPERTIES OUTPUT_NAME "${name}.libcxx.out" - RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}") if (LIBCXX_BENCHMARK_NATIVE_STDLIB) @@ -132,7 +131,6 @@ macro(add_benchmark_test name source_file) set_target_properties(${native_target} PROPERTIES OUTPUT_NAME "${name}.native.out" - RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_OUTPUT_DIR}" INCLUDE_DIRECTORIES "" COMPILE_FLAGS "${BENCHMARK_TEST_NATIVE_COMPILE_FLAGS}" LINK_FLAGS "${BENCHMARK_TEST_NATIVE_LINK_FLAGS}") diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake index e9da3c43a..973000831 100644 --- a/cmake/Modules/HandleCompilerRT.cmake +++ b/cmake/Modules/HandleCompilerRT.cmake @@ -5,9 +5,6 @@ function(find_compiler_rt_library name dest) set(dest "" PARENT_SCOPE) set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} "--rtlib=compiler-rt" "--print-libgcc-file-name") - if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET) - list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}") - endif() execute_process( COMMAND ${CLANG_COMMAND} RESULT_VARIABLE HAD_ERROR diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 730ee7e16..4f13b787a 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -1,5 +1,4 @@ include(CheckLibraryExists) -include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) if(WIN32 AND NOT MINGW) @@ -25,32 +24,17 @@ endif() # required during compilation (which has the -nodefaultlibs). libc is # required for the link to go through. We remove sanitizers from the # configuration checks to avoid spurious link errors. -check_c_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) +check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") if (LIBCXX_HAS_C_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES c) endif () if (LIBCXX_USE_COMPILER_RT) - list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt) - find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY) - list(APPEND CMAKE_REQUIRED_LIBRARIES "${LIBCXX_BUILTINS_LIBRARY}") + list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt) elseif (LIBCXX_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) endif () - if (MINGW) - # Mingw64 requires quite a few "C" runtime libraries in order for basic - # programs to link successfully with -nodefaultlibs. - if (LIBCXX_USE_COMPILER_RT) - set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY}) - else () - set(MINGW_RUNTIME gcc_s gcc) - endif() - set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32 - shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} - moldname mingwex msvcrt) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES}) - endif() if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all") endif () diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index d679761a5..f63ee00a5 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -1,9 +1,9 @@ if (LLVM_ENABLE_SPHINX) - include(AddSphinxTarget) if (SPHINX_FOUND) + include(AddSphinxTarget) if (${SPHINX_OUTPUT_HTML}) add_sphinx_target(html libcxx) endif() endif() -endif() +endif() \ No newline at end of file diff --git a/docs/DesignDocs/AvailabilityMarkup.rst b/docs/DesignDocs/AvailabilityMarkup.rst deleted file mode 100644 index 4a85c698f..000000000 --- a/docs/DesignDocs/AvailabilityMarkup.rst +++ /dev/null @@ -1,114 +0,0 @@ -=================== -Availability Markup -=================== - -.. contents:: - :local: - -Overview -======== - -Libc++ is used as a system library on macOS and iOS (amongst others). In order -for users to be able to compile a binary that is intended to be deployed to an -older version of the platform, clang provides the -`availability attribute `_ -that can be placed on declarations to describe the lifecycle of a symbol in the -library. - -Design -====== - -When a new feature is introduced that requires dylib support, a macro should be -created in include/__config to mark this feature as unavailable for all the -systems. For example:: - - // Define availability macros. - #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) - #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) - #else if defined(_LIBCPP_USE_AVAILABILITY_SOME_OTHER_VENDOR) - #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) - #else - #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS - #endif - -When the library is updated by the platform vendor, the markup can be updated. -For example:: - - #define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) - -In the source code, the macro can be added on a class if the full class requires -type info from the library for example:: - - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL - class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access - : public std::logic_error { - -or on a particular symbol: - - _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; - - -Testing -======= - -Some parameters can be passed to lit to run the test-suite and exercising the -availability. - -* The `platform` parameter controls the deployement target. For example lit can - be invoked with `--param=platform=macosx10.8`. Default is the current host. -* The `use_system_cxx_lib` parameter indicates to use another library than the - just built one. Invoking lit with `--param=use_system_cxx_lib=true` will run - the test-suite against the host system library. Alternatively a path to the - directory containing a specific prebuilt libc++ can be used, for example: - `--param=use_system_cxx_lib=/path/to/macOS/10.8/`. -* The `with_availability` boolean parameter enables the availability markup. - -Tests can be marked as XFAIL based on multiple features made available by lit: - - -* if either `use_system_cxx_lib` or `with_availability` is passed to lit, - assuming `--param=platform=macosx10.8` is passed as well the following - features will be available: - - - availability - - availability=x86_64 - - availability=macosx - - availability=x86_64-macosx - - availability=x86_64-apple-macosx10.8 - - availability=macosx10.8 - - This feature is used to XFAIL a test that *is* using a class of a method marked - as unavailable *and* that is expected to *fail* if deployed on an older system. - -* if `use_system_cxx_lib` is passed to lit, the following features will also - be available: - - - with_system_cxx_lib - - with_system_cxx_lib=x86_64 - - with_system_cxx_lib=macosx - - with_system_cxx_lib=x86_64-macosx - - with_system_cxx_lib=x86_64-apple-macosx10.8 - - with_system_cxx_lib=macosx10.8 - - This feature is used to XFAIL a test that is *not* using a class of a method - marked as unavailable *but* that is expected to fail if deployed on an older - system. For example if we know that it exhibits a but in the libc on a - particular system version. - -* if `with_availability` is passed to lit, the following features will also - be available: - - - availability_markup - - availability_markup=x86_64 - - availability_markup=macosx - - availability_markup=x86_64-macosx - - availability_markup=x86_64-apple-macosx10.8 - - availability_markup=macosx10.8 - - This feature is used to XFAIL a test that *is* using a class of a method - marked as unavailable *but* that is expected to *pass* if deployed on an older - system. For example if it is using a symbol in a statically evaluated context. diff --git a/docs/TestingLibcxx.rst b/docs/TestingLibcxx.rst index 5c48ebe61..e4292764c 100644 --- a/docs/TestingLibcxx.rst +++ b/docs/TestingLibcxx.rst @@ -119,7 +119,7 @@ configuration. Passing the option on the command line will override the default. .. option:: libcxx_site_config= Specify the site configuration to use when running the tests. This option - overrides the environment variable LIBCXX_SITE_CONFIG. + overrides the enviroment variable LIBCXX_SITE_CONFIG. .. option:: cxx_headers= diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst index 183664655..fe32f5e6b 100644 --- a/docs/UsingLibcxx.rst +++ b/docs/UsingLibcxx.rst @@ -146,11 +146,6 @@ thread safety annotations. build of libc++ which does not export any symbols, which can be useful when building statically for inclusion into another library. -**_LIBCPP_DISABLE_EXTERN_TEMPLATE**: - This macro is used to disable extern template declarations in the libc++ - headers. The intended use case is for clients who wish to use the libc++ - headers without taking a dependency on the libc++ library itself. - **_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION**: This macro is used to re-enable an extension in `std::tuple` which allowed it to be implicitly constructed from fewer initializers than contained diff --git a/docs/index.rst b/docs/index.rst index 3526b4721..58043f5a4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -128,7 +128,6 @@ Design Documents .. toctree:: :maxdepth: 1 - DesignDocs/AvailabilityMarkup DesignDocs/DebugMode DesignDocs/CapturingConfigInfo DesignDocs/ABIVersioning @@ -146,7 +145,7 @@ Build Bots and Test Coverage * `LLVM Buildbot Builders `_ * `Apple Jenkins Builders `_ -* `Windows Appveyor Builders `_ +* `EricWF's Nightly Builders `_ * `Code Coverage Results `_ Getting Involved diff --git a/include/__bit_reference b/include/__bit_reference index 3e4a21d26..9aea96145 100644 --- a/include/__bit_reference +++ b/include/__bit_reference @@ -14,14 +14,12 @@ #include <__config> #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template class __bit_iterator; @@ -1275,6 +1273,4 @@ private: _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___BIT_REFERENCE diff --git a/include/__bsd_locale_fallbacks.h b/include/__bsd_locale_fallbacks.h index 57199477a..537614c68 100644 --- a/include/__bsd_locale_fallbacks.h +++ b/include/__bsd_locale_fallbacks.h @@ -23,24 +23,27 @@ _LIBCPP_BEGIN_NAMESPACE_STD +typedef _VSTD::remove_pointer::type __use_locale_struct; +typedef _VSTD::unique_ptr<__use_locale_struct, decltype(&uselocale)> __locale_raii; + inline _LIBCPP_ALWAYS_INLINE decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return MB_CUR_MAX; } inline _LIBCPP_ALWAYS_INLINE wint_t __libcpp_btowc_l(int __c, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return btowc(__c); } inline _LIBCPP_ALWAYS_INLINE int __libcpp_wctob_l(wint_t __c, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return wctob(__c); } @@ -48,14 +51,14 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc, size_t __len, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return wcsnrtombs(__dest, __src, __nwc, __len, __ps); } inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return wcrtomb(__s, __wc, __ps); } @@ -63,7 +66,7 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms, size_t __len, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return mbsnrtowcs(__dest, __src, __nms, __len, __ps); } @@ -71,28 +74,28 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return mbrtowc(__pwc, __s, __n, __ps); } inline _LIBCPP_ALWAYS_INLINE int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return mbtowc(__pwc, __pmb, __max); } inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return mbrlen(__s, __n, __ps); } inline _LIBCPP_ALWAYS_INLINE lconv *__libcpp_localeconv_l(locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return localeconv(); } @@ -100,7 +103,7 @@ inline _LIBCPP_ALWAYS_INLINE size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len, mbstate_t *__ps, locale_t __l) { - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); return mbsrtowcs(__dest, __src, __len, __ps); } @@ -108,7 +111,7 @@ inline int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); int __res = vsnprintf(__s, __n, __format, __va); va_end(__va); return __res; @@ -118,7 +121,7 @@ inline int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); int __res = vasprintf(__s, __format, __va); va_end(__va); return __res; @@ -128,7 +131,7 @@ inline int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { va_list __va; va_start(__va, __format); - __libcpp_locale_guard __current(__l); + __locale_raii __current( uselocale(__l), uselocale ); int __res = vsscanf(__s, __format, __va); va_end(__va); return __res; diff --git a/include/__config b/include/__config index 03612ea99..861adb033 100644 --- a/include/__config +++ b/include/__config @@ -25,12 +25,8 @@ #ifdef __GNUC__ #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) -// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme -// introduced in GCC 5.0. -#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else #define _GNUC_VER 0 -#define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 5000 @@ -39,16 +35,6 @@ #define _LIBCPP_ABI_VERSION 1 #endif -#if defined(__ELF__) -#define _LIBCPP_OBJECT_FORMAT_ELF 1 -#elif defined(__MACH__) -#define _LIBCPP_OBJECT_FORMAT_MACHO 1 -#elif defined(_WIN32) -#define _LIBCPP_OBJECT_FORMAT_COFF 1 -#else -#error Unknown object file format -#endif - #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. @@ -63,6 +49,7 @@ #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. @@ -72,17 +59,10 @@ // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE -// Define a key function for `bad_function_call` in the library, to centralize -// its vtable and typeinfo to libc++ rather than having all other libraries -// using that class define their own copies. -#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION #elif _LIBCPP_ABI_VERSION == 1 -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +#if !defined(_WIN32) // Enable compiling copies of now inline methods into the dylib to support -// applications compiled against older libraries. This is unnecessary with -// COFF dllexport semantics, since dllexport forces a non-inline definition -// of inline functions to be emitted anyway. Our own non-inline copy would -// conflict with the dllexport-emitted copy, so we disable it. +// applications compiled against older libraries. #define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS #endif // Feature macros for disabling pre ABI v1 features. All of these options @@ -129,12 +109,6 @@ #define __has_keyword(__x) !(__is_identifier(__x)) -#ifdef __has_include -#define __libcpp_has_include(__x) __has_include(__x) -#else -#define __libcpp_has_include(__x) 0 -#endif - #if defined(__clang__) #define _LIBCPP_COMPILER_CLANG # ifndef __apple_build_version__ @@ -220,12 +194,10 @@ #endif // __NetBSD__ #if defined(_WIN32) -# define _LIBCPP_WIN32API +# define _LIBCPP_WIN32API 1 # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_SHORT_WCHAR 1 -// Both MinGW and native MSVC provide a "MSVC"-like enviroment -# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only. # ifndef __MINGW32__ # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library @@ -236,16 +208,6 @@ # if defined(_LIBCPP_MSVCRT) # define _LIBCPP_HAS_QUICK_EXIT # endif - -// Some CRT APIs are unavailable to store apps -#if defined(WINAPI_FAMILY) -#include -#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ - (!defined(WINAPI_PARTITION_SYSTEM) || \ - !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) -#define _LIBCPP_WINDOWS_STORE_APP -#endif -#endif #endif // defined(_WIN32) #ifdef __sun__ @@ -300,7 +262,7 @@ // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \ + !defined(__arm__)) || \ defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT #endif @@ -322,7 +284,7 @@ typedef __char32_t char32_t; #define _LIBCPP_NO_EXCEPTIONS #endif -#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI) +#if !(__has_feature(cxx_rtti)) #define _LIBCPP_NO_RTTI #endif @@ -383,6 +345,7 @@ typedef __char32_t char32_t; #if __has_feature(objc_arc_weak) #define _LIBCPP_HAS_OBJC_ARC_WEAK +#define _LIBCPP_HAS_NO_STRONG_ENUMS #endif #if !(__has_feature(cxx_constexpr)) @@ -597,6 +560,14 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] +#if defined(__ELF__) +#define _LIBCPP_OBJECT_FORMAT_ELF 1 +#elif defined(__MACH__) +#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +#else +#define _LIBCPP_OBJECT_FORMAT_COFF 1 +#endif + #if defined(_LIBCPP_OBJECT_FORMAT_COFF) #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_DLL_VIS @@ -864,11 +835,6 @@ template struct __static_assert_check {}; # endif #endif -#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE -#define _LIBCPP_EXTERN_TEMPLATE(...) -#define _LIBCPP_EXTERN_TEMPLATE2(...) -#endif - #ifndef _LIBCPP_EXTERN_TEMPLATE #define _LIBCPP_EXTERN_TEMPLATE(...) #endif @@ -976,7 +942,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) # define _LIBCPP_NO_RTTI -# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) +# elif defined(_LIBCPP_MSVC) && !defined(_CPPRTTI) # define _LIBCPP_NO_RTTI # endif #endif @@ -988,7 +954,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // Thread API #if !defined(_LIBCPP_HAS_NO_THREADS) && \ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ - !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) # if defined(__FreeBSD__) || \ defined(__Fuchsia__) || \ @@ -996,8 +961,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( defined(__linux__) || \ defined(__APPLE__) || \ defined(__CloudABI__) || \ - defined(__sun__) || \ - (defined(__MINGW32__) && __libcpp_has_include()) + defined(__sun__) # define _LIBCPP_HAS_THREAD_API_PTHREAD # elif defined(_LIBCPP_WIN32API) # define _LIBCPP_HAS_THREAD_API_WIN32 @@ -1037,7 +1001,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if defined(__BIONIC__) || defined(__CloudABI__) || \ - defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC) + defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE #endif @@ -1080,7 +1044,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #endif #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF +#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF #endif #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) @@ -1099,13 +1063,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( # define _LIBCPP_DIAGNOSE_ERROR(...) #endif -#if __has_attribute(fallthough) || _GNUC_VER >= 700 -// Use a function like macro to imply that it must be followed by a semicolon -#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) -#else -#define _LIBCPP_FALLTHROUGH() ((void)0) -#endif - #if defined(_LIBCPP_ABI_MICROSOFT) && \ (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) @@ -1116,125 +1073,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES -#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 -# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES -#endif - -#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) -# define _LIBCPP_HAS_NO_IS_AGGREGATE -#endif - -#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -# define _LIBCPP_HAS_NO_COROUTINES -#endif - #endif // __cplusplus -// Decide whether to use availability macros. -#if !defined(_LIBCPP_BUILDING_LIBRARY) && \ - !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ - __has_feature(attribute_availability_with_strict) && \ - __has_feature(attribute_availability_in_templates) -#ifdef __APPLE__ -#define _LIBCPP_USE_AVAILABILITY_APPLE -#endif -#endif - -// Define availability macros. -#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ - __attribute__((availability(macosx,strict,introduced=10.12))) \ - __attribute__((availability(ios,strict,introduced=10.0))) \ - __attribute__((availability(tvos,strict,introduced=10.0))) \ - __attribute__((availability(watchos,strict,introduced=3.0))) -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ - __attribute__((availability(ios,strict,introduced=6.0))) -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ - __attribute__((availability(macosx,strict,introduced=10.9))) \ - __attribute__((availability(ios,strict,introduced=7.0))) -#else -#define _LIBCPP_AVAILABILITY_SHARED_MUTEX -#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS -#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE -#define _LIBCPP_AVAILABILITY_FUTURE_ERROR -#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE -#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY -#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR -#endif - -// Define availability that depends on _LIBCPP_NO_EXCEPTIONS. -#ifdef _LIBCPP_NO_EXCEPTIONS -#define _LIBCPP_AVAILABILITY_DYNARRAY -#define _LIBCPP_AVAILABILITY_FUTURE -#else -#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR -#endif - -// Availability of stream API in the dylib got dropped and re-added. The -// extern template should effectively be available at: -// availability(macosx,introduced=10.9) -// availability(ios,introduced=7.0) -#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \ - ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ <= 1090) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ - __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ <= 70000)) -#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE -#endif - -#if defined(_LIBCPP_COMPILER_IBM) -#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO -#endif - -#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS -#else - // Don't warn about macro conflicts when we can restore them at the - // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) -# else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") -# endif -#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) - #endif // _LIBCPP_CONFIG diff --git a/include/__functional_base b/include/__functional_base index 0d2c2fc65..4e2b7eb8d 100644 --- a/include/__functional_base +++ b/include/__functional_base @@ -251,7 +251,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS // 3 or more arguments template @@ -296,6 +296,10 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> typedef _Rp result_type; }; +#endif // _LIBCPP_HAS_NO_VARIADICS + +#ifndef _LIBCPP_CXX03_LANG + template struct __invoke_return { @@ -312,7 +316,7 @@ struct __invoke_return template struct __invoke_void_return_wrapper { -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template static _Ret __call(_Args&&... __args) { return __invoke(_VSTD::forward<_Args>(__args)...); @@ -343,7 +347,7 @@ struct __invoke_void_return_wrapper template <> struct __invoke_void_return_wrapper { -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template static void __call(_Args&&... __args) { __invoke(_VSTD::forward<_Args>(__args)...); @@ -385,7 +389,7 @@ public: // construct/copy/destroy _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(_VSTD::addressof(__f)) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES private: reference_wrapper(type&&); public: // = delete; // do not bind to temps #endif @@ -393,7 +397,7 @@ public: _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;} _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS // invoke template _LIBCPP_INLINE_VISIBILITY @@ -506,7 +510,7 @@ public: operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { return __invoke(get(), __a0, __a1, __a2); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS }; @@ -564,7 +568,7 @@ public: struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY) +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY) extern const allocator_arg_t allocator_arg; #else constexpr allocator_arg_t allocator_arg = allocator_arg_t(); @@ -607,7 +611,7 @@ template constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS // allocator construction @@ -659,7 +663,7 @@ void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __storage, __a, _VSTD::forward<_Args>(__args)... ); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS _LIBCPP_END_NAMESPACE_STD diff --git a/include/__hash_table b/include/__hash_table index b9cd5158f..83a434520 100644 --- a/include/__hash_table +++ b/include/__hash_table @@ -20,18 +20,17 @@ #include #include +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD + #ifndef _LIBCPP_CXX03_LANG template union __hash_value_type; @@ -137,7 +136,7 @@ inline _LIBCPP_INLINE_VISIBILITY size_t __next_hash_pow2(size_t __n) { - return __n < 2 ? __n : (size_t(1) << (std::numeric_limits::digits - __clz(__n-1))); + return size_t(1) << (std::numeric_limits::digits - __clz(__n-1)); } @@ -799,7 +798,8 @@ public: _NOEXCEPT_(is_nothrow_copy_constructible::value) : __data_(__size, __a) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY __bucket_list_deallocator(__bucket_list_deallocator&& __x) _NOEXCEPT_(is_nothrow_move_constructible::value) @@ -807,7 +807,8 @@ public: { __x.size() = 0; } -#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY size_type& size() _NOEXCEPT {return __data_.first();} @@ -1401,7 +1402,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, const key_equal& __eql, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__second_tag(), __node_allocator(__a)), + __p1_(__node_allocator(__a)), __p2_(0, __hf), __p3_(1.0f, __eql) { @@ -1410,7 +1411,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf, template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__second_tag(), __node_allocator(__a)), + __p1_(__node_allocator(__a)), __p2_(0), __p3_(1.0f) { @@ -1422,7 +1423,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u) __bucket_list_deleter(allocator_traits<__pointer_allocator>:: select_on_container_copy_construction( __u.__bucket_list_.get_deleter().__alloc()), 0)), - __p1_(__second_tag(), allocator_traits<__node_allocator>:: + __p1_(allocator_traits<__node_allocator>:: select_on_container_copy_construction(__u.__node_alloc())), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) @@ -1433,7 +1434,7 @@ template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__second_tag(), __node_allocator(__a)), + __p1_(__node_allocator(__a)), __p2_(0, __u.hash_function()), __p3_(__u.__p3_) { @@ -1467,7 +1468,7 @@ template __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u, const allocator_type& __a) : __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)), - __p1_(__second_tag(), __node_allocator(__a)), + __p1_(__node_allocator(__a)), __p2_(0, _VSTD::move(__u.hash_function())), __p3_(_VSTD::move(__u.__p3_)) { @@ -2669,9 +2670,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*, } #endif // _LIBCPP_DEBUG_LEVEL >= 2 - _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP__HASH_TABLE diff --git a/include/__locale b/include/__locale index 766842294..a878e259b 100644 --- a/include/__locale +++ b/include/__locale @@ -19,7 +19,7 @@ #include #include #include -#if defined(_LIBCPP_MSVCRT_LIKE) +#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) # include #elif defined(_AIX) # include @@ -37,11 +37,9 @@ #elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) # include -#elif defined(__Fuchsia__) -# include #elif defined(_LIBCPP_HAS_MUSL_LIBC) # include -#endif +#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -49,25 +47,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS) || defined(_LIBCPP_MSVCRT) -struct __libcpp_locale_guard { - _LIBCPP_INLINE_VISIBILITY - __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {} - - _LIBCPP_INLINE_VISIBILITY - ~__libcpp_locale_guard() { - if (__old_loc_) - uselocale(__old_loc_); - } - - locale_t __old_loc_; -private: - __libcpp_locale_guard(__libcpp_locale_guard const&); - __libcpp_locale_guard& operator=(__libcpp_locale_guard const&); -}; -#endif - - class _LIBCPP_TYPE_VIS locale; template @@ -88,7 +67,6 @@ public: class _LIBCPP_TYPE_VIS id; typedef int category; - _LIBCPP_AVAILABILITY_LOCALE_CATEGORY static const category // values assigned here are for exposition only none = 0, collate = LC_COLLATE_MASK, @@ -367,7 +345,7 @@ public: static const mask punct = _ISpunct; static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; -#elif defined(_LIBCPP_MSVCRT_LIKE) +#elif defined(_LIBCPP_MSVCRT) typedef unsigned short mask; static const mask space = _SPACE; static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; diff --git a/include/__mutex_base b/include/__mutex_base index 3b2453f1b..f76e966e9 100644 --- a/include/__mutex_base +++ b/include/__mutex_base @@ -16,15 +16,10 @@ #include #include <__threading_support> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS @@ -39,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_CONSTEXPR __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; #else __libcpp_mutex_t __m_; @@ -47,8 +42,8 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_CXX03_LANG - constexpr mutex() = default; +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + constexpr mutex() _NOEXCEPT = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} #endif @@ -67,14 +62,11 @@ public: _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; -static_assert(is_nothrow_default_constructible::value, - "the default constructor for std::mutex must be nothrow"); - struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX) +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) extern const defer_lock_t defer_lock; extern const try_to_lock_t try_to_lock; @@ -88,9 +80,21 @@ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); #endif + +// Forward declare lock_guard as a variadic template even in C++03 to keep +// the mangling consistent between dialects. +#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) +template +class _LIBCPP_TEMPLATE_VIS lock_guard; +#endif + template class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) +#if !defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) lock_guard +#else +lock_guard<_Mutex> +#endif { public: typedef _Mutex mutex_type; @@ -158,7 +162,7 @@ private: unique_lock& operator=(unique_lock const&); // = delete; public: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) @@ -175,7 +179,7 @@ public: return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void lock(); bool try_lock(); @@ -287,7 +291,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) class _LIBCPP_TYPE_VIS condition_variable { -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_CONSTEXPR __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; #else __libcpp_condvar_t __cv_; @@ -295,7 +299,7 @@ class _LIBCPP_TYPE_VIS condition_variable public: _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_CONSTEXPR constexpr condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} @@ -435,6 +439,4 @@ condition_variable::wait_for(unique_lock& __lk, _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___MUTEX_BASE diff --git a/include/__split_buffer b/include/__split_buffer index 1daa4e5ad..79d1aa1d7 100644 --- a/include/__split_buffer +++ b/include/__split_buffer @@ -6,14 +6,12 @@ #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -68,7 +66,7 @@ public: __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); ~__split_buffer(); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __split_buffer(__split_buffer&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); @@ -76,7 +74,7 @@ public: _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value) || !__alloc_traits::propagate_on_container_move_assignment::value); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} @@ -101,12 +99,14 @@ public: void shrink_to_fit() _NOEXCEPT; void push_front(const_reference __x); _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) void push_front(value_type&& __x); void push_back(value_type&& __x); +#if !defined(_LIBCPP_HAS_NO_VARIADICS) template void emplace_back(_Args&&... __args); -#endif // !defined(_LIBCPP_CXX03_LANG) +#endif // !defined(_LIBCPP_HAS_NO_VARIADICS) +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);} _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);} @@ -343,7 +343,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer() __alloc_traits::deallocate(__alloc(), __first_, capacity()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) @@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) template __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a) - : __end_cap_(__second_tag(), __a) + : __end_cap_(__a) { if (__a == __c.__alloc()) { @@ -405,7 +405,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -492,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x) --__begin_; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -524,7 +524,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x) --__begin_; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -556,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x) ++__end_; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -588,6 +588,8 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x) ++__end_; } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template void @@ -619,7 +621,9 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args) ++__end_; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -630,8 +634,7 @@ swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y) __x.swap(__y); } + _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_SPLIT_BUFFER diff --git a/include/__std_stream b/include/__std_stream index db90795f6..fb5a346f1 100644 --- a/include/__std_stream +++ b/include/__std_stream @@ -17,14 +17,12 @@ #include <__locale> #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD static const int __limit = 8; @@ -357,6 +355,4 @@ __stdoutbuf<_CharT>::imbue(const locale& __loc) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___STD_STREAM diff --git a/include/__string b/include/__string index d30c7fddc..75608cea7 100644 --- a/include/__string +++ b/include/__string @@ -57,16 +57,14 @@ template <> struct char_traits; #include // For EOF. #include // for __murmur2_or_cityhash +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // char_traits @@ -872,6 +870,4 @@ struct __quoted_output_proxy _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___STRING diff --git a/include/__threading_support b/include/__threading_support index 5d4c90796..aa947139a 100644 --- a/include/__threading_support +++ b/include/__threading_support @@ -27,15 +27,11 @@ # include # include #elif defined(_LIBCPP_HAS_THREAD_API_WIN32) -#include +#include #include #include #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) #define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS @@ -478,10 +474,7 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m, timeout_ms.count() > 0 ? timeout_ms.count() : 0, 0)) - { - auto __ec = GetLastError(); - return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec; - } + return GetLastError(); return 0; } @@ -632,8 +625,6 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // !_LIBCPP_HAS_NO_THREADS #endif // _LIBCPP_THREADING_SUPPORT diff --git a/include/__tree b/include/__tree index 792870aa6..708fe97cb 100644 --- a/include/__tree +++ b/include/__tree @@ -17,14 +17,12 @@ #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template class __tree; @@ -1107,7 +1105,7 @@ public: void __assign_unique(_InputIterator __first, _InputIterator __last); template void __assign_multi(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __tree(__tree&& __t) _NOEXCEPT_( is_nothrow_move_constructible<__node_allocator>::value && @@ -1118,7 +1116,7 @@ public: __node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value && is_nothrow_move_assignable<__node_allocator>::value); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~__tree(); @@ -1504,7 +1502,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) template __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a) : __begin_node_(__iter_pointer()), - __pair1_(__second_tag(), __node_allocator(__a)), + __pair1_(__node_allocator(__a)), __pair3_(0) { __begin_node() = __end_node(); @@ -1514,7 +1512,7 @@ template __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp, const allocator_type& __a) : __begin_node_(__iter_pointer()), - __pair1_(__second_tag(), __node_allocator(__a)), + __pair1_(__node_allocator(__a)), __pair3_(0, __comp) { __begin_node() = __end_node(); @@ -1671,13 +1669,13 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input template __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t) : __begin_node_(__iter_pointer()), - __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())), + __pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())), __pair3_(0, __t.value_comp()) { __begin_node() = __end_node(); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) @@ -1701,7 +1699,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) template __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) - : __pair1_(__second_tag(), __node_allocator(__a)), + : __pair1_(__node_allocator(__a)), __pair3_(0, _VSTD::move(__t.value_comp())) { if (__a == __t.__alloc()) @@ -1807,7 +1805,7 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template __tree<_Tp, _Compare, _Allocator>::~__tree() @@ -2687,6 +2685,4 @@ swap(__tree<_Tp, _Compare, _Allocator>& __x, _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP___TREE diff --git a/include/__tuple b/include/__tuple index 69d6ee961..4193d2cff 100644 --- a/include/__tuple +++ b/include/__tuple @@ -85,7 +85,7 @@ template struct __tuple_like : public __tuple_li // tuple specializations -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_VARIADICS) template struct __tuple_indices {}; @@ -189,8 +189,7 @@ template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&&) _NOEXCEPT; - -#endif // !defined(_LIBCPP_CXX03_LANG) +#endif // pair specializations @@ -206,7 +205,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -234,7 +233,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp&& @@ -246,7 +245,8 @@ const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT; #endif -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_VARIADICS) + // __tuple_types @@ -468,6 +468,9 @@ template using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; #endif +#endif // _LIBCPP_HAS_NO_VARIADICS + +#ifndef _LIBCPP_CXX03_LANG template struct __tuple_like_with_size_imp : false_type {}; @@ -492,7 +495,7 @@ struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { template static constexpr bool __enable_assign() { return false; } }; -#endif // !defined(_LIBCPP_CXX03_LANG) +#endif #if _LIBCPP_STD_VER > 14 diff --git a/include/__undef_macros b/include/__undef_min_max similarity index 76% rename from include/__undef_macros rename to include/__undef_min_max index 60ab1dbfb..f4ca091de 100644 --- a/include/__undef_macros +++ b/include/__undef_min_max @@ -1,17 +1,16 @@ // -*- C++ -*- -//===------------------------ __undef_macros ------------------------------===// +//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// - #ifdef min #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_WARNING) +#if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing min") #else @@ -23,7 +22,7 @@ _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " #ifdef max #if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) -#if defined(_LIBCPP_WARNING) +#if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " "before any Windows header. #undefing max") #else diff --git a/include/algorithm b/include/algorithm index 9fe0361e5..5eec80ca0 100644 --- a/include/algorithm +++ b/include/algorithm @@ -35,9 +35,6 @@ template Function for_each(InputIterator first, InputIterator last, Function f); -template - InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17 - template InputIterator find(InputIterator first, InputIterator last, const T& value); @@ -284,12 +281,12 @@ template template void - random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17 + random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14 template void random_shuffle(RandomAccessIterator first, RandomAccessIterator last, - RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17 + RandomNumberGenerator& rand); // deprecated in C++14 template @@ -647,20 +644,18 @@ template #if defined(__IBMCPP__) #include "support/ibm/support.h" #endif -#if defined(_LIBCPP_COMPILER_MSVC) -#include +#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#include "support/win32/support.h" #endif +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // I'd like to replace these with _VSTD::equal_to, but can't because: @@ -788,132 +783,51 @@ struct __debug_less // Precondition: __x != 0 inline _LIBCPP_INLINE_VISIBILITY -unsigned __ctz(unsigned __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned +__ctz(unsigned __x) +{ return static_cast(__builtin_ctz(__x)); -#else - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long where; - // Search from LSB to MSB for first set bit. - // Returns zero if no set bit is found. - if (_BitScanForward(&where, mask)) - return where; - return 32; -#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long __ctz(unsigned long __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned long +__ctz(unsigned long __x) +{ return static_cast(__builtin_ctzl(__x)); -#else - static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); - return __ctz(static_cast(__x)); -#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long long __ctz(unsigned long long __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned long long +__ctz(unsigned long long __x) +{ return static_cast(__builtin_ctzll(__x)); -#else - unsigned long where; -// Search from LSB to MSB for first set bit. -// Returns zero if no set bit is found. -#if defined(_LIBCPP_HAS_BITSCAN64) - (defined(_M_AMD64) || defined(__x86_64__)) - if (_BitScanForward64(&where, mask)) - return static_cast(where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - // Scan the Low Word. - if (_BitScanForward(&where, static_cast(mask))) - return where; - // Scan the High Word. - if (_BitScanForward(&where, static_cast(mask >> 32))) - return where + 32; // Create a bit offset from the LSB. -#endif - return 64; -#endif // _LIBCPP_COMPILER_MSVC } // Precondition: __x != 0 inline _LIBCPP_INLINE_VISIBILITY -unsigned __clz(unsigned __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned +__clz(unsigned __x) +{ return static_cast(__builtin_clz(__x)); -#else - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long where; - // Search from LSB to MSB for first set bit. - // Returns zero if no set bit is found. - if (_BitScanReverse(&where, mask)) - return 31 - where; - return 32; // Undefined Behavior. -#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long __clz(unsigned long __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned long +__clz(unsigned long __x) +{ return static_cast(__builtin_clzl (__x)); -#else - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - return __clz(static_cast(__x)); -#endif } inline _LIBCPP_INLINE_VISIBILITY -unsigned long long __clz(unsigned long long __x) { -#ifndef _LIBCPP_COMPILER_MSVC +unsigned long long +__clz(unsigned long long __x) +{ return static_cast(__builtin_clzll(__x)); -#else - unsigned long where; -// BitScanReverse scans from MSB to LSB for first set bit. -// Returns 0 if no set bit is found. -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&where, mask)) - return static_cast(63 - where); -#else - // Scan the high 32 bits. - if (_BitScanReverse(&where, static_cast(mask >> 32))) - return 63 - (where + 32); // Create a bit offset from the MSB. - // Scan the low 32 bits. - if (_BitScanReverse(&where, static_cast(mask))) - return 63 - where; -#endif - return 64; // Undefined Behavior. -#endif // _LIBCPP_COMPILER_MSVC } -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) { -#ifndef _LIBCPP_COMPILER_MSVC - return __builtin_popcount (__x); -#else - static_assert(sizeof(unsigned) == 4, ""); - return __popcnt(__x); -#endif -} - -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) { -#ifndef _LIBCPP_COMPILER_MSVC - return __builtin_popcountl (__x); -#else - static_assert(sizeof(unsigned long) == 4, ""); - return __popcnt(__x); -#endif -} - -inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) { -#ifndef _LIBCPP_COMPILER_MSVC - return __builtin_popcountll(__x); -#else - static_assert(sizeof(unsigned long long) == 8, ""); - return __popcnt64(__x); -#endif -} +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);} +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);} +inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {return __builtin_popcountll(__x);} // all_of @@ -966,26 +880,6 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f) return __f; } -#if _LIBCPP_STD_VER > 14 -// for_each_n - -template -inline _LIBCPP_INLINE_VISIBILITY -_InputIterator -for_each_n(_InputIterator __first, _Size __orig_n, _Function __f) -{ - typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize; - _IntegralSize __n = __orig_n; - while (__n > 0) - { - __f(*__first); - ++__first; - --__n; - } - return __first; -} -#endif - // find template @@ -2654,7 +2548,7 @@ min(const _Tp& __a, const _Tp& __b) return _VSTD::min(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2672,7 +2566,7 @@ min(initializer_list<_Tp> __t) return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // max_element @@ -2719,7 +2613,7 @@ max(const _Tp& __a, const _Tp& __b) return _VSTD::max(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2737,7 +2631,7 @@ max(initializer_list<_Tp> __t) return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>()); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_STD_VER > 14 // clamp @@ -2838,7 +2732,7 @@ minmax(const _Tp& __a, const _Tp& __b) return _VSTD::minmax(__a, __b, __less<_Tp>()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -2885,7 +2779,7 @@ minmax(initializer_list<_Tp> __t) return _VSTD::minmax(__t, __less<_Tp>()); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // random_shuffle @@ -2910,11 +2804,11 @@ struct __log2_imp<0, _Rp> static const size_t value = _Rp + 1; }; -template +template struct __log2 { static const size_t value = __log2_imp<_Xp, - sizeof(_UIntType) * __CHAR_BIT__ - 1>::value; + sizeof(_UI) * __CHAR_BIT__ - 1>::value; }; template @@ -2943,7 +2837,7 @@ private: _Engine_result_type __mask0_; _Engine_result_type __mask1_; -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3132,8 +3026,6 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p return static_cast(__u + __p.a()); } -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \ - || defined(_LIBCPP_BUILDING_LIBRARY) class _LIBCPP_TYPE_VIS __rs_default; _LIBCPP_FUNC_VIS __rs_default __rs_get(); @@ -3186,7 +3078,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) template void random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _RandomNumberGenerator&& __rand) #else _RandomNumberGenerator& __rand) @@ -3203,7 +3095,6 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, } } } -#endif template @@ -3279,7 +3170,7 @@ _SampleIterator sample(_PopulationIterator __first, template void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _UniformRandomNumberGenerator&& __g) #else _UniformRandomNumberGenerator& __g) @@ -5906,6 +5797,4 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_ALGORITHM diff --git a/include/any b/include/any index d7161b0d6..823e1304b 100644 --- a/include/any +++ b/include/any @@ -45,10 +45,6 @@ namespace std { any& operator=(ValueType&& rhs); // 6.3.3 any modifiers - template - decay_t& emplace(Args&&... args); - template - decay_t& emplace(initializer_list, Args&&...); void reset() noexcept; void swap(any& rhs) noexcept; @@ -77,6 +73,8 @@ namespace std { template ValueType* any_cast(any* operand) noexcept; +} // namespace fundamentals_v1 +} // namespace experimental } // namespace std */ @@ -260,7 +258,7 @@ public: is_copy_constructible<_Tp>::value> > _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(_Args&&... args); + void emplace(_Args&&... args); template , @@ -269,7 +267,7 @@ public: is_copy_constructible<_Tp>::value> > _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(initializer_list<_Up>, _Args&&...); + void emplace(initializer_list<_Up>, _Args&&...); // 6.3.3 any modifiers _LIBCPP_INLINE_VISIBILITY @@ -366,10 +364,9 @@ namespace __any_imp template _LIBCPP_INLINE_VISIBILITY - static _Tp& __create(any & __dest, _Args&&... __args) { - _Tp* __ret = ::new (static_cast(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...); + static void __create(any & __dest, _Args&&... __args) { + ::new (static_cast(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...); __dest.__h = &_SmallHandler::__handle; - return *__ret; } private: @@ -442,15 +439,14 @@ namespace __any_imp template _LIBCPP_INLINE_VISIBILITY - static _Tp& __create(any & __dest, _Args&&... __args) { + static void __create(any & __dest, _Args&&... __args) { typedef allocator<_Tp> _Alloc; typedef __allocator_destructor<_Alloc> _Dp; _Alloc __a; unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - _Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...); + ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...); __dest.__s.__ptr = __hold.release(); __dest.__h = &_LargeHandler::__handle; - return *__ret; } private: @@ -523,16 +519,16 @@ any & any::operator=(_ValueType && __v) template inline _LIBCPP_INLINE_VISIBILITY -_Tp& any::emplace(_Args&&... __args) { +void any::emplace(_Args&&... __args) { reset(); - return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); + __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...); } template inline _LIBCPP_INLINE_VISIBILITY -_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) { +void any::emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); - return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); + __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...); } inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/array b/include/array index 79f7e0d62..165ffad6b 100644 --- a/include/array +++ b/include/array @@ -113,8 +113,6 @@ template const T&& get(const array&&) noexce #pragma GCC system_header #endif - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -318,7 +316,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT return __a.__elems_[_Ip]; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -338,7 +336,7 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT return _VSTD::move(__a.__elems_[_Ip]); } -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_END_NAMESPACE_STD diff --git a/include/atomic b/include/atomic index f55e28ff5..a17bdce1c 100644 --- a/include/atomic +++ b/include/atomic @@ -861,29 +861,16 @@ kill_dependency(_Tp __y) _NOEXCEPT return __y; } -#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) -# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE -# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE -# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE -# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE -# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE -# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE -# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE -# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE -# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE -# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE -#else -# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -#endif +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE // general atomic diff --git a/include/bitset b/include/bitset index 583122fbf..827a901ff 100644 --- a/include/bitset +++ b/include/bitset @@ -113,6 +113,10 @@ template struct hash>; */ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #include <__config> #include <__bit_reference> #include @@ -122,13 +126,7 @@ template struct hash>; #include #include <__functional_base> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - +#include <__undef_min_max> _LIBCPP_BEGIN_NAMESPACE_STD @@ -199,11 +197,11 @@ protected: _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT; private: -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR void __init(unsigned long long __v, false_type) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void __init(unsigned long long __v, true_type) _NOEXCEPT; -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_CONSTEXPR unsigned long to_ulong(false_type) const; _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong(true_type) const; @@ -219,16 +217,16 @@ template inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset() _NOEXCEPT -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_CONSTEXPR : __first_{0} #endif { -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR _VSTD::fill_n(__first_, _N_words, __storage_type(0)); #endif } -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR template void @@ -251,13 +249,13 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_CONSTEXPR template inline _LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_CONSTEXPR #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 @@ -267,7 +265,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #endif #endif { -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR __init(__v, integral_constant()); #endif } @@ -1092,6 +1090,4 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x); _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_BITSET diff --git a/include/chrono b/include/chrono index 4b793c760..4e82ef2b5 100644 --- a/include/chrono +++ b/include/chrono @@ -48,7 +48,7 @@ class duration static_assert(Period::num > 0, "duration period must be positive"); public: typedef Rep rep; - typedef typename _Period::type period; + typedef Period period; constexpr duration() = default; template @@ -75,8 +75,8 @@ public: // arithmetic - constexpr common_type::type operator+() const; - constexpr common_type::type operator-() const; + constexpr duration operator+() const; + constexpr duration operator-() const; constexpr duration& operator++(); constexpr duration operator++(int); constexpr duration& operator--(); @@ -305,14 +305,12 @@ constexpr chrono::duration operator "" ns(long doub #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono @@ -525,7 +523,7 @@ class _LIBCPP_TEMPLATE_VIS duration public: typedef _Rep rep; - typedef typename _Period::type period; + typedef _Period period; private: rep __rep_; public: @@ -567,8 +565,8 @@ public: // arithmetic - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type::type operator+() const {return typename common_type::type(*this);} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type::type operator-() const {return typename common_type::type(-__rep_);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;} @@ -1162,6 +1160,4 @@ namespace chrono { // hoist the literals into namespace std::chrono _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_CHRONO diff --git a/include/cmath b/include/cmath index b41f247af..74b4ab8a8 100644 --- a/include/cmath +++ b/include/cmath @@ -398,6 +398,7 @@ using ::cbrtf; using ::copysign; using ::copysignf; +#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::erf; using ::erff; using ::erfc; @@ -434,10 +435,12 @@ using ::lrint; using ::lrintf; using ::lround; using ::lroundf; +#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::nan; using ::nanf; +#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::nearbyint; using ::nearbyintf; using ::nextafter; @@ -460,6 +463,7 @@ using ::tgamma; using ::tgammaf; using ::trunc; using ::truncf; +#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::acosl; using ::asinl; @@ -491,6 +495,7 @@ using ::cbrtl; using ::copysignl; +#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) using ::erfl; using ::erfcl; using ::exp2l; @@ -521,6 +526,7 @@ using ::scalblnl; using ::scalbnl; using ::tgammal; using ::truncl; +#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) #if _LIBCPP_STD_VER > 14 inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); } diff --git a/include/cstddef b/include/cstddef index 62584494d..103898b7d 100644 --- a/include/cstddef +++ b/include/cstddef @@ -28,7 +28,6 @@ Types: size_t max_align_t nullptr_t - byte // C++17 } // std @@ -59,32 +58,4 @@ typedef long double max_align_t; _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 -namespace std // purposefully not versioned -{ -enum class byte : unsigned char {}; - -constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept -{ return __lhs = byte(static_cast(__lhs) | static_cast(__rhs)); } -constexpr byte operator| (byte __lhs, byte __rhs) noexcept -{ return byte(static_cast(__lhs) | static_cast(__rhs)); } - -constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept -{ return __lhs = byte(static_cast(__lhs) & static_cast(__rhs)); } -constexpr byte operator& (byte __lhs, byte __rhs) noexcept -{ return byte(static_cast(__lhs) & static_cast(__rhs)); } - -constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept -{ return __lhs = byte(static_cast(__lhs) ^ static_cast(__rhs)); } -constexpr byte operator^ (byte __lhs, byte __rhs) noexcept -{ return byte(static_cast(__lhs) ^ static_cast(__rhs)); } - -constexpr byte operator~ (byte __b) noexcept -{ return byte(~static_cast(__b)); } - -} - -#include // rest of byte -#endif - #endif // _LIBCPP_CSTDDEF diff --git a/include/cstdio b/include/cstdio index 00b989fad..35941ce35 100644 --- a/include/cstdio +++ b/include/cstdio @@ -98,6 +98,9 @@ void perror(const char* s); #include <__config> #include +#if defined(_LIBCPP_MSVCRT) +#include +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -153,7 +156,8 @@ using ::tmpnam; #ifndef _LIBCPP_HAS_NO_STDIN using ::getchar; -#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT) +#if _LIBCPP_STD_VER <= 11 && \ + (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14) using ::gets; #endif using ::scanf; diff --git a/include/cstdlib b/include/cstdlib index 78c428403..2ca25ed56 100644 --- a/include/cstdlib +++ b/include/cstdlib @@ -130,10 +130,8 @@ using ::abort; using ::atexit; using ::exit; using ::_Exit; -#ifndef _LIBCPP_WINDOWS_STORE_APP using ::getenv; using ::system; -#endif using ::bsearch; using ::qsort; using ::abs; diff --git a/include/ctype.h b/include/ctype.h index e97ff3c48..22d6c49be 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -40,6 +40,15 @@ int toupper(int c); #ifdef __cplusplus +#if defined(_LIBCPP_MSVCRT) +// We support including .h headers inside 'extern "C"' contexts, so switch +// back to C++ linkage before including these C++ headers. +extern "C++" { + #include "support/win32/support.h" + #include "support/win32/locale_win32.h" +} +#endif // _LIBCPP_MSVCRT + #undef isalnum #undef isalpha #undef isblank diff --git a/include/deque b/include/deque index f795b489e..92801540f 100644 --- a/include/deque +++ b/include/deque @@ -150,6 +150,10 @@ template */ +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + #include <__config> #include <__split_buffer> #include @@ -158,13 +162,7 @@ template #include #include -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - +#include <__undef_min_max> _LIBCPP_BEGIN_NAMESPACE_STD @@ -970,12 +968,13 @@ protected: public: ~__deque_base(); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + __deque_base(__deque_base&& __c) _NOEXCEPT_(is_nothrow_move_constructible::value); __deque_base(__deque_base&& __c, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void swap(__deque_base& __c) #if _LIBCPP_STD_VER >= 14 _NOEXCEPT; @@ -1109,7 +1108,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base() __alloc_traits::deallocate(__alloc(), *__i, __block_size); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c) @@ -1141,7 +1140,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_ } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -1231,16 +1230,18 @@ public: typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0); deque(const deque& __c); deque(const deque& __c, const allocator_type& __a); - - deque& operator=(const deque& __c); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS deque(initializer_list __il); deque(initializer_list __il, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + deque& operator=(const deque& __c); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY deque& operator=(initializer_list __il) {assign(__il); return *this;} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value); _LIBCPP_INLINE_VISIBILITY @@ -1249,10 +1250,7 @@ public: deque& operator=(deque&& __c) _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); - - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void assign(_InputIter __f, _InputIter __l, @@ -1262,6 +1260,10 @@ public: void assign(_RAIter __f, _RAIter __l, typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0); void assign(size_type __n, const value_type& __v); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il) {assign(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT; @@ -1338,7 +1340,8 @@ public: // 23.2.2.3 modifiers: void push_front(const value_type& __v); void push_back(const value_type& __v); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_VARIADICS #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); template reference emplace_back (_Args&&... __args); @@ -1347,16 +1350,11 @@ public: template void emplace_back (_Args&&... __args); #endif template iterator emplace(const_iterator __p, _Args&&... __args); - +#endif // _LIBCPP_HAS_NO_VARIADICS void push_front(value_type&& __v); void push_back(value_type&& __v); iterator insert(const_iterator __p, value_type&& __v); - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, initializer_list __il) - {return insert(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES iterator insert(const_iterator __p, const value_type& __v); iterator insert(const_iterator __p, size_type __n, const value_type& __v); template @@ -1370,7 +1368,11 @@ public: template iterator insert(const_iterator __p, _BiIter __f, _BiIter __l, typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0); - +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void pop_front(); void pop_back(); iterator erase(const_iterator __p); @@ -1525,19 +1527,7 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a) __append(__c.begin(), __c.end()); } -template -deque<_Tp, _Allocator>& -deque<_Tp, _Allocator>::operator=(const deque& __c) -{ - if (this != &__c) - { - __copy_assign_alloc(__c); - assign(__c.begin(), __c.end()); - } - return *this; -} - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template deque<_Tp, _Allocator>::deque(initializer_list __il) @@ -1552,6 +1542,22 @@ deque<_Tp, _Allocator>::deque(initializer_list __il, const allocator __append(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +template +deque<_Tp, _Allocator>& +deque<_Tp, _Allocator>::operator=(const deque& __c) +{ + if (this != &__c) + { + __copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline deque<_Tp, _Allocator>::deque(deque&& __c) @@ -1607,7 +1613,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type) __base::__move_assign(__c); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -1803,20 +1809,8 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v) ++__base::size(); } -template -void -deque<_Tp, _Allocator>::push_front(const value_type& __v) -{ - allocator_type& __a = __base::__alloc(); - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); - --__base::__start_; - ++__base::size(); -} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_CXX03_LANG template void deque<_Tp, _Allocator>::push_back(value_type&& __v) @@ -1829,6 +1823,8 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v) ++__base::size(); } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template #if _LIBCPP_STD_VER > 14 @@ -1850,6 +1846,24 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args) #endif } +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +void +deque<_Tp, _Allocator>::push_front(const value_type& __v) +{ + allocator_type& __a = __base::__alloc(); + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v); + --__base::__start_; + ++__base::size(); +} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void deque<_Tp, _Allocator>::push_front(value_type&& __v) @@ -1863,6 +1877,7 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v) ++__base::size(); } +#ifndef _LIBCPP_HAS_NO_VARIADICS template template @@ -1885,121 +1900,8 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args) #endif } -template -typename deque<_Tp, _Allocator>::iterator -deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) -{ - size_type __pos = __p - __base::begin(); - size_type __to_end = __base::size() - __pos; - allocator_type& __a = __base::__alloc(); - if (__pos < __to_end) - { // insert by shifting things backward - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - if (__pos == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); - --__base::__start_; - ++__base::size(); - } - else - { - iterator __b = __base::begin(); - iterator __bm1 = _VSTD::prev(__b); - __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); - --__base::__start_; - ++__base::size(); - if (__pos > 1) - __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); - *__b = _VSTD::move(__v); - } - } - else - { // insert by shifting things forward - if (__back_spare() == 0) - __add_back_capacity(); - // __back_capacity >= 1 - size_type __de = __base::size() - __pos; - if (__de == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); - ++__base::size(); - } - else - { - iterator __e = __base::end(); - iterator __em1 = _VSTD::prev(__e); - __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); - ++__base::size(); - if (__de > 1) - __e = _VSTD::move_backward(__e - __de, __em1, __e); - *--__e = _VSTD::move(__v); - } - } - return __base::begin() + __pos; -} - -template -template -typename deque<_Tp, _Allocator>::iterator -deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) -{ - size_type __pos = __p - __base::begin(); - size_type __to_end = __base::size() - __pos; - allocator_type& __a = __base::__alloc(); - if (__pos < __to_end) - { // insert by shifting things backward - if (__front_spare() == 0) - __add_front_capacity(); - // __front_spare() >= 1 - if (__pos == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); - --__base::__start_; - ++__base::size(); - } - else - { - __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); - iterator __b = __base::begin(); - iterator __bm1 = _VSTD::prev(__b); - __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); - --__base::__start_; - ++__base::size(); - if (__pos > 1) - __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); - *__b = _VSTD::move(__tmp.get()); - } - } - else - { // insert by shifting things forward - if (__back_spare() == 0) - __add_back_capacity(); - // __back_capacity >= 1 - size_type __de = __base::size() - __pos; - if (__de == 0) - { - __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...); - ++__base::size(); - } - else - { - __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); - iterator __e = __base::end(); - iterator __em1 = _VSTD::prev(__e); - __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); - ++__base::size(); - if (__de > 1) - __e = _VSTD::move_backward(__e - __de, __em1, __e); - *--__e = _VSTD::move(__tmp.get()); - } - } - return __base::begin() + __pos; -} - -#endif // _LIBCPP_CXX03_LANG - +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename deque<_Tp, _Allocator>::iterator @@ -2062,6 +1964,126 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v) return __base::begin() + __pos; } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v)); + --__base::__start_; + ++__base::size(); + } + else + { + iterator __b = __base::begin(); + iterator __bm1 = _VSTD::prev(__b); + __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); + *__b = _VSTD::move(__v); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v)); + ++__base::size(); + } + else + { + iterator __e = __base::end(); + iterator __em1 = _VSTD::prev(__e); + __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _VSTD::move(__v); + } + } + return __base::begin() + __pos; +} + +#ifndef _LIBCPP_HAS_NO_VARIADICS + +template +template +typename deque<_Tp, _Allocator>::iterator +deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args) +{ + size_type __pos = __p - __base::begin(); + size_type __to_end = __base::size() - __pos; + allocator_type& __a = __base::__alloc(); + if (__pos < __to_end) + { // insert by shifting things backward + if (__front_spare() == 0) + __add_front_capacity(); + // __front_spare() >= 1 + if (__pos == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...); + --__base::__start_; + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); + iterator __b = __base::begin(); + iterator __bm1 = _VSTD::prev(__b); + __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); + --__base::__start_; + ++__base::size(); + if (__pos > 1) + __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); + *__b = _VSTD::move(__tmp.get()); + } + } + else + { // insert by shifting things forward + if (__back_spare() == 0) + __add_back_capacity(); + // __back_capacity >= 1 + size_type __de = __base::size() - __pos; + if (__de == 0) + { + __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...); + ++__base::size(); + } + else + { + __temp_value __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); + iterator __e = __base::end(); + iterator __em1 = _VSTD::prev(__e); + __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); + ++__base::size(); + if (__de > 1) + __e = _VSTD::move_backward(__e - __de, __em1, __e); + *--__e = _VSTD::move(__tmp.get()); + } + } + return __base::begin() + __pos; +} + +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + template typename deque<_Tp, _Allocator>::iterator deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v) @@ -2902,6 +2924,4 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_DEQUE diff --git a/include/exception b/include/exception index ca2eaf5c6..216ae0c70 100644 --- a/include/exception +++ b/include/exception @@ -127,33 +127,30 @@ _LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT; _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT; _LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT; -_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT; +_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT; class _LIBCPP_TYPE_VIS exception_ptr; _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); -#ifndef _LIBCPP_ABI_MICROSOFT - class _LIBCPP_TYPE_VIS exception_ptr { void* __ptr_; public: _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} - exception_ptr(const exception_ptr&) _NOEXCEPT; exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; ~exception_ptr() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT - {return __ptr_ != nullptr;} + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT + operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} friend _LIBCPP_INLINE_VISIBILITY bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return __x.__ptr_ == __y.__ptr_;} - friend _LIBCPP_INLINE_VISIBILITY bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {return !(__x == __y);} @@ -181,54 +178,6 @@ make_exception_ptr(_Ep __e) _NOEXCEPT #endif } -#else // _LIBCPP_ABI_MICROSOFT - -class _LIBCPP_TYPE_VIS exception_ptr -{ -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-private-field" -#endif - void* __ptr1_; - void* __ptr2_; -#if defined(__clang__) -#pragma clang diagnostic pop -#endif -public: - exception_ptr() _NOEXCEPT; - exception_ptr(nullptr_t) _NOEXCEPT; - exception_ptr(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(nullptr_t) _NOEXCEPT; - ~exception_ptr() _NOEXCEPT; - _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT; -}; - -_LIBCPP_FUNC_VIS -bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; - -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT - {return !(__x == __y);} - -_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; - -_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); -_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr p); - -// This is a built-in template function which automagically extracts the required -// information. -template void *__GetExceptionInfo(_E); - -template -exception_ptr -make_exception_ptr(_Ep __e) _NOEXCEPT -{ - return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e)); -} - -#endif // _LIBCPP_ABI_MICROSOFT // nested_exception class _LIBCPP_EXCEPTION_ABI nested_exception @@ -253,54 +202,46 @@ struct __nested _LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {} }; +template +_LIBCPP_NORETURN +void +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +throw_with_nested(_Tp&& __t, typename enable_if< + is_class::type>::value && + !is_base_of::type>::value + && !__libcpp_is_final::type>::value + >::type* = 0) +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +throw_with_nested (_Tp& __t, typename enable_if< + is_class<_Tp>::value && !is_base_of::value + >::type* = 0) +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +{ #ifndef _LIBCPP_NO_EXCEPTIONS -template -struct __throw_with_nested; - -template -struct __throw_with_nested<_Tp, _Up, true> { - _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void -#ifndef _LIBCPP_CXX03_LANG - __do_throw(_Tp&& __t) + throw __nested::type>(_VSTD::forward<_Tp>(__t)); #else - __do_throw (_Tp& __t) -#endif // _LIBCPP_CXX03_LANG - { - throw __nested<_Up>(_VSTD::forward<_Tp>(__t)); - } -}; - -template -struct __throw_with_nested<_Tp, _Up, false> { - _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void -#ifndef _LIBCPP_CXX03_LANG - __do_throw(_Tp&& __t) -#else - __do_throw (_Tp& __t) -#endif // _LIBCPP_CXX03_LANG - { - throw _VSTD::forward<_Tp>(__t); - } -}; + ((void)__t); + // FIXME: Make this abort. #endif +} template _LIBCPP_NORETURN void -#ifndef _LIBCPP_CXX03_LANG -throw_with_nested(_Tp&& __t) -#else -throw_with_nested (_Tp& __t) -#endif // _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +throw_with_nested(_Tp&& __t, typename enable_if< + !is_class::type>::value || + is_base_of::type>::value + || __libcpp_is_final::type>::value + >::type* = 0) +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES +throw_with_nested (_Tp& __t, typename enable_if< + !is_class<_Tp>::value || is_base_of::value + >::type* = 0) +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES { #ifndef _LIBCPP_NO_EXCEPTIONS - typedef typename decay<_Tp>::type _Up; - static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); - __throw_with_nested<_Tp, _Up, - is_class<_Up>::value && - !is_base_of::value && - !__libcpp_is_final<_Up>::value>:: - __do_throw(_VSTD::forward<_Tp>(__t)); + throw _VSTD::forward<_Tp>(__t); #else ((void)__t); // FIXME: Make this abort diff --git a/include/experimental/__config b/include/experimental/__config index 37f88c166..9a7bbe85d 100644 --- a/include/experimental/__config +++ b/include/experimental/__config @@ -44,13 +44,6 @@ #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \ } } _LIBCPP_END_NAMESPACE_EXPERIMENTAL -#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \ - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 { - -#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \ - } _LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1 #define _VSTD_FS ::std::experimental::filesystem::v1 diff --git a/include/experimental/algorithm b/include/experimental/algorithm index 3801cae4f..b32d7ca66 100644 --- a/include/experimental/algorithm +++ b/include/experimental/algorithm @@ -39,18 +39,17 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last, #include #include +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_LFTS + template _LIBCPP_INLINE_VISIBILITY _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) @@ -68,6 +67,4 @@ _SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last, _LIBCPP_END_NAMESPACE_LFTS -_LIBCPP_POP_MACROS - #endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */ diff --git a/include/experimental/coroutine b/include/experimental/coroutine deleted file mode 100644 index 21c1ea566..000000000 --- a/include/experimental/coroutine +++ /dev/null @@ -1,294 +0,0 @@ -// -*- C++ -*- -//===----------------------------- coroutine -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE -#define _LIBCPP_EXPERIMENTAL_COROUTINE - -/** - experimental/coroutine synopsis - -// C++next - -namespace std { -namespace experimental { -inline namespace coroutines_v1 { - - // 18.11.1 coroutine traits -template -class coroutine_traits; -// 18.11.2 coroutine handle -template -class coroutine_handle; -// 18.11.2.7 comparison operators: -bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -// 18.11.3 trivial awaitables -struct suspend_never; -struct suspend_always; -// 18.11.2.8 hash support: -template struct hash; -template struct hash>; - -} // namespace coroutines_v1 -} // namespace experimental -} // namespace std - - */ - -#include -#include -#include -#include -#include // for hash -#include -#include -#include <__debug> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -#ifdef _LIBCPP_HAS_NO_COROUTINES -# if defined(_LIBCPP_WARNING) - _LIBCPP_WARNING(" cannot be used with this compiler") -# else -# warning cannot be used with this compiler -# endif -#endif - -#ifndef _LIBCPP_HAS_NO_COROUTINES - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES - -template -struct __coroutine_traits_sfinae {}; - -template -struct __coroutine_traits_sfinae< - _Tp, typename __void_t::type> -{ - using promise_type = typename _Tp::promise_type; -}; - -template -struct _LIBCPP_TEMPLATE_VIS coroutine_traits - : public __coroutine_traits_sfinae<_Ret> -{ -}; - -template -class _LIBCPP_TEMPLATE_VIS coroutine_handle; - -template <> -class _LIBCPP_TEMPLATE_VIS coroutine_handle { -public: - _LIBCPP_ALWAYS_INLINE - _LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {} - - _LIBCPP_ALWAYS_INLINE - _LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {} - - _LIBCPP_ALWAYS_INLINE - coroutine_handle& operator=(nullptr_t) _NOEXCEPT { - __handle_ = nullptr; - return *this; - } - - _LIBCPP_ALWAYS_INLINE - _LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; } - - _LIBCPP_ALWAYS_INLINE - _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; } - - _LIBCPP_ALWAYS_INLINE - void operator()() { resume(); } - - _LIBCPP_ALWAYS_INLINE - void resume() { - _LIBCPP_ASSERT(__is_suspended(), - "resume() can only be called on suspended coroutines"); - _LIBCPP_ASSERT(!done(), - "resume() has undefined behavior when the coroutine is done"); - __builtin_coro_resume(__handle_); - } - - _LIBCPP_ALWAYS_INLINE - void destroy() { - _LIBCPP_ASSERT(__is_suspended(), - "destroy() can only be called on suspended coroutines"); - __builtin_coro_destroy(__handle_); - } - - _LIBCPP_ALWAYS_INLINE - bool done() const { - _LIBCPP_ASSERT(__is_suspended(), - "done() can only be called on suspended coroutines"); - return __builtin_coro_done(__handle_); - } - -public: - _LIBCPP_ALWAYS_INLINE - static coroutine_handle from_address(void* __addr) _NOEXCEPT { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // FIXME: Should from_address(nullptr) be allowed? - _LIBCPP_ALWAYS_INLINE - static coroutine_handle from_address(nullptr_t) _NOEXCEPT { - return coroutine_handle(nullptr); - } - - template - static coroutine_handle from_address(_Tp*) { - static_assert(_CallIsValid, - "coroutine_handle::from_address cannot be called with " - "non-void pointers"); - } - -private: - bool __is_suspended() const _NOEXCEPT { - // FIXME actually implement a check for if the coro is suspended. - return __handle_; - } - - template friend class coroutine_handle; - void* __handle_; -}; - -// 18.11.2.7 comparison operators: -inline _LIBCPP_ALWAYS_INLINE -bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return __x.address() == __y.address(); -} -inline _LIBCPP_ALWAYS_INLINE -bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x == __y); -} -inline _LIBCPP_ALWAYS_INLINE -bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return less()(__x.address(), __y.address()); -} -inline _LIBCPP_ALWAYS_INLINE -bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return __y < __x; -} -inline _LIBCPP_ALWAYS_INLINE -bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x > __y); -} -inline _LIBCPP_ALWAYS_INLINE -bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x < __y); -} - -template -class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> { - using _Base = coroutine_handle<>; -public: -#ifndef _LIBCPP_CXX03_LANG - // 18.11.2.1 construct/reset - using coroutine_handle<>::coroutine_handle; -#else - _LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {} - _LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {} -#endif - _LIBCPP_INLINE_VISIBILITY - coroutine_handle& operator=(nullptr_t) _NOEXCEPT { - _Base::operator=(nullptr); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - _Promise& promise() const { - return *reinterpret_cast<_Promise*>( - __builtin_coro_promise(this->__handle_, __alignof(_Promise), false)); - } - -public: - _LIBCPP_ALWAYS_INLINE - static coroutine_handle from_address(void* __addr) _NOEXCEPT { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // NOTE: this overload isn't required by the standard but is needed so - // the deleted _Promise* overload doesn't make from_address(nullptr) - // ambiguous. - // FIXME: should from_address work with nullptr? - _LIBCPP_ALWAYS_INLINE - static coroutine_handle from_address(nullptr_t) _NOEXCEPT { - return coroutine_handle(nullptr); - } - - template - static coroutine_handle from_address(_Tp*) { - static_assert(_CallIsValid, - "coroutine_handle::from_address cannot be called with " - "non-void pointers"); - } - - template - static coroutine_handle from_address(_Promise*) { - static_assert(_CallIsValid, - "coroutine_handle::from_address cannot be used with " - "pointers to the coroutine's promise type; use 'from_promise' instead"); - } - - _LIBCPP_ALWAYS_INLINE - static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { - coroutine_handle __tmp; - __tmp.__handle_ = __builtin_coro_promise(_VSTD::addressof(__promise), - __alignof(_Promise), true); - return __tmp; - } -}; - -struct _LIBCPP_TYPE_VIS suspend_never { - _LIBCPP_ALWAYS_INLINE - bool await_ready() const _NOEXCEPT { return true; } - _LIBCPP_ALWAYS_INLINE - void await_suspend(coroutine_handle<>) const _NOEXCEPT {} - _LIBCPP_ALWAYS_INLINE - void await_resume() const _NOEXCEPT {} -}; - -struct _LIBCPP_TYPE_VIS suspend_always { - _LIBCPP_ALWAYS_INLINE - bool await_ready() const _NOEXCEPT { return false; } - _LIBCPP_ALWAYS_INLINE - void await_suspend(coroutine_handle<>) const _NOEXCEPT {} - _LIBCPP_ALWAYS_INLINE - void await_resume() const _NOEXCEPT {} -}; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES - -_LIBCPP_BEGIN_NAMESPACE_STD - -template -struct hash<_VSTD_CORO::coroutine_handle<_Tp> > { - using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>; - _LIBCPP_INLINE_VISIBILITY - size_t operator()(__arg_type const& __v) const _NOEXCEPT - {return hash()(__v.address());} -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // !defined(_LIBCPP_HAS_NO_COROUTINES) - -#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */ diff --git a/include/experimental/dynarray b/include/experimental/dynarray index 16193317a..8c9733770 100644 --- a/include/experimental/dynarray +++ b/include/experimental/dynarray @@ -107,13 +107,10 @@ public: #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - namespace std { namespace experimental { inline namespace __array_extensions_v1 { template -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray +struct _LIBCPP_TEMPLATE_VIS dynarray { public: // types: @@ -298,7 +295,5 @@ template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // if _LIBCPP_STD_VER > 11 #endif // _LIBCPP_DYNARRAY diff --git a/include/experimental/filesystem b/include/experimental/filesystem index 42157ba30..cf62ca27a 100644 --- a/include/experimental/filesystem +++ b/include/experimental/filesystem @@ -1091,13 +1091,10 @@ class _LIBCPP_TYPE_VIS path::iterator { public: typedef bidirectional_iterator_tag iterator_category; - typedef path value_type; typedef std::ptrdiff_t difference_type; typedef const path* pointer; typedef const path& reference; - - typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator public: _LIBCPP_INLINE_VISIBILITY iterator() : __stashed_elem_(), __path_ptr_(nullptr), diff --git a/include/experimental/functional b/include/experimental/functional index a136cbb57..75fc8e99f 100644 --- a/include/experimental/functional +++ b/include/experimental/functional @@ -89,22 +89,21 @@ inline namespace fundamentals_v1 { #include #include + #include #include #include #include #include +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_LFTS #if _LIBCPP_STD_VER > 11 @@ -457,6 +456,4 @@ make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIter _LIBCPP_END_NAMESPACE_LFTS -_LIBCPP_POP_MACROS - #endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */ diff --git a/include/experimental/memory_resource b/include/experimental/memory_resource index d101f3e08..743f9cbe6 100644 --- a/include/experimental/memory_resource +++ b/include/experimental/memory_resource @@ -82,9 +82,6 @@ namespace pmr { #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR // Round __s up to next multiple of __a. @@ -422,6 +419,4 @@ using resource_adaptor = __resource_adaptor_imp< _LIBCPP_END_NAMESPACE_LFTS_PMR -_LIBCPP_POP_MACROS - #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ diff --git a/include/experimental/numeric b/include/experimental/numeric index d784c08f0..d1209dbec 100644 --- a/include/experimental/numeric +++ b/include/experimental/numeric @@ -41,9 +41,6 @@ inline namespace fundamentals_v2 { #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - #if _LIBCPP_STD_VER > 11 _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 @@ -69,11 +66,11 @@ struct __abs<_Result, _Source, false> { template -_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN -inline _Tp __gcd(_Tp __m, _Tp __n) +_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY +_Tp __gcd(_Tp __m, _Tp __n) { static_assert((!is_signed<_Tp>::value), "" ); - return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n); + return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n); } @@ -87,9 +84,8 @@ gcd(_Tp __m, _Up __n) static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd( - static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); + return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), + static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); } template @@ -104,7 +100,7 @@ lcm(_Tp __m, _Up __n) return 0; using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n); + _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n); _Rp __val2 = __abs<_Rp, _Up>()(__n); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; @@ -113,7 +109,4 @@ lcm(_Tp __m, _Up __n) _LIBCPP_END_NAMESPACE_LFTS_V2 #endif /* _LIBCPP_STD_VER > 11 */ - -_LIBCPP_POP_MACROS - #endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */ diff --git a/include/experimental/optional b/include/experimental/optional index b251748fb..f32941b1a 100644 --- a/include/experimental/optional +++ b/include/experimental/optional @@ -143,24 +143,9 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 { #include #include #include -#if _LIBCPP_STD_VER > 11 -#include -#include -#include -#include <__functional_base> -#include <__debug> -#endif - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access +class _LIBCPP_EXCEPTION_ABI bad_optional_access : public std::logic_error { public: @@ -175,6 +160,17 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL #if _LIBCPP_STD_VER > 11 +#include +#include +#include +#include <__functional_base> +#include <__undef_min_max> +#include <__debug> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + _LIBCPP_BEGIN_NAMESPACE_LFTS struct in_place_t {}; @@ -527,9 +523,6 @@ public: constexpr explicit operator bool() const noexcept {return this->__engaged_;} _LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_NO_EXCEPTIONS -_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS -#endif constexpr void __throw_bad_optional_access() const { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -539,7 +532,7 @@ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS #endif } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + _LIBCPP_INLINE_VISIBILITY constexpr value_type const& value() const { if (!this->__engaged_) @@ -547,7 +540,7 @@ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS return this->__val_; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + _LIBCPP_INLINE_VISIBILITY value_type& value() { if (!this->__engaged_) @@ -917,6 +910,4 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 11 -_LIBCPP_POP_MACROS - #endif // _LIBCPP_EXPERIMENTAL_OPTIONAL diff --git a/include/experimental/string_view b/include/experimental/string_view index da104f9a1..41c0d34d3 100644 --- a/include/experimental/string_view +++ b/include/experimental/string_view @@ -189,9 +189,6 @@ namespace std { #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_LFTS template > @@ -813,6 +810,4 @@ quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv, _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_LFTS_STRING_VIEW diff --git a/include/ext/hash_map b/include/ext/hash_map index 998e8f659..fab36a155 100644 --- a/include/ext/hash_map +++ b/include/ext/hash_map @@ -207,7 +207,7 @@ template #include #if __DEPRECATED -#if defined(_LIBCPP_WARNING) +#if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") #else # warning Use of the header is deprecated. Migrate to @@ -331,7 +331,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor&& __x) : __na_(__x.__na_), @@ -340,7 +340,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor& __x) : __na_(__x.__na_), @@ -349,7 +349,7 @@ public: { const_cast(__x.__value_constructed) = false; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) diff --git a/include/ext/hash_set b/include/ext/hash_set index 38f81ed3b..916ed6910 100644 --- a/include/ext/hash_set +++ b/include/ext/hash_set @@ -199,7 +199,7 @@ template #include #if __DEPRECATED -#if defined(_LIBCPP_WARNING) +#if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("Use of the header is deprecated. Migrate to ") #else # warning Use of the header is deprecated. Migrate to diff --git a/include/forward_list b/include/forward_list index 8bfa9a084..879f2d3ce 100644 --- a/include/forward_list +++ b/include/forward_list @@ -167,20 +167,19 @@ template */ #include <__config> + #include #include #include #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template struct __forward_list_node; @@ -479,14 +478,14 @@ protected: __forward_list_base(const allocator_type& __a) : __before_begin_(__begin_node(), __node_allocator(__a)) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES public: _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); _LIBCPP_INLINE_VISIBILITY __forward_list_base(__forward_list_base&& __x, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES private: __forward_list_base(const __forward_list_base&); @@ -540,7 +539,7 @@ private: {__alloc() = _VSTD::move(__x.__alloc());} }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -564,7 +563,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x, } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template __forward_list_base<_Tp, _Alloc>::~__forward_list_base() @@ -657,33 +656,32 @@ public: >::type* = nullptr); forward_list(const forward_list& __x); forward_list(const forward_list& __x, const allocator_type& __a); - - forward_list& operator=(const forward_list& __x); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible::value) : base(_VSTD::move(__x)) {} forward_list(forward_list&& __x, const allocator_type& __a); - +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS forward_list(initializer_list __il); forward_list(initializer_list __il, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + // ~forward_list() = default; + + forward_list& operator=(const forward_list& __x); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY forward_list& operator=(forward_list&& __x) _NOEXCEPT_( __node_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable::value); - +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY forward_list& operator=(initializer_list __il); - - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG - - // ~forward_list() = default; +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template typename enable_if @@ -693,6 +691,10 @@ public: >::type assign(_InputIterator __f, _InputIterator __l); void assign(size_type __n, const value_type& __v); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -743,26 +745,27 @@ public: _LIBCPP_INLINE_VISIBILITY const_reference front() const {return base::__before_begin()->__next_->__value_;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_VARIADICS #if _LIBCPP_STD_VER > 14 template reference emplace_front(_Args&&... __args); #else template void emplace_front(_Args&&... __args); +#endif #endif void push_front(value_type&& __v); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void push_front(const value_type& __v); void pop_front(); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_VARIADICS template iterator emplace_after(const_iterator __p, _Args&&... __args); - +#endif // _LIBCPP_HAS_NO_VARIADICS iterator insert_after(const_iterator __p, value_type&& __v); - iterator insert_after(const_iterator __p, initializer_list __il) - {return insert_after(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES iterator insert_after(const_iterator __p, const value_type& __v); iterator insert_after(const_iterator __p, size_type __n, const value_type& __v); template @@ -773,6 +776,10 @@ public: iterator >::type insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + iterator insert_after(const_iterator __p, initializer_list __il) + {return insert_after(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __f, const_iterator __l); @@ -792,7 +799,7 @@ public: _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {base::clear();} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice_after(const_iterator __p, forward_list&& __x); _LIBCPP_INLINE_VISIBILITY @@ -800,7 +807,7 @@ public: _LIBCPP_INLINE_VISIBILITY void splice_after(const_iterator __p, forward_list&& __x, const_iterator __f, const_iterator __l); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void splice_after(const_iterator __p, forward_list& __x); void splice_after(const_iterator __p, forward_list& __x, const_iterator __i); void splice_after(const_iterator __p, forward_list& __x, @@ -810,14 +817,14 @@ public: _LIBCPP_INLINE_VISIBILITY void unique() {unique(__equal_to());} template void unique(_BinaryPredicate __binary_pred); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x) {merge(__x, __less());} template _LIBCPP_INLINE_VISIBILITY void merge(forward_list&& __x, _Compare __comp) {merge(__x, _VSTD::move(__comp));} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void merge(forward_list& __x) {merge(__x, __less());} template void merge(forward_list& __x, _Compare __comp); @@ -828,11 +835,11 @@ public: private: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES void __move_assign(forward_list& __x, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value); void __move_assign(forward_list& __x, false_type); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template static @@ -948,19 +955,8 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, insert_after(cbefore_begin(), __x.begin(), __x.end()); } -template -forward_list<_Tp, _Alloc>& -forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) -{ - if (this != &__x) - { - base::__copy_assign_alloc(__x); - assign(__x.begin(), __x.end()); - } - return *this; -} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_CXX03_LANG template forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, const allocator_type& __a) @@ -973,6 +969,10 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, } } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template forward_list<_Tp, _Alloc>::forward_list(initializer_list __il) { @@ -987,6 +987,22 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list __il, insert_after(cbefore_begin(), __il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +template +forward_list<_Tp, _Alloc>& +forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) +{ + if (this != &__x) + { + base::__copy_assign_alloc(__x); + assign(__x.begin(), __x.end()); + } + return *this; +} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) @@ -1024,6 +1040,10 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline forward_list<_Tp, _Alloc>& @@ -1033,7 +1053,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list __il) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -1070,7 +1090,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) erase_after(__i, __e); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline @@ -1080,6 +1100,11 @@ forward_list<_Tp, _Alloc>::assign(initializer_list __il) assign(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template #if _LIBCPP_STD_VER > 14 @@ -1101,6 +1126,8 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) #endif } +#endif // _LIBCPP_HAS_NO_VARIADICS + template void forward_list<_Tp, _Alloc>::push_front(value_type&& __v) @@ -1113,7 +1140,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v) base::__before_begin()->__next_ = __h.release(); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -1138,7 +1165,8 @@ forward_list<_Tp, _Alloc>::pop_front() __node_traits::deallocate(__a, __p, 1); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_VARIADICS template template @@ -1156,6 +1184,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args) return iterator(__r->__next_); } +#endif // _LIBCPP_HAS_NO_VARIADICS + template typename forward_list<_Tp, _Alloc>::iterator forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) @@ -1170,7 +1200,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v) return iterator(__r->__next_); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename forward_list<_Tp, _Alloc>::iterator @@ -1438,7 +1468,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1469,7 +1499,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, splice_after(__p, __x, __f, __l); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -1720,6 +1750,4 @@ swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_FORWARD_LIST diff --git a/include/fstream b/include/fstream index e41a53af4..7bcc5d450 100644 --- a/include/fstream +++ b/include/fstream @@ -171,14 +171,12 @@ typedef basic_fstream wfstream; #include <__locale> #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -195,13 +193,13 @@ public: // 27.9.1.2 Constructors/destructor: basic_filebuf(); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_filebuf(basic_filebuf&& __rhs); #endif virtual ~basic_filebuf(); // 27.9.1.3 Assign/swap: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_filebuf& operator=(basic_filebuf&& __rhs); #endif @@ -278,7 +276,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf() setbuf(0, 4096); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) @@ -354,7 +352,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_filebuf<_CharT, _Traits>::~basic_filebuf() @@ -1019,10 +1017,12 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ifstream(basic_ifstream&& __rhs); +#endif +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ifstream& operator=(basic_ifstream&& __rhs); #endif @@ -1071,7 +1071,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1092,7 +1092,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1177,10 +1177,12 @@ public: explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ofstream(basic_ofstream&& __rhs); +#endif +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_ofstream& operator=(basic_ofstream&& __rhs); #endif @@ -1229,7 +1231,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope } #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1250,7 +1252,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1337,10 +1339,12 @@ public: _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_fstream(basic_fstream&& __rhs); +#endif +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_fstream& operator=(basic_fstream&& __rhs); #endif @@ -1389,7 +1393,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm } #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1410,7 +1414,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1478,6 +1482,4 @@ basic_fstream<_CharT, _Traits>::close() _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_FSTREAM diff --git a/include/functional b/include/functional index ea35697d3..2a810b1a0 100644 --- a/include/functional +++ b/include/functional @@ -235,7 +235,7 @@ namespace placeholders { } template -class binder1st // deprecated in C++11, removed in C++17 +class binder1st : public unary_function { @@ -249,10 +249,10 @@ public: }; template -binder1st bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 +binder1st bind1st(const Operation& op, const T& x); template -class binder2nd // deprecated in C++11, removed in C++17 +class binder2nd : public unary_function { @@ -266,9 +266,9 @@ public: }; template -binder2nd bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 +binder2nd bind2nd(const Operation& op, const T& x); -template // deprecated in C++11, removed in C++17 +template class pointer_to_unary_function : public unary_function { public: @@ -277,9 +277,9 @@ public: }; template -pointer_to_unary_function ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 +pointer_to_unary_function ptr_fun(Result (*f)(Arg)); -template // deprecated in C++11, removed in C++17 +template class pointer_to_binary_function : public binary_function { public: @@ -288,9 +288,9 @@ public: }; template -pointer_to_binary_function ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 +pointer_to_binary_function ptr_fun(Result (*f)(Arg1,Arg2)); -template // deprecated in C++11, removed in C++17 +template class mem_fun_t : public unary_function { public: @@ -299,18 +299,18 @@ public: }; template -class mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 +class mem_fun1_t : public binary_function { public: explicit mem_fun1_t(S (T::*p)(A)); S operator()(T* p, A x) const; }; -template mem_fun_t mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 -template mem_fun1_t mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17 +template mem_fun_t mem_fun(S (T::*f)()); +template mem_fun1_t mem_fun(S (T::*f)(A)); template -class mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 +class mem_fun_ref_t : public unary_function { public: explicit mem_fun_ref_t(S (T::*p)()); @@ -318,18 +318,18 @@ public: }; template -class mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 +class mem_fun1_ref_t : public binary_function { public: explicit mem_fun1_ref_t(S (T::*p)(A)); S operator()(T& p, A x) const; }; -template mem_fun_ref_t mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 -template mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 +template mem_fun_ref_t mem_fun_ref(S (T::*f)()); +template mem_fun1_ref_t mem_fun_ref(S (T::*f)(A)); template -class const_mem_fun_t : public unary_function // deprecated in C++11, removed in C++17 +class const_mem_fun_t : public unary_function { public: explicit const_mem_fun_t(S (T::*p)() const); @@ -337,18 +337,18 @@ public: }; template -class const_mem_fun1_t : public binary_function // deprecated in C++11, removed in C++17 +class const_mem_fun1_t : public binary_function { public: explicit const_mem_fun1_t(S (T::*p)(A) const); S operator()(const T* p, A x) const; }; -template const_mem_fun_t mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 -template const_mem_fun1_t mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 +template const_mem_fun_t mem_fun(S (T::*f)() const); +template const_mem_fun1_t mem_fun(S (T::*f)(A) const); template -class const_mem_fun_ref_t : public unary_function // deprecated in C++11, removed in C++17 +class const_mem_fun_ref_t : public unary_function { public: explicit const_mem_fun_ref_t(S (T::*p)() const); @@ -356,15 +356,15 @@ public: }; template -class const_mem_fun1_ref_t : public binary_function // deprecated in C++11, removed in C++17 +class const_mem_fun1_ref_t : public binary_function { public: explicit const_mem_fun1_ref_t(S (T::*p)(A) const); S operator()(const T& p, A x) const; }; -template const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 -template const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 +template const_mem_fun_ref_t mem_fun_ref(S (T::*f)() const); +template const_mem_fun1_ref_t mem_fun_ref(S (T::*f)(A) const); template unspecified mem_fn(R T::*); @@ -470,7 +470,6 @@ template <> struct hash; template <> struct hash; template struct hash; -template <> struct hash; // C++17 } // std @@ -1020,7 +1019,6 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} -#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) template class _LIBCPP_TEMPLATE_VIS binder1st : public unary_function mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} -#endif //////////////////////////////////////////////////////////////////////////////// // MEMFUN @@ -1264,7 +1261,7 @@ private: public: _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS // invoke template _LIBCPP_INLINE_VISIBILITY @@ -1391,12 +1388,6 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT class _LIBCPP_EXCEPTION_ABI bad_function_call : public exception { -#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION -public: - virtual ~bad_function_call() _NOEXCEPT; - - virtual const char* what() const _NOEXCEPT; -#endif }; _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE @@ -1454,7 +1445,7 @@ bool __not_null(function<_Fp> const& __f) { return !!__f; } } // namespace __function -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS namespace __function { @@ -1983,7 +1974,7 @@ void swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT {return __x.swap(__y);} -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS #include <__functional_03> @@ -2047,7 +2038,7 @@ struct __is_placeholder > : public integral_constant {}; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template inline _LIBCPP_INLINE_VISIBILITY @@ -2224,7 +2215,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, _Args&& __args) { - return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...); + return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...); } template @@ -2257,7 +2248,7 @@ public: typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type operator()(_Args&& ...__args) { - return _VSTD::__apply_functor(__f_, __bound_args_, __indices(), + return __apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...)); } @@ -2266,7 +2257,7 @@ public: typename __bind_return >::type operator()(_Args&& ...__args) const { - return _VSTD::__apply_functor(__f_, __bound_args_, __indices(), + return __apply_functor(__f_, __bound_args_, __indices(), tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...)); } }; @@ -2347,7 +2338,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args) return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS #if _LIBCPP_STD_VER > 14 diff --git a/include/future b/include/future index e38876758..1ceedf91e 100644 --- a/include/future +++ b/include/future @@ -499,7 +499,7 @@ make_error_condition(future_errc __e) _NOEXCEPT return error_condition(static_cast(__e), future_category()); } -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_FUTURE_ERROR future_error +class _LIBCPP_EXCEPTION_ABI future_error : public logic_error { error_code __ec_; @@ -515,9 +515,6 @@ public: }; _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE -#ifndef _LIBCPP_NO_EXCEPTIONS -_LIBCPP_AVAILABILITY_FUTURE_ERROR -#endif void __throw_future_error(future_errc _Ev) { #ifndef _LIBCPP_NO_EXCEPTIONS @@ -528,7 +525,7 @@ void __throw_future_error(future_errc _Ev) #endif } -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state +class _LIBCPP_TYPE_VIS __assoc_sub_state : public __shared_count { protected: @@ -615,7 +612,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c } template -class _LIBCPP_AVAILABILITY_FUTURE __assoc_state +class __assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -655,7 +652,6 @@ __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT template template -_LIBCPP_AVAILABILITY_FUTURE void #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __assoc_state<_Rp>::set_value(_Arg&& __arg) @@ -711,7 +707,7 @@ __assoc_state<_Rp>::copy() } template -class _LIBCPP_AVAILABILITY_FUTURE __assoc_state<_Rp&> +class __assoc_state<_Rp&> : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -771,7 +767,7 @@ __assoc_state<_Rp&>::copy() } template -class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc +class __assoc_state_alloc : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -799,7 +795,7 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT } template -class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc<_Rp&, _Alloc> +class __assoc_state_alloc<_Rp&, _Alloc> : public __assoc_state<_Rp&> { typedef __assoc_state<_Rp&> base; @@ -825,7 +821,7 @@ __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT } template -class _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state_alloc +class __assoc_sub_state_alloc : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -851,7 +847,7 @@ __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT } template -class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state +class __deferred_assoc_state : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -898,7 +894,7 @@ __deferred_assoc_state<_Rp, _Fp>::__execute() } template -class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state +class __deferred_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -946,7 +942,7 @@ __deferred_assoc_state::__execute() } template -class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state +class __async_assoc_state : public __assoc_state<_Rp> { typedef __assoc_state<_Rp> base; @@ -1001,7 +997,7 @@ __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT } template -class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state +class __async_assoc_state : public __assoc_sub_state { typedef __assoc_sub_state base; @@ -1080,7 +1076,7 @@ __make_async_assoc_state(_Fp __f); #endif template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future +class _LIBCPP_TEMPLATE_VIS future { __assoc_state<_Rp>* __state_; @@ -1183,7 +1179,7 @@ future<_Rp>::get() } template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&> +class _LIBCPP_TEMPLATE_VIS future<_Rp&> { __assoc_state<_Rp&>* __state_; @@ -1281,7 +1277,7 @@ future<_Rp&>::get() } template <> -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future +class _LIBCPP_TYPE_VIS future { __assoc_sub_state* __state_; @@ -1364,7 +1360,7 @@ swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT template class packaged_task; template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise +class _LIBCPP_TEMPLATE_VIS promise { __assoc_state<_Rp>* __state_; @@ -1531,7 +1527,7 @@ promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) // promise template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<_Rp&> +class _LIBCPP_TEMPLATE_VIS promise<_Rp&> { __assoc_state<_Rp&>* __state_; @@ -1667,7 +1663,7 @@ promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) // promise template <> -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE promise +class _LIBCPP_TYPE_VIS promise { __assoc_sub_state* __state_; @@ -1753,7 +1749,7 @@ template template class __packaged_task_base; template -class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)> +class __packaged_task_base<_Rp(_ArgTypes...)> { __packaged_task_base(const __packaged_task_base&); __packaged_task_base& operator=(const __packaged_task_base&); @@ -1771,7 +1767,7 @@ public: template class __packaged_task_func; template -class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> +class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)> : public __packaged_task_base<_Rp(_ArgTypes...)> { __compressed_pair<_Fp, _Alloc> __f_; @@ -1829,7 +1825,7 @@ __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... template class __packaged_task_function; template -class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)> +class __packaged_task_function<_Rp(_ArgTypes...)> { typedef __packaged_task_base<_Rp(_ArgTypes...)> __base; typename aligned_storage<3*sizeof(void*)>::type __buf_; @@ -2004,7 +2000,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) cons } template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<_Rp(_ArgTypes...)> +class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)> { public: typedef _Rp result_type; // extension @@ -2133,7 +2129,7 @@ packaged_task<_Rp(_ArgTypes...)>::reset() } template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task +class _LIBCPP_TEMPLATE_VIS packaged_task { public: typedef void result_type; // extension @@ -2521,7 +2517,7 @@ shared_future<_Rp&>::operator=(const shared_future& __rhs) } template <> -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE shared_future +class _LIBCPP_TYPE_VIS shared_future { __assoc_sub_state* __state_; diff --git a/include/initializer_list b/include/initializer_list index 8c234aaaa..d6dfa8081 100644 --- a/include/initializer_list +++ b/include/initializer_list @@ -53,7 +53,7 @@ template const E* end(initializer_list il) noexcept; // constexpr in namespace std // purposefully not versioned { -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template class _LIBCPP_TEMPLATE_VIS initializer_list @@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT return __il.end(); } -#endif // !defined(_LIBCPP_CXX03_LANG) +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } // std diff --git a/include/ios b/include/ios index 61d00b90e..49f0c01f9 100644 --- a/include/ios +++ b/include/ios @@ -657,7 +657,7 @@ protected: _LIBCPP_INLINE_VISIBILITY void move(basic_ios& __rhs); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_ALWAYS_INLINE void move(basic_ios&& __rhs) {move(__rhs);} #endif diff --git a/include/istream b/include/istream index 0b8e05d95..774f38df2 100644 --- a/include/istream +++ b/include/istream @@ -162,14 +162,12 @@ template #include <__config> #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -191,11 +189,12 @@ public: { this->init(__sb); } virtual ~basic_istream(); protected: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_istream(basic_istream&& __rhs); - +#endif // 27.7.1.1.2 Assign/swap: +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_istream& operator=(basic_istream&& __rhs); #endif @@ -333,7 +332,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _ __is.setstate(ios_base::failbit); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs) @@ -351,7 +350,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_istream<_CharT, _Traits>::~basic_istream() @@ -1425,7 +1424,7 @@ ws(basic_istream<_CharT, _Traits>& __is) return __is; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1436,7 +1435,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x) return __is; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template class _LIBCPP_TEMPLATE_VIS basic_iostream @@ -1459,11 +1458,13 @@ public: virtual ~basic_iostream(); protected: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_iostream(basic_iostream&& __rhs); +#endif // assign/swap +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_iostream& operator=(basic_iostream&& __rhs); #endif @@ -1473,7 +1474,7 @@ protected: public: }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) @@ -1489,7 +1490,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_iostream<_CharT, _Traits>::~basic_iostream() @@ -1606,7 +1607,7 @@ getline(basic_istream<_CharT, _Traits>& __is, return getline(__is, __str, __is.widen('\n')); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1626,7 +1627,7 @@ getline(basic_istream<_CharT, _Traits>&& __is, return getline(__is, __str, __is.widen('\n')); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_istream<_CharT, _Traits>& @@ -1677,14 +1678,10 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) return __is; } -#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream) -#endif _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_ISTREAM diff --git a/include/iterator b/include/iterator index d163ab1b0..b8f657085 100644 --- a/include/iterator +++ b/include/iterator @@ -64,23 +64,14 @@ struct forward_iterator_tag : public input_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; -// 27.4.3, iterator operations // extension: second argument not conforming to C++03 -template // constexpr in C++17 - constexpr void advance(InputIterator& i, +template +void advance(InputIterator& i, typename iterator_traits::difference_type n); -template // constexpr in C++17 - constexpr typename iterator_traits::difference_type - distance(InputIterator first, InputIterator last); - -template // constexpr in C++17 - constexpr InputIterator next(InputIterator x, -typename iterator_traits::difference_type n = 1); - -template // constexpr in C++17 - constexpr BidirectionalIterator prev(BidirectionalIterator x, - typename iterator_traits::difference_type n = 1); +template +typename iterator_traits::difference_type +distance(InputIterator first, InputIterator last); template class reverse_iterator @@ -538,7 +529,7 @@ struct _LIBCPP_TEMPLATE_VIS iterator }; template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY void __advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) { @@ -547,7 +538,7 @@ void __advance(_InputIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY void __advance(_BiDirIter& __i, typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) { @@ -560,7 +551,7 @@ void __advance(_BiDirIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) { @@ -568,7 +559,7 @@ void __advance(_RandIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY void advance(_InputIter& __i, typename iterator_traits<_InputIter>::difference_type __n) { @@ -576,7 +567,7 @@ void advance(_InputIter& __i, } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY typename iterator_traits<_InputIter>::difference_type __distance(_InputIter __first, _InputIter __last, input_iterator_tag) { @@ -587,7 +578,7 @@ __distance(_InputIter __first, _InputIter __last, input_iterator_tag) } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY typename iterator_traits<_RandIter>::difference_type __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) { @@ -595,7 +586,7 @@ __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY typename iterator_traits<_InputIter>::difference_type distance(_InputIter __first, _InputIter __last) { @@ -603,7 +594,7 @@ distance(_InputIter __first, _InputIter __last) } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY _InputIter next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1, @@ -614,7 +605,7 @@ next(_InputIter __x, } template -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 +inline _LIBCPP_INLINE_VISIBILITY _BidiretionalIter prev(_BidiretionalIter __x, typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, @@ -624,14 +615,6 @@ prev(_BidiretionalIter __x, return __x; } - -template -struct __is_stashing_iterator : false_type {}; - -template -struct __is_stashing_iterator<_Tp, typename __void_t::type> - : true_type {}; - template class _LIBCPP_TEMPLATE_VIS reverse_iterator : public iterator::iterator_category, @@ -642,11 +625,6 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator { private: /*mutable*/ _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break - - static_assert(!__is_stashing_iterator<_Iter>::value, - "The specified iterator type cannot be used with reverse_iterator; " - "Using stashing iterators with reverse_iterator causes undefined behavior"); - protected: _Iter current; public: @@ -792,10 +770,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_back(__value_); return *this;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_back(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} @@ -825,10 +803,10 @@ public: _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) {container->push_front(__value_); return *this;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) {container->push_front(_VSTD::move(__value_)); return *this;} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} @@ -860,10 +838,10 @@ public: : container(_VSTD::addressof(__x)), iter(__i) {} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) {iter = container->insert(iter, __value_); ++iter; return *this;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} @@ -990,6 +968,7 @@ public: _LIBCPP_INLINE_VISIBILITY char_type operator*() const {return static_cast(__sbuf_->sgetc());} + _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() { __sbuf_->sbumpc(); @@ -1068,7 +1047,7 @@ public: typedef typename iterator_traits::value_type value_type; typedef typename iterator_traits::difference_type difference_type; typedef iterator_type pointer; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef typename iterator_traits::reference __reference; typedef typename conditional< is_reference<__reference>::value, diff --git a/include/limits b/include/limits index f530507f7..b15f8f1b6 100644 --- a/include/limits +++ b/include/limits @@ -101,24 +101,23 @@ template<> class numeric_limits; } // std */ -#include <__config> -#include - -#if defined(_LIBCPP_COMPILER_MSVC) -#include "support/win32/limits_msvc_win32.h" -#endif // _LIBCPP_MSVCRT - -#if defined(__IBMCPP__) -#include "support/ibm/limits.h" -#endif // __IBMCPP__ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> +#include <__config> +#include +#include <__undef_min_max> + +#if defined(_LIBCPP_MSVCRT) +#include "support/win32/limits_win32.h" +#endif // _LIBCPP_MSVCRT + +#if defined(__IBMCPP__) +#include "support/ibm/limits.h" +#endif // __IBMCPP__ _LIBCPP_BEGIN_NAMESPACE_STD @@ -183,14 +182,14 @@ protected: static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero; }; -template +template struct __libcpp_compute_min { - static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits); + static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits); }; -template -struct __libcpp_compute_min<_Tp, __digits, false> +template +struct __libcpp_compute_min<_Tp, digits, false> { static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0); }; @@ -812,6 +811,4 @@ template _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_LIMITS diff --git a/include/list b/include/list index 20a66c360..fa148db51 100644 --- a/include/list +++ b/include/list @@ -177,16 +177,14 @@ template #include #include +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template struct __list_node; @@ -862,10 +860,11 @@ public: list(const list& __c, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(const list& __c); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS list(initializer_list __il); list(initializer_list __il, const allocator_type& __a); - +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); @@ -876,20 +875,22 @@ public: _NOEXCEPT_( __node_alloc_traits::propagate_on_container_move_assignment::value && is_nothrow_move_assignable<__node_allocator>::value); - +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY list& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} - - _LIBCPP_INLINE_VISIBILITY - void assign(initializer_list __il) - {assign(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template void assign(_InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); void assign(size_type __n, const value_type& __x); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + void assign(initializer_list __il) + {assign(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT; @@ -963,10 +964,10 @@ public: return base::__end_.__prev_->__as_node()->__value_; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES void push_front(value_type&& __x); void push_back(value_type&& __x); - +#ifndef _LIBCPP_HAS_NO_VARIADICS template #if _LIBCPP_STD_VER > 14 reference emplace_front(_Args&&... __args); @@ -981,13 +982,9 @@ public: #endif template iterator emplace(const_iterator __p, _Args&&... __args); - +#endif // _LIBCPP_HAS_NO_VARIADICS iterator insert(const_iterator __p, value_type&& __x); - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, initializer_list __il) - {return insert(__p, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void push_front(const value_type& __x); void push_back(const value_type& __x); @@ -997,6 +994,11 @@ public: template iterator insert(const_iterator __p, _InpIter __f, _InpIter __l, typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, initializer_list __il) + {return insert(__p, __il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void swap(list& __c) @@ -1020,18 +1022,22 @@ public: void resize(size_type __n, const value_type& __x); void splice(const_iterator __p, list& __c); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c) {splice(__p, __c);} +#endif + void splice(const_iterator __p, list& __c, const_iterator __i); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c, const_iterator __i) {splice(__p, __c, __i);} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l) {splice(__p, __c, __f, __l);} -#endif - void splice(const_iterator __p, list& __c, const_iterator __i); - void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void remove(const value_type& __x); template void remove_if(_Pred __pred); @@ -1041,17 +1047,17 @@ public: void unique(_BinaryPred __binary_pred); _LIBCPP_INLINE_VISIBILITY void merge(list& __c); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void merge(list&& __c) {merge(__c);} - - template - _LIBCPP_INLINE_VISIBILITY - void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} #endif template void merge(list& __c, _Comp __comp); - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template + _LIBCPP_INLINE_VISIBILITY + void merge(list&& __c, _Comp __comp) {merge(__c, __comp);} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void sort(); template @@ -1140,7 +1146,7 @@ list<_Tp, _Alloc>::list(size_type __n) __get_db()->__insert_c(this); #endif for (; __n > 0; --__n) -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES emplace_back(); #else push_back(value_type()); @@ -1155,7 +1161,11 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) __get_db()->__insert_c(this); #endif for (; __n > 0; --__n) +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES emplace_back(); +#else + push_back(value_type()); +#endif } #endif @@ -1229,7 +1239,7 @@ list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a) push_back(*__i); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template list<_Tp, _Alloc>::list(initializer_list __il, const allocator_type& __a) @@ -1254,6 +1264,23 @@ list<_Tp, _Alloc>::list(initializer_list __il) push_back(*__i); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +template +inline +list<_Tp, _Alloc>& +list<_Tp, _Alloc>::operator=(const list& __c) +{ + if (this != &__c) + { + base::__copy_assign_alloc(__c); + assign(__c.begin(), __c.end()); + } + return *this; +} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline list<_Tp, _Alloc>::list(list&& __c) @@ -1319,20 +1346,7 @@ list<_Tp, _Alloc>::__move_assign(list& __c, true_type) splice(end(), __c); } -#endif // _LIBCPP_CXX03_LANG - -template -inline -list<_Tp, _Alloc>& -list<_Tp, _Alloc>::operator=(const list& __c) -{ - if (this != &__c) - { - base::__copy_assign_alloc(__c); - assign(__c.begin(), __c.end()); - } - return *this; -} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -1562,7 +1576,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x) __hold.release(); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -1590,6 +1604,8 @@ list<_Tp, _Alloc>::push_back(value_type&& __x) __hold.release(); } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template #if _LIBCPP_STD_VER > 14 @@ -1661,6 +1677,8 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) #endif } +#endif // _LIBCPP_HAS_NO_VARIADICS + template typename list<_Tp, _Alloc>::iterator list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) @@ -1686,7 +1704,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x) #endif } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -2417,6 +2435,4 @@ swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_LIST diff --git a/include/locale b/include/locale index 6aaa22cca..138ebf01b 100644 --- a/include/locale +++ b/include/locale @@ -192,7 +192,14 @@ template class messages_byname; #endif #include #include -#include +#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#include +#elif defined(_NEWLIB_VERSION) +// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an +// include of once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html +// has had a chance to bake for a bit +#include +#endif #ifdef _LIBCPP_HAS_CATOPEN #include #endif @@ -201,19 +208,17 @@ template class messages_byname; #include #endif -#ifdef _LIBCPP_LOCALE__L_EXTENSIONS -#include <__bsd_locale_defaults.h> -#else -#include <__bsd_locale_fallbacks.h> -#endif +#include <__undef_min_max> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - +#ifdef _LIBCPP_LOCALE__L_EXTENSIONS +#include <__bsd_locale_defaults.h> +#else +#include <__bsd_locale_fallbacks.h> +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -228,6 +233,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD #define __cloc_defined #endif +typedef _VSTD::remove_pointer::type __locale_struct; +typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr; + // __scan_keyword // Scans [__b, __e) until a match is found in the basic_strings range // [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke). @@ -1394,7 +1402,6 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) - + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1421,7 +1428,6 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) - + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1448,7 +1454,6 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) - + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1475,7 +1480,6 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) - + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1681,22 +1685,6 @@ protected: ~__time_get_c_storage() {} }; -template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__weeks() const; -template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__months() const; -template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage::__am_pm() const; -template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__c() const; -template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__r() const; -template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__x() const; -template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage::__X() const; - -template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__weeks() const; -template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__months() const; -template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage::__am_pm() const; -template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__c() const; -template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__r() const; -template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__x() const; -template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage::__X() const; - template > class _LIBCPP_TEMPLATE_VIS time_get : public locale::facet, @@ -2643,10 +2631,10 @@ private: void init(const char*); }; -template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); -template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); -template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); -template<> _LIBCPP_FUNC_VIS void moneypunct_byname::init(const char*); +template<> void moneypunct_byname::init(const char*); +template<> void moneypunct_byname::init(const char*); +template<> void moneypunct_byname::init(const char*); +template<> void moneypunct_byname::init(const char*); _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) _LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname) @@ -2837,7 +2825,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, return false; } } - _LIBCPP_FALLTHROUGH(); + // drop through case money_base::none: if (__p != 3) { @@ -3582,7 +3570,7 @@ public: wstring_convert(_Codecvt* __pcvt, state_type __state); _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_ALWAYS_INLINE wstring_convert(wstring_convert&& __wc); #endif @@ -3641,7 +3629,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __cvtptr_ = new _Codecvt; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3655,7 +3643,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: __wc.__cvtptr_ = nullptr; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() @@ -4269,6 +4257,4 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_LOCALE diff --git a/include/map b/include/map index 71f18693f..ecd9d924e 100644 --- a/include/map +++ b/include/map @@ -480,8 +480,8 @@ public: void swap(__map_value_compare&__y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) { - using _VSTD::swap; - swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); + using _VSTD::swap; + swap(static_cast(*this), static_cast(__y)); } #if _LIBCPP_STD_VER > 11 @@ -582,7 +582,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __map_node_destructor(__tree_node_destructor&& __x) _NOEXCEPT : __na_(__x.__na_), @@ -591,7 +591,7 @@ public: { __x.__value_constructed = false; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -667,7 +667,7 @@ private: ~__value_type(); }; -#endif // _LIBCPP_CXX03_LANG +#endif template struct __extract_key_value_types; @@ -921,7 +921,7 @@ public: return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY map(map&& __m) @@ -940,6 +940,10 @@ public: return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY map(initializer_list __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -967,7 +971,7 @@ public: return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY explicit map(const allocator_type& __a) @@ -1078,10 +1082,6 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} #endif template @@ -1092,6 +1092,14 @@ public: insert(__e.__i_, *__f); } +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} + +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if _LIBCPP_STD_VER > 14 template @@ -1186,7 +1194,7 @@ public: return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); } -#endif // _LIBCPP_STD_VER > 14 +#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1299,6 +1307,7 @@ private: #ifndef _LIBCPP_CXX03_LANG + template map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) @@ -1312,27 +1321,10 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) } } -template -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple()).first->__cc.second; -} +#endif // !_LIBCPP_CXX03_LANG -template -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple()).first->__cc.second; -} -#else // _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_CXX03_LANG template typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder @@ -1363,7 +1355,29 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) return __r->__value_.__cc.second; } -#endif // _LIBCPP_CXX03_LANG +#else + +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(__k), + _VSTD::forward_as_tuple()).first->__cc.second; +} + +template +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(_VSTD::move(__k)), + _VSTD::forward_as_tuple()).first->__cc.second; +} + +#endif // !_LIBCPP_CXX03_LANG template _Tp& @@ -1579,7 +1593,7 @@ public: return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multimap(multimap&& __m) @@ -1598,6 +1612,10 @@ public: return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY multimap(initializer_list __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -1625,7 +1643,7 @@ public: return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY explicit multimap(const allocator_type& __a) @@ -1718,11 +1736,6 @@ public: iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} - #endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1740,6 +1753,14 @@ public: __tree_.__insert_multi(__e.__i_, *__f); } +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} + +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} _LIBCPP_INLINE_VISIBILITY diff --git a/include/math.h b/include/math.h index 8c30ba85d..b7659267e 100644 --- a/include/math.h +++ b/include/math.h @@ -293,6 +293,9 @@ long double truncl(long double x); */ #include <__config> +#if defined(_LIBCPP_MSVCRT) +#include +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -307,7 +310,6 @@ long double truncl(long double x); extern "C++" { #include -#include // signbit @@ -325,50 +327,22 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x < 0; } - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } - -#elif defined(_LIBCPP_MSVCRT) +#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return ::signbit(static_cast::type>(__lcpp_x)); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x < 0; } - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } - #endif // signbit // fpclassify @@ -387,34 +361,22 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } - -#elif defined(_LIBCPP_MSVCRT) +#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return ::fpclassify(static_cast::type>(__lcpp_x)); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } - #endif // fpclassify // isfinite @@ -433,22 +395,12 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type +typename std::enable_if::value, bool>::type isfinite(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1) _NOEXCEPT -{ return true; } - #endif // isfinite // isinf @@ -467,22 +419,12 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type +typename std::enable_if::value, bool>::type isinf(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1) _NOEXCEPT -{ return false; } - #endif // isinf // isnan @@ -501,18 +443,12 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnan(_A1) _NOEXCEPT -{ return false; } - #endif // isnan // isnormal @@ -531,18 +467,12 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); } -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnormal(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x != 0; } - #endif // isnormal // isgreater @@ -743,7 +673,7 @@ abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} // acos -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} #endif @@ -755,7 +685,7 @@ acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} // asin -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} #endif @@ -767,7 +697,7 @@ asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} // atan -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} #endif @@ -779,7 +709,7 @@ atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} // atan2 -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} #endif @@ -802,7 +732,7 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT // ceil -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} #endif @@ -814,7 +744,7 @@ ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} // cos -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} #endif @@ -826,7 +756,7 @@ cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} // cosh -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} #endif @@ -838,7 +768,7 @@ cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} // exp -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} #endif @@ -850,7 +780,7 @@ exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} // fabs -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} #endif @@ -862,7 +792,7 @@ fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} // floor -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} #endif @@ -874,7 +804,7 @@ floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} // fmod -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} #endif @@ -897,7 +827,7 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT // frexp -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} #endif @@ -909,7 +839,7 @@ frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, _ // ldexp -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} #endif @@ -921,7 +851,7 @@ ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __ // log -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} #endif @@ -933,7 +863,7 @@ log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} // log10 -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} #endif @@ -945,14 +875,14 @@ log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} // modf -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} #endif // pow -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} #endif @@ -975,7 +905,7 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT // sin -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} #endif @@ -987,7 +917,7 @@ sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} // sinh -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} #endif @@ -999,7 +929,7 @@ sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} // sqrt -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} #endif @@ -1011,7 +941,7 @@ sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} // tan -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} #endif @@ -1023,7 +953,7 @@ tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} // tanh -#if !(defined(_AIX) || defined(__sun__)) +#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} #endif @@ -1035,6 +965,7 @@ tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} // acosh +#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} @@ -1042,9 +973,11 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} +#endif // asinh +#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} @@ -1052,9 +985,11 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} +#endif // atanh +#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} @@ -1062,9 +997,11 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} +#endif // cbrt +#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} @@ -1072,9 +1009,11 @@ template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} +#endif // copysign +#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12) inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { return ::copysignf(__lcpp_x, __lcpp_y); @@ -1083,6 +1022,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { return ::copysignl(__lcpp_x, __lcpp_y); } +#endif template inline _LIBCPP_INLINE_VISIBILITY @@ -1100,6 +1040,8 @@ copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); } +#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) + // erf inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} @@ -1482,6 +1424,8 @@ inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} +#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14)) + } // extern "C++" #endif // __cplusplus diff --git a/include/memory b/include/memory index 711551d57..c7f540bb8 100644 --- a/include/memory +++ b/include/memory @@ -433,8 +433,8 @@ public: long use_count() const noexcept; bool unique() const noexcept; explicit operator bool() const noexcept; - template bool owner_before(shared_ptr const& b) const noexcept; - template bool owner_before(weak_ptr const& b) const noexcept; + template bool owner_before(shared_ptr const& b) const; + template bool owner_before(weak_ptr const& b) const; }; // shared_ptr comparisons: @@ -531,8 +531,8 @@ public: long use_count() const noexcept; bool expired() const noexcept; shared_ptr lock() const noexcept; - template bool owner_before(shared_ptr const& b) const noexcept; - template bool owner_before(weak_ptr const& b) const noexcept; + template bool owner_before(shared_ptr const& b) const; + template bool owner_before(weak_ptr const& b) const; }; // weak_ptr specialized algorithms: @@ -546,9 +546,9 @@ struct owner_less> : binary_function, shared_ptr, bool> { typedef bool result_type; - bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; - bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; - bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; + bool operator()(shared_ptr const&, shared_ptr const&) const; + bool operator()(shared_ptr const&, weak_ptr const&) const; + bool operator()(weak_ptr const&, shared_ptr const&) const; }; template @@ -556,24 +556,9 @@ struct owner_less> : binary_function, weak_ptr, bool> { typedef bool result_type; - bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; - bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; - bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; -}; - -template <> // Added in C++14 -struct owner_less -{ - template - bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; - template - bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; - template - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; - template - bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; - - typedef void is_transparent; + bool operator()(weak_ptr const&, weak_ptr const&) const; + bool operator()(shared_ptr const&, weak_ptr const&) const; + bool operator()(weak_ptr const&, shared_ptr const&) const; }; template @@ -653,19 +638,17 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space); #include #include #include -#include + #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) # include #endif +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -998,11 +981,11 @@ struct __rebind_pointer { // allocator_traits -struct __has_pointer_type_imp +namespace __has_pointer_type_imp { template static __two __test(...); template static char __test(typename _Up::pointer* = 0); -}; +} template struct __has_pointer_type @@ -1543,7 +1526,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits {return __a.allocate(__n);} _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) - {return __allocate(__a, __n, __hint, + {return allocate(__a, __n, __hint, __has_allocate_hint());} _LIBCPP_INLINE_VISIBILITY @@ -1597,7 +1580,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits _LIBCPP_INLINE_VISIBILITY static allocator_type select_on_container_copy_construction(const allocator_type& __a) - {return __select_on_container_copy_construction( + {return select_on_container_copy_construction( __has_select_on_container_copy_construction(), __a);} @@ -1696,11 +1679,11 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits private: _LIBCPP_INLINE_VISIBILITY - static pointer __allocate(allocator_type& __a, size_type __n, + static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint, true_type) {return __a.allocate(__n, __hint);} _LIBCPP_INLINE_VISIBILITY - static pointer __allocate(allocator_type& __a, size_type __n, + static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer, false_type) {return __a.allocate(__n);} @@ -1737,11 +1720,11 @@ private: _LIBCPP_INLINE_VISIBILITY static allocator_type - __select_on_container_copy_construction(true_type, const allocator_type& __a) + select_on_container_copy_construction(true_type, const allocator_type& __a) {return __a.select_on_container_copy_construction();} _LIBCPP_INLINE_VISIBILITY static allocator_type - __select_on_container_copy_construction(false_type, const allocator_type& __a) + select_on_container_copy_construction(false_type, const allocator_type& __a) {return __a;} }; @@ -2072,817 +2055,778 @@ public: }; #endif -template ::value && !__libcpp_is_final<_Tp>::value> -struct __compressed_pair_elem { - typedef _Tp _ParamT; - typedef _Tp& reference; - typedef const _Tp& const_reference; +template ::type, + typename remove_cv<_T2>::type>::value, + bool = is_empty<_T1>::value + && !__libcpp_is_final<_T1>::value, + bool = is_empty<_T2>::value + && !__libcpp_is_final<_T2>::value + > +struct __libcpp_compressed_pair_switch; -#ifndef _LIBCPP_CXX03_LANG - constexpr __compressed_pair_elem() : __value_() {} +template +struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, false> {enum {value = 0};}; - template ::type>::value - >::type> - constexpr explicit - __compressed_pair_elem(_Up&& __u) - : __value_(_VSTD::forward<_Up>(__u)){}; +template +struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, true, false> {enum {value = 1};}; - template - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, - __tuple_indices<_Indexes...>) - : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} -#else - __compressed_pair_elem() : __value_() {} - __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {} -#endif - - reference __get() _NOEXCEPT { return __value_; } - const_reference __get() const _NOEXCEPT { return __value_; } - -private: - _Tp __value_; -}; - -template -struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { - typedef _Tp _ParamT; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp __value_type; - -#ifndef _LIBCPP_CXX03_LANG - constexpr __compressed_pair_elem() = default; - - template ::type>::value - >::type> - constexpr explicit - __compressed_pair_elem(_Up&& __u) - : __value_type(_VSTD::forward<_Up>(__u)){}; - - template - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, - __tuple_indices<_Indexes...>) - : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} -#else - __compressed_pair_elem() : __value_type() {} - __compressed_pair_elem(_ParamT __p) - : __value_type(std::forward<_ParamT>(__p)) {} -#endif - - reference __get() _NOEXCEPT { return *this; } - const_reference __get() const _NOEXCEPT { return *this; } -}; - -// Tag used to construct the second element of the compressed pair. -struct __second_tag {}; +template +struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, true> {enum {value = 2};}; template -class __compressed_pair : private __compressed_pair_elem<_T1, 0>, - private __compressed_pair_elem<_T2, 1> { - typedef __compressed_pair_elem<_T1, 0> _Base1; - typedef __compressed_pair_elem<_T2, 1> _Base2; +struct __libcpp_compressed_pair_switch<_T1, _T2, false, true, true> {enum {value = 3};}; - // NOTE: This static assert should never fire because __compressed_pair - // is *almost never* used in a scenario where it's possible for T1 == T2. - // (The exception is std::function where it is possible that the function - // object and the allocator have the same type). - static_assert((!is_same<_T1, _T2>::value), - "__compressed_pair cannot be instantated when T1 and T2 are the same type; " - "The current implementation is NOT ABI-compatible with the previous " - "implementation for this configuration"); +template +struct __libcpp_compressed_pair_switch<_T1, _T2, true, true, true> {enum {value = 1};}; +template ::value> +class __libcpp_compressed_pair_imp; + +template +class __libcpp_compressed_pair_imp<_T1, _T2, 0> +{ +private: + _T1 __first_; + _T2 __second_; public: -#ifndef _LIBCPP_CXX03_LANG - template , _Dummy>::value && - __dependent_type, _Dummy>::value - >::type - > - _LIBCPP_INLINE_VISIBILITY - constexpr __compressed_pair() {} + typedef _T1 _T1_param; + typedef _T2 _T2_param; - template ::type, - __compressed_pair>::value, - bool>::type = true> - _LIBCPP_INLINE_VISIBILITY constexpr explicit - __compressed_pair(_Tp&& __t) - : _Base1(std::forward<_Tp>(__t)), _Base2() {} + typedef typename remove_reference<_T1>::type& _T1_reference; + typedef typename remove_reference<_T2>::type& _T2_reference; - template - _LIBCPP_INLINE_VISIBILITY constexpr - __compressed_pair(__second_tag, _Tp&& __t) - : _Base1(), _Base2(std::forward<_Tp>(__t)) {} + typedef const typename remove_reference<_T1>::type& _T1_const_reference; + typedef const typename remove_reference<_T2>::type& _T2_const_reference; - template - _LIBCPP_INLINE_VISIBILITY constexpr - __compressed_pair(_U1&& __t1, _U2&& __t2) - : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} - template - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 - __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, - tuple<_Args2...> __second_args) - : _Base1(__pc, _VSTD::move(__first_args), - typename __make_tuple_indices::type()), - _Base2(__pc, _VSTD::move(__second_args), - typename __make_tuple_indices::type()) {} +#ifndef _LIBCPP_HAS_NO_VARIADICS -#else - _LIBCPP_INLINE_VISIBILITY - __compressed_pair() {} + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) + {} - _LIBCPP_INLINE_VISIBILITY explicit - __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {} +#endif // _LIBCPP_HAS_NO_VARIADICS - _LIBCPP_INLINE_VISIBILITY - __compressed_pair(__second_tag, _T2 __t2) - : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;} + _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;} - _LIBCPP_INLINE_VISIBILITY - __compressed_pair(_T1 __t1, _T2 __t2) - : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {} -#endif + _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;} + _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;} - _LIBCPP_INLINE_VISIBILITY - typename _Base1::reference first() _NOEXCEPT { - return static_cast<_Base1&>(*this).__get(); - } + _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + { + using _VSTD::swap; + swap(__first_, __x.__first_); + swap(__second_, __x.__second_); + } +}; - _LIBCPP_INLINE_VISIBILITY - typename _Base1::const_reference first() const _NOEXCEPT { - return static_cast<_Base1 const&>(*this).__get(); - } +template +class __libcpp_compressed_pair_imp<_T1, _T2, 1> + : private _T1 +{ +private: + _T2 __second_; +public: + typedef _T1 _T1_param; + typedef _T2 _T2_param; - _LIBCPP_INLINE_VISIBILITY - typename _Base2::reference second() _NOEXCEPT { - return static_cast<_Base2&>(*this).__get(); - } + typedef _T1& _T1_reference; + typedef typename remove_reference<_T2>::type& _T2_reference; - _LIBCPP_INLINE_VISIBILITY - typename _Base2::const_reference second() const _NOEXCEPT { - return static_cast<_Base2 const&>(*this).__get(); - } + typedef const _T1& _T1_const_reference; + typedef const typename remove_reference<_T2>::type& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY - void swap(__compressed_pair& __x) - _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && - __is_nothrow_swappable<_T2>::value) - { - using std::swap; - swap(first(), __x.first()); - swap(second(), __x.second()); - } + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + : __second_(_VSTD::forward<_T2_param>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} + +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + + _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;} + + _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;} + _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;} + + _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + { + using _VSTD::swap; + swap(__second_, __x.__second_); + } +}; + +template +class __libcpp_compressed_pair_imp<_T1, _T2, 2> + : private _T2 +{ +private: + _T1 __first_; +public: + typedef _T1 _T1_param; + typedef _T2 _T2_param; + + typedef typename remove_reference<_T1>::type& _T1_reference; + typedef _T2& _T2_reference; + + typedef const typename remove_reference<_T1>::type& _T1_const_reference; + typedef const _T2& _T2_const_reference; + + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + : __first_(_VSTD::forward<_T1_param>(__t1)) {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && + is_nothrow_move_constructible<_T2>::value) + : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {} + +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...), + __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...) + + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + + _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;} + _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;} + + _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} + + _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + { + using _VSTD::swap; + swap(__first_, __x.__first_); + } +}; + +template +class __libcpp_compressed_pair_imp<_T1, _T2, 3> + : private _T1, + private _T2 +{ +public: + typedef _T1 _T1_param; + typedef _T2 _T2_param; + + typedef _T1& _T1_reference; + typedef _T2& _T2_reference; + + typedef const _T1& _T1_const_reference; + typedef const _T2& _T2_const_reference; + + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + : _T1(_VSTD::forward<_T1_param>(__t1)) {} + _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + : _T2(_VSTD::forward<_T2_param>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {} + +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __libcpp_compressed_pair_imp(piecewise_construct_t, + tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args, + __tuple_indices<_I1...>, + __tuple_indices<_I2...>) + : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...), + _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + + _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;} + + _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;} + _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;} + + _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + { + } +}; + +template +class __compressed_pair + : private __libcpp_compressed_pair_imp<_T1, _T2> +{ + typedef __libcpp_compressed_pair_imp<_T1, _T2> base; +public: + typedef typename base::_T1_param _T1_param; + typedef typename base::_T2_param _T2_param; + + typedef typename base::_T1_reference _T1_reference; + typedef typename base::_T2_reference _T2_reference; + + typedef typename base::_T1_const_reference _T1_const_reference; + typedef typename base::_T2_const_reference _T2_const_reference; + + _LIBCPP_INLINE_VISIBILITY __compressed_pair() {} + _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1) + : base(_VSTD::forward<_T1_param>(__t1)) {} + _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2) + : base(_VSTD::forward<_T2_param>(__t2)) {} + _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2) + : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {} + +#ifndef _LIBCPP_HAS_NO_VARIADICS + + template + _LIBCPP_INLINE_VISIBILITY + __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, + tuple<_Args2...> __second_args) + : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args), + typename __make_tuple_indices::type(), + typename __make_tuple_indices::type()) + {} + +#endif // _LIBCPP_HAS_NO_VARIADICS + + _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return base::first();} + _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return base::first();} + + _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return base::second();} + _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return base::second();} + + _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + {base::swap(__x);} }; template 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<_T2>::value) { - __x.swap(__y); -} +void +swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) + _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && + __is_nothrow_swappable<_T2>::value) + {__x.swap(__y);} + +// __same_or_less_cv_qualified + +template ::element_type>::type, + typename remove_cv::element_type>::type + >::value + > +struct __same_or_less_cv_qualified_imp + : is_convertible<_Ptr1, _Ptr2> {}; + +template +struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> + : false_type {}; + +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, false> + : false_type {}; // default_delete template -struct _LIBCPP_TEMPLATE_VIS default_delete { - static_assert(!is_function<_Tp>::value, - "default_delete cannot be instantiated for function types"); +struct _LIBCPP_TEMPLATE_VIS default_delete +{ #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; #else - _LIBCPP_INLINE_VISIBILITY default_delete() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} #endif - template - _LIBCPP_INLINE_VISIBILITY - default_delete(const default_delete<_Up>&, - typename enable_if::value>::type* = - 0) _NOEXCEPT {} - - _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT { - static_assert(sizeof(_Tp) > 0, - "default_delete can not delete incomplete type"); - static_assert(!is_void<_Tp>::value, - "default_delete can not delete incomplete type"); - delete __ptr; - } + template + _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&, + typename enable_if::value>::type* = 0) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT + { + static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); + static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type"); + delete __ptr; + } }; template -struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> { -private: - template - struct _EnableIfConvertible - : enable_if::value> {}; - +struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> +{ public: #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default; + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default; #else - _LIBCPP_INLINE_VISIBILITY default_delete() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {} #endif - - template - _LIBCPP_INLINE_VISIBILITY - default_delete(const default_delete<_Up[]>&, - typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} - - template - _LIBCPP_INLINE_VISIBILITY - typename _EnableIfConvertible<_Up>::type - operator()(_Up* __ptr) const _NOEXCEPT { - static_assert(sizeof(_Tp) > 0, - "default_delete can not delete incomplete type"); - static_assert(!is_void<_Tp>::value, - "default_delete can not delete void type"); - delete[] __ptr; - } + template + _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&, + typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} + template + _LIBCPP_INLINE_VISIBILITY + void operator() (_Up* __ptr, + typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT + { + static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); + static_assert(!is_void<_Tp>::value, "default_delete can not delete void type"); + delete [] __ptr; + } }; - - -#ifndef _LIBCPP_CXX03_LANG -template -struct __unique_ptr_deleter_sfinae { - static_assert(!is_reference<_Deleter>::value, "incorrect specialization"); - typedef const _Deleter& __lval_ref_type; - typedef _Deleter&& __good_rval_ref_type; - typedef true_type __enable_rval_overload; -}; - -template -struct __unique_ptr_deleter_sfinae<_Deleter const&> { - typedef const _Deleter& __lval_ref_type; - typedef const _Deleter&& __bad_rval_ref_type; - typedef false_type __enable_rval_overload; -}; - -template -struct __unique_ptr_deleter_sfinae<_Deleter&> { - typedef _Deleter& __lval_ref_type; - typedef _Deleter&& __bad_rval_ref_type; - typedef false_type __enable_rval_overload; -}; -#endif // !defined(_LIBCPP_CXX03_LANG) - template > -class _LIBCPP_TEMPLATE_VIS unique_ptr { +class _LIBCPP_TEMPLATE_VIS unique_ptr +{ public: - typedef _Tp element_type; - typedef _Dp deleter_type; - typedef typename __pointer_type<_Tp, deleter_type>::type pointer; - - static_assert(!is_rvalue_reference::value, - "the specified deleter type cannot be an rvalue reference"); - + typedef _Tp element_type; + typedef _Dp deleter_type; + typedef typename __pointer_type<_Tp, deleter_type>::type pointer; private: - __compressed_pair __ptr_; + __compressed_pair __ptr_; - struct __nat { int __for_bool_; }; +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES + unique_ptr(unique_ptr&); + template + unique_ptr(unique_ptr<_Up, _Ep>&); + unique_ptr& operator=(unique_ptr&); + template + unique_ptr& operator=(unique_ptr<_Up, _Ep>&); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_CXX03_LANG - typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; - - template - using _LValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; - - template - using _GoodRValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; - - template - using _BadRValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; - - template , _Dummy>::type> - using _EnableIfDeleterDefaultConstructible = - typename enable_if::value && - !is_pointer<_Deleter>::value>::type; - - template - using _EnableIfDeleterConstructible = - typename enable_if::value>::type; - - template - using _EnableIfMoveConvertible = typename enable_if< - is_convertible::value && - !is_array<_Up>::value - >::type; - - template - using _EnableIfDeleterConvertible = typename enable_if< - (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || - (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) - >::type; - - template - using _EnableIfDeleterAssignable = typename enable_if< - is_assignable<_Dp&, _UDel&&>::value - >::type; + struct __nat {int __for_bool_;}; + typedef typename remove_reference::type& _Dp_reference; + typedef const typename remove_reference::type& _Dp_const_reference; public: - template > - _LIBCPP_INLINE_VISIBILITY - constexpr unique_ptr() noexcept : __ptr_(pointer()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT + : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT + : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) _NOEXCEPT + : __ptr_(_VSTD::move(__p)) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } - template > - _LIBCPP_INLINE_VISIBILITY - constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename conditional< + is_reference::value, + deleter_type, + typename add_lvalue_reference::type>::type __d) + _NOEXCEPT + : __ptr_(__p, __d) {} - template > - _LIBCPP_INLINE_VISIBILITY - explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {} - - template >> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept - : __ptr_(__p, __d) {} - - template >> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept - : __ptr_(__p, _VSTD::move(__d)) { - static_assert(!is_reference::value, - "rvalue deleter bound to reference"); - } - - template >> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr&& __u) noexcept - : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) { - } - - template , _Up>, - class = _EnableIfDeleterConvertible<_Ep> - > - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} + _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename remove_reference::type&& __d) + _NOEXCEPT + : __ptr_(__p, _VSTD::move(__d)) + { + static_assert(!is_reference::value, "rvalue deleter bound to reference"); + } + _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} + template + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr<_Up, _Ep>&& __u, + typename enable_if + < + !is_array<_Up>::value && + is_convertible::pointer, pointer>::value && + is_convertible<_Ep, deleter_type>::value && + ( + !is_reference::value || + is_same::value + ), + __nat + >::type = __nat()) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template - _LIBCPP_INLINE_VISIBILITY - unique_ptr(auto_ptr<_Up>&& __p, - typename enable_if::value && - is_same<_Dp, default_delete<_Tp>>::value, - __nat>::type = __nat()) _NOEXCEPT - : __ptr_(__p.release()) {} + template + _LIBCPP_INLINE_VISIBILITY unique_ptr(auto_ptr<_Up>&& __p, + typename enable_if< + is_convertible<_Up*, _Tp*>::value && + is_same<_Dp, default_delete<_Tp> >::value, + __nat + >::type = __nat()) _NOEXCEPT + : __ptr_(__p.release()) + { + } #endif - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { - reset(__u.release()); - __ptr_.second() = _VSTD::forward(__u.get_deleter()); - return *this; - } + _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward(__u.get_deleter()); + return *this; + } - template , _Up>, - class = _EnableIfDeleterAssignable<_Ep> - > - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + !is_array<_Up>::value && + is_convertible::pointer, pointer>::value && + is_assignable::value, + unique_ptr& + >::type + operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#else // _LIBCPP_CXX03_LANG -private: - unique_ptr(unique_ptr&); - template unique_ptr(unique_ptr<_Up, _Ep>&); + _LIBCPP_INLINE_VISIBILITY operator __rv() + { + return __rv(*this); + } - unique_ptr& operator=(unique_ptr&); - template unique_ptr& operator=(unique_ptr<_Up, _Ep>&); + _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv __u) + : __ptr_(__u->release(), _VSTD::forward(__u->get_deleter())) {} -public: - _LIBCPP_INLINE_VISIBILITY - unique_ptr() : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - static_assert(is_default_constructible::value, - "unique_ptr::deleter_type is not default constructible"); - } - _LIBCPP_INLINE_VISIBILITY - unique_ptr(nullptr_t) : __ptr_(pointer()) - { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - _LIBCPP_INLINE_VISIBILITY - explicit unique_ptr(pointer __p) - : __ptr_(_VSTD::move(__p)) { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if< + !is_array<_Up>::value && + is_convertible::pointer, pointer>::value && + is_assignable::value, + unique_ptr& + >::type + operator=(unique_ptr<_Up, _Ep> __u) + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } - _LIBCPP_INLINE_VISIBILITY - operator __rv() { - return __rv(*this); - } - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(__rv __u) - : __ptr_(__u->release(), - _VSTD::forward(__u->get_deleter())) {} - - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if< - !is_array<_Up>::value && - is_convertible::pointer, - pointer>::value && - is_assignable::value, - unique_ptr&>::type - operator=(unique_ptr<_Up, _Ep> __u) { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(pointer __p, deleter_type __d) - : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {} -#endif // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) + : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if::value && - is_same<_Dp, default_delete<_Tp> >::value, - unique_ptr&>::type - operator=(auto_ptr<_Up> __p) { - reset(__p.release()); - return *this; - } + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if< + is_convertible<_Up*, _Tp*>::value && + is_same<_Dp, default_delete<_Tp> >::value, + unique_ptr& + >::type + operator=(auto_ptr<_Up> __p) + {reset(__p.release()); return *this;} #endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();} - _LIBCPP_INLINE_VISIBILITY - ~unique_ptr() { reset(); } + _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT + { + reset(); + return *this; + } - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(nullptr_t) _NOEXCEPT { - reset(); - return *this; - } + _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const + {return *__ptr_.first();} + _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();} + _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();} + _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT + {return __ptr_.second();} + _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT + {return __ptr_.second();} + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT + {return __ptr_.first() != nullptr;} - _LIBCPP_INLINE_VISIBILITY - typename add_lvalue_reference<_Tp>::type - operator*() const { - return *__ptr_.first(); - } - _LIBCPP_INLINE_VISIBILITY - pointer operator->() const _NOEXCEPT { - return __ptr_.first(); - } - _LIBCPP_INLINE_VISIBILITY - pointer get() const _NOEXCEPT { - return __ptr_.first(); - } - _LIBCPP_INLINE_VISIBILITY - deleter_type& get_deleter() _NOEXCEPT { - return __ptr_.second(); - } - _LIBCPP_INLINE_VISIBILITY - const deleter_type& get_deleter() const _NOEXCEPT { - return __ptr_.second(); - } - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { - return __ptr_.first() != nullptr; - } + _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT + { + pointer __t = __ptr_.first(); + __ptr_.first() = pointer(); + return __t; + } - _LIBCPP_INLINE_VISIBILITY - pointer release() _NOEXCEPT { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); - return __t; - } + _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT + { + pointer __tmp = __ptr_.first(); + __ptr_.first() = __p; + if (__tmp) + __ptr_.second()(__tmp); + } - _LIBCPP_INLINE_VISIBILITY - void reset(pointer __p = pointer()) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; - if (__tmp) - __ptr_.second()(__tmp); - } - - _LIBCPP_INLINE_VISIBILITY - void swap(unique_ptr& __u) _NOEXCEPT { - __ptr_.swap(__u.__ptr_); - } + _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT + {__ptr_.swap(__u.__ptr_);} }; - template -class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> { +class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> +{ public: - typedef _Tp element_type; - typedef _Dp deleter_type; - typedef typename __pointer_type<_Tp, deleter_type>::type pointer; - + typedef _Tp element_type; + typedef _Dp deleter_type; + typedef typename __pointer_type<_Tp, deleter_type>::type pointer; private: - __compressed_pair __ptr_; + __compressed_pair __ptr_; - template - struct _CheckArrayPointerConversion : is_same<_From, pointer> {}; +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES + unique_ptr(unique_ptr&); + template + unique_ptr(unique_ptr<_Up>&); + unique_ptr& operator=(unique_ptr&); + template + unique_ptr& operator=(unique_ptr<_Up>&); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template - struct _CheckArrayPointerConversion<_FromElem*> - : integral_constant::value || - (is_same::value && - is_convertible<_FromElem(*)[], element_type(*)[]>::value) - > - {}; - -#ifndef _LIBCPP_CXX03_LANG - typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; - - template - using _LValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; - - template - using _GoodRValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; - - template - using _BadRValRefType = - typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; - - template , _Dummy>::type> - using _EnableIfDeleterDefaultConstructible = - typename enable_if::value && - !is_pointer<_Deleter>::value>::type; - - template - using _EnableIfDeleterConstructible = - typename enable_if::value>::type; - - template - using _EnableIfPointerConvertible = typename enable_if< - _CheckArrayPointerConversion<_Pp>::value - >::type; - - template - using _EnableIfMoveConvertible = typename enable_if< - is_array<_Up>::value && - is_same::value && - is_same::value && - is_convertible<_ElemT(*)[], element_type(*)[]>::value - >::type; - - template - using _EnableIfDeleterConvertible = typename enable_if< - (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || - (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) - >::type; - - template - using _EnableIfDeleterAssignable = typename enable_if< - is_assignable<_Dp&, _UDel&&>::value - >::type; + struct __nat {int __for_bool_;}; + typedef typename remove_reference::type& _Dp_reference; + typedef const typename remove_reference::type& _Dp_const_reference; public: - template > - _LIBCPP_INLINE_VISIBILITY - constexpr unique_ptr() noexcept : __ptr_(pointer()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT + : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT + : __ptr_(pointer()) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template + _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p, + typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) _NOEXCEPT + : __ptr_(__p) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } - template > - _LIBCPP_INLINE_VISIBILITY - constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} + template + _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional< + is_reference::value, + deleter_type, + typename add_lvalue_reference::type>::type __d, + typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) + _NOEXCEPT + : __ptr_(__p, __d) {} - template , - class = _EnableIfPointerConvertible<_Pp>> - _LIBCPP_INLINE_VISIBILITY - explicit unique_ptr(_Pp __p) noexcept - : __ptr_(__p) {} + _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename conditional< + is_reference::value, + deleter_type, + typename add_lvalue_reference::type>::type __d) + _NOEXCEPT + : __ptr_(pointer(), __d) {} - template >, - class = _EnableIfPointerConvertible<_Pp>> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept - : __ptr_(__p, __d) {} + template + _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, + typename remove_reference::type&& __d, + typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) + _NOEXCEPT + : __ptr_(__p, _VSTD::move(__d)) + { + static_assert(!is_reference::value, "rvalue deleter bound to reference"); + } - template >> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept - : __ptr_(nullptr, __d) {} + _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename remove_reference::type&& __d) + _NOEXCEPT + : __ptr_(pointer(), _VSTD::move(__d)) + { + static_assert(!is_reference::value, "rvalue deleter bound to reference"); + } - template >, - class = _EnableIfPointerConvertible<_Pp>> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept - : __ptr_(__p, _VSTD::move(__d)) { - static_assert(!is_reference::value, - "rvalue deleter bound to reference"); - } + _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} - template >> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept - : __ptr_(nullptr, _VSTD::move(__d)) { - static_assert(!is_reference::value, - "rvalue deleter bound to reference"); - } + _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward(__u.get_deleter()); + return *this; + } - template >, - class = _EnableIfPointerConvertible<_Pp>> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; + template + _LIBCPP_INLINE_VISIBILITY + unique_ptr(unique_ptr<_Up, _Ep>&& __u, + typename enable_if + < + is_array<_Up>::value && + __same_or_less_cv_qualified::pointer, pointer>::value + && is_convertible<_Ep, deleter_type>::value && + ( + !is_reference::value || + is_same::value + ), + __nat + >::type = __nat() + ) _NOEXCEPT + : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) {} - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr&& __u) noexcept - : __ptr_(__u.release(), _VSTD::forward(__u.get_deleter())) { - } - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(unique_ptr&& __u) noexcept { - reset(__u.release()); - __ptr_.second() = _VSTD::forward(__u.get_deleter()); - return *this; - } + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + is_array<_Up>::value && + __same_or_less_cv_qualified::pointer, pointer>::value && + is_assignable::value, + unique_ptr& + >::type + operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + { + reset(__u.release()); + __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + return *this; + } +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - template , _Up>, - class = _EnableIfDeleterConvertible<_Ep> - > - _LIBCPP_INLINE_VISIBILITY - unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept - : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) { - } + _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) + : __ptr_(__p) + { + static_assert(!is_pointer::value, + "unique_ptr constructed with null function pointer deleter"); + } - template , _Up>, - class = _EnableIfDeleterAssignable<_Ep> - > - _LIBCPP_INLINE_VISIBILITY - unique_ptr& - operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { - reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); - return *this; - } + _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) + : __ptr_(__p, _VSTD::forward(__d)) {} -#else // _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, deleter_type __d) + : __ptr_(pointer(), _VSTD::forward(__d)) {} + + _LIBCPP_INLINE_VISIBILITY operator __rv() + { + return __rv(*this); + } + + _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv __u) + : __ptr_(__u->release(), _VSTD::forward(__u->get_deleter())) {} + + _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(__rv __u) + { + reset(__u->release()); + __ptr_.second() = _VSTD::forward(__u->get_deleter()); + return *this; + } + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();} + + _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT + { + reset(); + return *this; + } + + _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const + {return __ptr_.first()[__i];} + _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();} + _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT + {return __ptr_.second();} + _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT + {return __ptr_.second();} + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT + {return __ptr_.first() != nullptr;} + + _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT + { + pointer __t = __ptr_.first(); + __ptr_.first() = pointer(); + return __t; + } + + template + _LIBCPP_INLINE_VISIBILITY + typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, void>::type + reset(_Pp __p) _NOEXCEPT + { + pointer __tmp = __ptr_.first(); + __ptr_.first() = __p; + if (__tmp) + __ptr_.second()(__tmp); + } + _LIBCPP_INLINE_VISIBILITY void reset(nullptr_t = nullptr) _NOEXCEPT + { + pointer __tmp = __ptr_.first(); + __ptr_.first() = nullptr; + if (__tmp) + __ptr_.second()(__tmp); + } + + _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) {__ptr_.swap(__u.__ptr_);} private: - template explicit unique_ptr(_Up); - - unique_ptr(unique_ptr&); - template unique_ptr(unique_ptr<_Up>&); - - unique_ptr& operator=(unique_ptr&); - template unique_ptr& operator=(unique_ptr<_Up>&); - - template - unique_ptr(_Up __u, - typename conditional< - is_reference::value, deleter_type, - typename add_lvalue_reference::type>::type, - typename enable_if::value, - __nat>::type = __nat()); -public: - _LIBCPP_INLINE_VISIBILITY - unique_ptr() : __ptr_(pointer()) { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - _LIBCPP_INLINE_VISIBILITY - unique_ptr(nullptr_t) : __ptr_(pointer()) { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - - _LIBCPP_INLINE_VISIBILITY - explicit unique_ptr(pointer __p) : __ptr_(__p) { - static_assert(!is_pointer::value, - "unique_ptr constructed with null function pointer deleter"); - } - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(pointer __p, deleter_type __d) - : __ptr_(__p, _VSTD::forward(__d)) {} - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(nullptr_t, deleter_type __d) - : __ptr_(pointer(), _VSTD::forward(__d)) {} - - _LIBCPP_INLINE_VISIBILITY - operator __rv() { - return __rv(*this); - } - - _LIBCPP_INLINE_VISIBILITY - unique_ptr(__rv __u) - : __ptr_(__u->release(), - _VSTD::forward(__u->get_deleter())) {} - - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(__rv __u) { - reset(__u->release()); - __ptr_.second() = _VSTD::forward(__u->get_deleter()); - return *this; - } - -#endif // _LIBCPP_CXX03_LANG - -public: - _LIBCPP_INLINE_VISIBILITY - ~unique_ptr() { reset(); } - - _LIBCPP_INLINE_VISIBILITY - unique_ptr& operator=(nullptr_t) _NOEXCEPT { - reset(); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - typename add_lvalue_reference<_Tp>::type - operator[](size_t __i) const { - return __ptr_.first()[__i]; - } - _LIBCPP_INLINE_VISIBILITY - pointer get() const _NOEXCEPT { - return __ptr_.first(); - } - - _LIBCPP_INLINE_VISIBILITY - deleter_type& get_deleter() _NOEXCEPT { - return __ptr_.second(); - } - - _LIBCPP_INLINE_VISIBILITY - const deleter_type& get_deleter() const _NOEXCEPT { - return __ptr_.second(); - } - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { - return __ptr_.first() != nullptr; - } - - _LIBCPP_INLINE_VISIBILITY - pointer release() _NOEXCEPT { - pointer __t = __ptr_.first(); - __ptr_.first() = pointer(); - return __t; - } - - template - _LIBCPP_INLINE_VISIBILITY - typename enable_if< - _CheckArrayPointerConversion<_Pp>::value - >::type - reset(_Pp __p) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = __p; - if (__tmp) - __ptr_.second()(__tmp); - } - - _LIBCPP_INLINE_VISIBILITY - void reset(nullptr_t = nullptr) _NOEXCEPT { - pointer __tmp = __ptr_.first(); - __ptr_.first() = nullptr; - if (__tmp) - __ptr_.second()(__tmp); - } - - _LIBCPP_INLINE_VISIBILITY - void swap(unique_ptr& __u) _NOEXCEPT { - __ptr_.swap(__u.__ptr_); - } +#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template + explicit unique_ptr(_Up); + template + unique_ptr(_Up __u, + typename conditional< + is_reference::value, + deleter_type, + typename add_lvalue_reference::type>::type, + typename enable_if + < + is_convertible<_Up, pointer>::value, + __nat + >::type = __nat()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; template @@ -3093,7 +3037,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< typedef unique_ptr<_Tp, _Dp> argument_type; typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type& __ptr) const + result_type operator()(const argument_type& __ptr) const _NOEXCEPT { typedef typename argument_type::pointer pointer; return hash()(__ptr.get()); @@ -3103,28 +3047,28 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< struct __destruct_n { private: - size_t __size_; + size_t size; template _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT - {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} + {for (size_t __i = 0; __i < size; ++__i, ++__p) __p->~_Tp();} template _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT - {++__size_;} + {++size;} _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT - {__size_ = __s;} + {size = __s;} _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT {} public: _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT - : __size_(__s) {} + : size(__s) {} template _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT @@ -3563,7 +3507,7 @@ template const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { - return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr; + return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0; } #endif // _LIBCPP_NO_RTTI @@ -3657,18 +3601,6 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT __a.deallocate(_PTraits::pointer_to(*this), 1); } -struct __shared_ptr_dummy_rebind_allocator_type; -template <> -class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type> -{ -public: - template - struct rebind - { - typedef allocator<_Other> other; - }; -}; - template class _LIBCPP_TEMPLATE_VIS enable_shared_from_this; template @@ -3875,11 +3807,11 @@ public: _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT + bool owner_before(shared_ptr<_Up> const& __p) const {return __cntrl_ < __p.__cntrl_;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT + bool owner_before(weak_ptr<_Up> const& __p) const {return __cntrl_ < __p.__cntrl_;} _LIBCPP_INLINE_VISIBILITY bool @@ -3937,24 +3869,10 @@ public: #endif // _LIBCPP_HAS_NO_VARIADICS private: - template ::value> - struct __shared_ptr_default_allocator - { - typedef allocator<_Yp> type; - }; - - template - struct __shared_ptr_default_allocator<_Yp, true> - { - typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type; - }; template _LIBCPP_INLINE_VISIBILITY - typename enable_if* - >::value, - void>::type + void __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT { @@ -3966,13 +3884,13 @@ private: } } - _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {} + _LIBCPP_INLINE_VISIBILITY + void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {} template friend class _LIBCPP_TEMPLATE_VIS shared_ptr; template friend class _LIBCPP_TEMPLATE_VIS weak_ptr; }; - template inline _LIBCPP_CONSTEXPR @@ -3998,9 +3916,8 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, : __ptr_(__p) { unique_ptr<_Yp> __hold(__p); - typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT()); + typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>()); __hold.release(); __enable_weak_this(__p, __p); } @@ -4015,9 +3932,8 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, try { #endif // _LIBCPP_NO_EXCEPTIONS - typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); + typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>()); __enable_weak_this(__p, __p); #ifndef _LIBCPP_NO_EXCEPTIONS } @@ -4038,9 +3954,8 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) try { #endif // _LIBCPP_NO_EXCEPTIONS - typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; - typedef __shared_ptr_pointer _CntrlBlk; - __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); + typedef __shared_ptr_pointer > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>()); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -4208,9 +4123,8 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, else #endif { - typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; - typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); + typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -4238,11 +4152,10 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r, else #endif { - typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, reference_wrapper::type>, - _AllocT > _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT()); + allocator<_Yp> > _CntrlBlk; + __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -4994,11 +4907,11 @@ public: shared_ptr<_Tp> lock() const _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY - bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT + bool owner_before(const shared_ptr<_Up>& __r) const {return __cntrl_ < __r.__cntrl_;} template _LIBCPP_INLINE_VISIBILITY - bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT + bool owner_before(const weak_ptr<_Up>& __r) const {return __cntrl_ < __r.__cntrl_;} template friend class _LIBCPP_TEMPLATE_VIS weak_ptr; @@ -5207,13 +5120,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less > { typedef bool result_type; _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} }; @@ -5223,13 +5136,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less > { typedef bool result_type; _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const {return __x.owner_before(__y);} }; @@ -5239,19 +5152,19 @@ struct _LIBCPP_TEMPLATE_VIS owner_less { template _LIBCPP_INLINE_VISIBILITY - bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT + bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT + bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT + bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const {return __x.owner_before(__y);} template _LIBCPP_INLINE_VISIBILITY - bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT + bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const {return __x.owner_before(__y);} typedef void is_transparent; }; @@ -5328,8 +5241,7 @@ private: friend _LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*); }; -_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR -__sp_mut& __get_sp_mut(const void*); +_LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*); template inline _LIBCPP_INLINE_VISIBILITY @@ -5340,7 +5252,6 @@ atomic_is_lock_free(const shared_ptr<_Tp>*) } template -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { @@ -5353,7 +5264,6 @@ atomic_load(const shared_ptr<_Tp>* __p) template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { @@ -5361,7 +5271,6 @@ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) } template -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -5373,7 +5282,6 @@ atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -5381,7 +5289,6 @@ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) } template -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -5394,7 +5301,6 @@ atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR shared_ptr<_Tp> atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -5402,7 +5308,6 @@ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order } template -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -5424,7 +5329,6 @@ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, share template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -5433,7 +5337,6 @@ atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) @@ -5443,7 +5346,6 @@ atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* _ template inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) @@ -5576,6 +5478,4 @@ struct __temp_value { _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_MEMORY diff --git a/include/module.modulemap b/include/module.modulemap index 3194b5c9f..c354cae1e 100644 --- a/include/module.modulemap +++ b/include/module.modulemap @@ -484,7 +484,7 @@ module std [system] { module __string { header "__string" export * } module __tree { header "__tree" export * } module __tuple { header "__tuple" export * } - module __undef_macros { header "__undef_macros" export * } + module __undef_min_max { header "__undef_min_max" export * } module experimental { requires cplusplus11 @@ -500,11 +500,6 @@ module std [system] { module chrono { header "experimental/chrono" export * - } - module coroutine { - requires coroutines - header "experimental/coroutine" - export * } module deque { header "experimental/deque" diff --git a/include/mutex b/include/mutex index 553808820..11b0f7e52 100644 --- a/include/mutex +++ b/include/mutex @@ -109,17 +109,15 @@ public: lock_guard& operator=(lock_guard const&) = delete; }; -template -class scoped_lock // C++17 +template // Variadic lock_guard only provided in ABI V2. +class lock_guard { public: - using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex - - explicit scoped_lock(MutexTypes&... m); - scoped_lock(MutexTypes&... m, adopt_lock_t); - ~scoped_lock(); - scoped_lock(scoped_lock const&) = delete; - scoped_lock& operator=(scoped_lock const&) = delete; + explicit lock_guard(MutexTypes&... m); + lock_guard(MutexTypes&... m, adopt_lock_t); + ~lock_guard(); + lock_guard(lock_guard const&) = delete; + lock_guard& operator=(lock_guard const&) = delete; private: tuple pm; // exposition only }; @@ -191,19 +189,17 @@ template #include <__mutex_base> #include #include -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS #include #endif #include <__threading_support> +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS @@ -345,7 +341,7 @@ try_lock(_L0& __l0, _L1& __l1) return 0; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template int @@ -364,7 +360,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) return __r; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS template void @@ -393,7 +389,7 @@ lock(_L0& __l0, _L1& __l1) } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template void @@ -468,97 +464,19 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { _VSTD::__unlock(__l2, __l3...); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS -#if _LIBCPP_STD_VER > 14 -template -class _LIBCPP_TEMPLATE_VIS scoped_lock; - -template <> -class _LIBCPP_TEMPLATE_VIS scoped_lock<> { -public: - explicit scoped_lock() {} - ~scoped_lock() = default; - - _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(adopt_lock_t) {} - - scoped_lock(scoped_lock const&) = delete; - scoped_lock& operator=(scoped_lock const&) = delete; -}; - -template -class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { -public: - typedef _Mutex mutex_type; -private: - mutex_type& __m_; -public: - explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) - : __m_(__m) {__m_.lock();} - - ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} - - _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) - : __m_(__m) {} - - - scoped_lock(scoped_lock const&) = delete; - scoped_lock& operator=(scoped_lock const&) = delete; -}; - -template -class _LIBCPP_TEMPLATE_VIS scoped_lock -{ - static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required"); - typedef tuple<_MArgs&...> _MutexTuple; - -public: - _LIBCPP_INLINE_VISIBILITY - explicit scoped_lock(_MArgs&... __margs) - : __t_(__margs...) - { - _VSTD::lock(__margs...); - } - - _LIBCPP_INLINE_VISIBILITY - scoped_lock(_MArgs&... __margs, adopt_lock_t) - : __t_(__margs...) - { - } - - _LIBCPP_INLINE_VISIBILITY - ~scoped_lock() { - typedef typename __make_tuple_indices::type _Indices; - __unlock_unpack(_Indices{}, __t_); - } - - scoped_lock(scoped_lock const&) = delete; - scoped_lock& operator=(scoped_lock const&) = delete; - -private: - template - _LIBCPP_INLINE_VISIBILITY - static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) { - _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...); - } - - _MutexTuple __t_; -}; - -#endif // _LIBCPP_STD_VER > 14 #endif // !_LIBCPP_HAS_NO_THREADS struct _LIBCPP_TEMPLATE_VIS once_flag; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY @@ -568,7 +486,7 @@ template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS struct _LIBCPP_TEMPLATE_VIS once_flag { @@ -582,11 +500,11 @@ private: unsigned long __state_; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template friend void call_once(once_flag&, _Callable&&, _Args&&...); -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS template friend void call_once(once_flag&, _Callable&); @@ -594,10 +512,10 @@ private: template friend void call_once(once_flag&, const _Callable&); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template class __call_once_param @@ -652,7 +570,7 @@ __call_once_proxy(void* __vp) _LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*)); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template inline _LIBCPP_INLINE_VISIBILITY @@ -668,7 +586,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) } } -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS template inline _LIBCPP_INLINE_VISIBILITY @@ -687,17 +605,72 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { - if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) + if (__flag.__state_ != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS + + +#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) \ + && !defined(_LIBCPP_CXX03_LANG) +template <> +class _LIBCPP_TEMPLATE_VIS lock_guard<> { +public: + explicit lock_guard() {} + ~lock_guard() = default; + + _LIBCPP_INLINE_VISIBILITY + explicit lock_guard(adopt_lock_t) {} + + lock_guard(lock_guard const&) = delete; + lock_guard& operator=(lock_guard const&) = delete; +}; + +template +class _LIBCPP_TEMPLATE_VIS lock_guard +{ + static_assert(sizeof...(_MArgs) >= 2, "At least 2 lock types required"); + typedef tuple<_MArgs&...> _MutexTuple; + +public: + _LIBCPP_INLINE_VISIBILITY + explicit lock_guard(_MArgs&... __margs) + : __t_(__margs...) + { + _VSTD::lock(__margs...); + } + + _LIBCPP_INLINE_VISIBILITY + lock_guard(_MArgs&... __margs, adopt_lock_t) + : __t_(__margs...) + { + } + + _LIBCPP_INLINE_VISIBILITY + ~lock_guard() { + typedef typename __make_tuple_indices::type _Indices; + __unlock_unpack(_Indices{}, __t_); + } + + lock_guard(lock_guard const&) = delete; + lock_guard& operator=(lock_guard const&) = delete; + +private: + template + _LIBCPP_INLINE_VISIBILITY + static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) { + _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...); + } + + _MutexTuple __t_; +}; + +#endif // _LIBCPP_ABI_VARIADIC_LOCK_GUARD _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_MUTEX diff --git a/include/new b/include/new index 34df2efee..c0e7b2daf 100644 --- a/include/new +++ b/include/new @@ -146,8 +146,9 @@ _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec #if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11) -class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH - bad_array_length : public bad_alloc { +class _LIBCPP_EXCEPTION_ABI bad_array_length + : public bad_alloc +{ public: bad_array_length() _NOEXCEPT; virtual ~bad_array_length() _NOEXCEPT; @@ -181,7 +182,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::not _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; #endif _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; @@ -189,7 +190,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::n _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; #endif #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION @@ -198,7 +199,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; @@ -206,7 +207,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_v _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION -_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif #endif @@ -237,9 +238,6 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) { #ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE -#ifndef _LIBCPP_NO_EXCEPTIONS -_LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH -#endif void __throw_bad_array_length() { #ifndef _LIBCPP_NO_EXCEPTIONS diff --git a/include/numeric b/include/numeric index 0e53ba33c..8f2514693 100644 --- a/include/numeric +++ b/include/numeric @@ -71,9 +71,6 @@ template #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -225,11 +222,11 @@ struct __abs<_Result, _Source, false> { template -_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN +_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _Tp __gcd(_Tp __m, _Tp __n) { static_assert((!is_signed<_Tp>::value), ""); - return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n); + return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n); } @@ -243,9 +240,8 @@ gcd(_Tp __m, _Up __n) static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; - return static_cast<_Rp>(_VSTD::__gcd( - static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), - static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); + return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), + static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); } template @@ -260,7 +256,7 @@ lcm(_Tp __m, _Up __n) return 0; using _Rp = common_type_t<_Tp,_Up>; - _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); + _Rp __val1 = __abs<_Rp, _Tp>()(__m) / gcd(__m, __n); _Rp __val2 = __abs<_Rp, _Up>()(__n); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; @@ -270,6 +266,4 @@ lcm(_Tp __m, _Up __n) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_NUMERIC diff --git a/include/optional b/include/optional index c0fd0e7bc..180f63ffc 100644 --- a/include/optional +++ b/include/optional @@ -17,31 +17,29 @@ // C++1z namespace std { - // 23.6.3, optional for object types + // 20.6.3, optional for object types template class optional; - // 23.6.4, no-value state indicator + // 20.6.4, no-value state indicator struct nullopt_t{see below }; constexpr nullopt_t nullopt(unspecified ); - // 23.6.5, class bad_optional_access + // 20.6.5, class bad_optional_access class bad_optional_access; - // 23.6.6, relational operators - template - constexpr bool operator==(const optional&, const optional&); - template - constexpr bool operator!=(const optional&, const optional&); - template - constexpr bool operator<(const optional&, const optional&); - template - constexpr bool operator>(const optional&, const optional&); - template - constexpr bool operator<=(const optional&, const optional&); - template - constexpr bool operator>=(const optional&, const optional&); - - // 23.6.7 comparison with nullopt + // 20.6.6, relational operators + template + constexpr bool operator==(const optional&, const optional&); + template + constexpr bool operator!=(const optional&, const optional&); + template + constexpr bool operator<(const optional&, const optional&); + template + constexpr bool operator>(const optional&, const optional&); + template + constexpr bool operator<=(const optional&, const optional&); + template + constexpr bool operator>=(const optional&, const optional&); template constexpr bool operator==(const optional&, nullopt_t) noexcept; template constexpr bool operator==(nullopt_t, const optional&) noexcept; template constexpr bool operator!=(const optional&, nullopt_t) noexcept; @@ -55,21 +53,21 @@ namespace std { template constexpr bool operator>=(const optional&, nullopt_t) noexcept; template constexpr bool operator>=(nullopt_t, const optional&) noexcept; - // 23.6.8, comparison with T - template constexpr bool operator==(const optional&, const U&); - template constexpr bool operator==(const U&, const optional&); - template constexpr bool operator!=(const optional&, const U&); - template constexpr bool operator!=(const U&, const optional&); - template constexpr bool operator<(const optional&, const U&); - template constexpr bool operator<(const U&, const optional&); - template constexpr bool operator<=(const optional&, const U&); - template constexpr bool operator<=(const U&, const optional&); - template constexpr bool operator>(const optional&, const U&); - template constexpr bool operator>(const U&, const optional&); - template constexpr bool operator>=(const optional&, const U&); - template constexpr bool operator>=(const U&, const optional&); + // 20.6.8, comparison with T + template constexpr bool operator==(const optional&, const T&); + template constexpr bool operator==(const T&, const optional&); + template constexpr bool operator!=(const optional&, const T&); + template constexpr bool operator!=(const T&, const optional&); + template constexpr bool operator<(const optional&, const T&); + template constexpr bool operator<(const T&, const optional&); + template constexpr bool operator<=(const optional&, const T&); + template constexpr bool operator<=(const T&, const optional&); + template constexpr bool operator>(const optional&, const T&); + template constexpr bool operator>(const T&, const optional&); + template constexpr bool operator>=(const optional&, const T&); + template constexpr bool operator>=(const T&, const optional&); - // 23.6.9, specialized algorithms + // 20.6.9, specialized algorithms template void swap(optional&, optional&) noexcept(see below ); template constexpr optional make_optional(T&&); template @@ -77,7 +75,7 @@ namespace std { template constexpr optional make_optional(initializer_list il, Args&&... args); - // 23.6.10, hash support + // 20.6.10, hash support template struct hash; template struct hash>; @@ -85,11 +83,11 @@ namespace std { public: using value_type = T; - // 23.6.3.1, constructors + // 20.6.3.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional &); - optional(optional &&) noexcept(see below); + optional(optional &&) noexcept(see below ); template constexpr explicit optional(in_place_t, Args &&...); template constexpr explicit optional(in_place_t, initializer_list, Args &&...); @@ -100,24 +98,24 @@ namespace std { template constexpr EXPLICIT optional(optional &&); - // 23.6.3.2, destructor + // 20.6.3.2, destructor ~optional(); - // 23.6.3.3, assignment + // 20.6.3.3, assignment optional &operator=(nullopt_t) noexcept; optional &operator=(const optional &); optional &operator=(optional &&) noexcept(see below ); template optional &operator=(U &&); template optional &operator=(const optional &); template optional &operator=(optional &&); - template T& emplace(Args &&...); + template void emplace(Args &&...); template - T& emplace(initializer_list, Args &&...); + void emplace(initializer_list, Args &&...); - // 23.6.3.4, swap + // 20.6.3.4, swap void swap(optional &) noexcept(see below ); - // 23.6.3.5, observers + // 20.6.3.5, observers constexpr T const *operator->() const; constexpr T *operator->(); constexpr T const &operator*() const &; @@ -133,7 +131,7 @@ namespace std { template constexpr T value_or(U &&) const &; template constexpr T value_or(U &&) &&; - // 23.6.3.6, modifiers + // 20.6.3.6, modifiers void reset() noexcept; private: @@ -146,6 +144,7 @@ namespace std { #include <__config> #include <__debug> #include <__functional_base> +#include <__undef_min_max> #include #include #include @@ -157,10 +156,6 @@ namespace std { #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - namespace std // purposefully not using versioning namespace { @@ -536,7 +531,7 @@ private: }; template using _CheckOptionalArgsCtor = conditional_t< - !is_same_v, in_place_t> && + !is_same_v && !is_same_v, optional>, _CheckOptionalArgsConstructor, __check_tuple_constructor_fail @@ -602,8 +597,8 @@ private: public: _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {} - _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default; - _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default; + _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default; + _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default; _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {} template > _LIBCPP_INLINE_VISIBILITY - _Tp & + void emplace(_Args&&... __args) { reset(); this->__construct(_VSTD::forward<_Args>(__args)...); - return this->__get(); } template > _LIBCPP_INLINE_VISIBILITY - _Tp & + void emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); this->__construct(__il, _VSTD::forward<_Args>(__args)...); - return this->__get(); } _LIBCPP_INLINE_VISIBILITY @@ -897,7 +890,7 @@ public: template _LIBCPP_INLINE_VISIBILITY - constexpr value_type value_or(_Up&& __v) && + value_type value_or(_Up&& __v) && { static_assert(is_move_constructible_v, "optional::value_or: T must be move constructible"); @@ -928,14 +921,14 @@ private: }; // Comparisons between optionals -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const optional<_Tp>& __x, const optional<_Up>& __y) +operator==(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (static_cast(__x) != static_cast(__y)) return false; @@ -944,14 +937,14 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y) return *__x == *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) +operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (static_cast(__x) != static_cast(__y)) return true; @@ -960,14 +953,14 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) return *__x != *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const optional<_Tp>& __x, const optional<_Up>& __y) +operator<(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (!static_cast(__y)) return false; @@ -976,14 +969,14 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y) return *__x < *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const optional<_Tp>& __x, const optional<_Up>& __y) +operator>(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (!static_cast(__x)) return false; @@ -992,14 +985,14 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y) return *__x > *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) +operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (!static_cast(__x)) return true; @@ -1008,14 +1001,14 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) return *__x <= *__y; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) +operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y) { if (!static_cast(__y)) return true; @@ -1122,146 +1115,146 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept } // Comparisons with T -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const optional<_Tp>& __x, const _Up& __v) +operator==(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x == __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator==(const _Tp& __v, const optional<_Up>& __x) +operator==(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v == *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const optional<_Tp>& __x, const _Up& __v) +operator!=(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x != __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator!=(const _Tp& __v, const optional<_Up>& __x) +operator!=(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v != *__x : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const optional<_Tp>& __x, const _Up& __v) +operator<(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x < __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<(const _Tp& __v, const optional<_Up>& __x) +operator<(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v < *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const optional<_Tp>& __x, const _Up& __v) +operator<=(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x <= __v : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator<=(const _Tp& __v, const optional<_Up>& __x) +operator<=(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v <= *__x : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const optional<_Tp>& __x, const _Up& __v) +operator>(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x > __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>(const _Tp& __v, const optional<_Up>& __x) +operator>(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v > *__x : true; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const optional<_Tp>& __x, const _Up& __v) +operator>=(const optional<_Tp>& __x, const _Tp& __v) { return static_cast(__x) ? *__x >= __v : false; } -template +template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= - _VSTD::declval()), bool>, + _VSTD::declval()), bool>, bool > -operator>=(const _Tp& __v, const optional<_Up>& __x) +operator>=(const _Tp& __v, const optional<_Tp>& __x) { return static_cast(__x) ? __v >= *__x : true; } @@ -1308,7 +1301,7 @@ struct _LIBCPP_TEMPLATE_VIS hash< typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type& __opt) const + result_type operator()(const argument_type& __opt) const _NOEXCEPT { return static_cast(__opt) ? hash>()(*__opt) : 0; } @@ -1318,6 +1311,4 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 14 -_LIBCPP_POP_MACROS - #endif // _LIBCPP_OPTIONAL diff --git a/include/ostream b/include/ostream index 9bf8d3cdc..3d9be8b7a 100644 --- a/include/ostream +++ b/include/ostream @@ -165,11 +165,13 @@ public: { this->init(__sb); } virtual ~basic_ostream(); protected: -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_ostream(basic_ostream&& __rhs); +#endif // 27.7.2.3 Assign/swap +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_ostream& operator=(basic_ostream&& __rhs); #endif @@ -288,7 +290,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry() } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) @@ -304,7 +306,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_ostream<_CharT, _Traits>::~basic_ostream() @@ -1021,7 +1023,7 @@ flush(basic_ostream<_CharT, _Traits>& __os) return __os; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1037,7 +1039,7 @@ operator<<(_Stream&& __os, const _Tp& __x) return _VSTD::move(__os); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_ostream<_CharT, _Traits>& @@ -1080,10 +1082,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) use_facet >(__os.getloc()).widen('1')); } -#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream) -#endif _LIBCPP_END_NAMESPACE_STD diff --git a/include/queue b/include/queue index feaae8920..57d420c74 100644 --- a/include/queue +++ b/include/queue @@ -213,27 +213,29 @@ public: _LIBCPP_INLINE_VISIBILITY queue(const queue& __q) : c(__q.c) {} - _LIBCPP_INLINE_VISIBILITY - queue& operator=(const queue& __q) {c = __q.c; return *this;} - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY queue(queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + queue& operator=(const queue& __q) {c = __q.c; return *this;} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY queue& operator=(queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit queue(const container_type& __c) : c(__c) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY explicit queue(const _Alloc& __a, @@ -252,7 +254,7 @@ public: typename enable_if::value>::type* = 0) : c(__c, __a) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY queue(container_type&& __c, const _Alloc& __a, @@ -266,7 +268,7 @@ public: _Alloc>::value>::type* = 0) : c(_VSTD::move(__q.c), __a) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -284,9 +286,10 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} +#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -296,7 +299,8 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_front();} @@ -414,30 +418,32 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} - _LIBCPP_INLINE_VISIBILITY - priority_queue& operator=(const priority_queue& __q) - {c = __q.c; comp = __q.comp; return *this;} - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY priority_queue(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value && is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + priority_queue& operator=(const priority_queue& __q) + {c = __q.c; comp = __q.comp; return *this;} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY priority_queue& operator=(priority_queue&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value && is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {} _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const value_compare& __comp, container_type&& __c); #endif @@ -449,12 +455,12 @@ public: _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY explicit priority_queue(const _Alloc& __a, @@ -476,7 +482,7 @@ public: priority_queue(const priority_queue& __q, const _Alloc& __a, typename enable_if::value>::type* = 0); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY priority_queue(const value_compare& __comp, container_type&& __c, @@ -488,7 +494,7 @@ public: priority_queue(priority_queue&& __q, const _Alloc& __a, typename enable_if::value>::type* = 0); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -499,13 +505,13 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v); - template - _LIBCPP_INLINE_VISIBILITY - void emplace(_Args&&... __args); -#endif // _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS + template _LIBCPP_INLINE_VISIBILITY void emplace(_Args&&... __args); +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void pop(); @@ -525,7 +531,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -537,7 +543,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _ _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -563,7 +569,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -578,7 +584,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -629,7 +635,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& _VSTD::make_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template template @@ -658,7 +664,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, _VSTD::make_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -669,7 +675,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -680,6 +686,8 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) _VSTD::push_heap(c.begin(), c.end(), comp); } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template inline @@ -690,7 +698,8 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) _VSTD::push_heap(c.begin(), c.end(), comp); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline diff --git a/include/random b/include/random index ba8a088df..835ebdb6c 100644 --- a/include/random +++ b/include/random @@ -1646,14 +1646,12 @@ class piecewise_linear_distribution #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // __is_seed_sequence @@ -2015,41 +2013,41 @@ template class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine; -template +template bool -operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); -template +template _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + template friend bool - operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); - template + template friend bool - operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x); private: @@ -2386,13 +2384,13 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, return __z ^ __rshift<__l>(__z); } -template +template bool -operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { if (__x.__i_ == __y.__i_) @@ -2430,26 +2428,26 @@ operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _D __x.__x_ + (_Np - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, +operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __y) { return !(__x == __y); } template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); @@ -2465,17 +2463,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp, + _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp, + _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, + mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, _Bp, _Tp, _Cp, _Lp, _Fp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UInt __t[_Np]; + _UI __t[_Np]; for (size_t __i = 0; __i < _Np; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2503,30 +2501,30 @@ typedef mersenne_twister_engine class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine; -template +template bool operator==( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); -template +template _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine @@ -2588,33 +2586,33 @@ public: _LIBCPP_INLINE_VISIBILITY void discard(unsigned long long __z) {for (; __z; --__z) operator()();} - template + template friend bool operator==( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); - template + template friend bool operator!=( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x); + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x); private: @@ -2713,11 +2711,11 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()() return __xr; } -template +template bool operator==( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) { if (__x.__c_ != __y.__c_) return false; @@ -2756,21 +2754,21 @@ operator==( __x.__x_ + (_Rp - (__y.__i_ + __j))); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x, + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y) { return !(__x == __y); } template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) + const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__os); __os.flags(ios_base::dec | ios_base::left); @@ -2786,14 +2784,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, } template + class _UI, size_t _Wp, size_t _Sp, size_t _Rp> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x) + subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x) { __save_flags<_CharT, _Traits> __lx(__is); __is.flags(ios_base::dec | ios_base::skipws); - _UInt __t[_Rp+1]; + _UI __t[_Rp+1]; for (size_t __i = 0; __i < _Rp+1; ++__i) __is >> __t[__i]; if (!__is.fail()) @@ -2828,7 +2826,7 @@ public: static _LIBCPP_CONSTEXPR const size_t block_size = __p; static _LIBCPP_CONSTEXPR const size_t used_block = __r; -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -2847,11 +2845,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(const _Engine& __e) : __e_(__e), __n_(0) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) : __e_(_VSTD::move(__e)), __n_(0) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} template @@ -2988,13 +2986,13 @@ typedef discard_block_engine ranlux48; template class _LIBCPP_TEMPLATE_VIS independent_bits_engine { - template + template class __get_n { - static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits; + static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits; static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0); static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np; - static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; + static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0; public: static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np; }; @@ -3016,7 +3014,7 @@ private: result_type, _Engine_result_type >::type _Working_result_type; -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min + _Working_result_type(1); #else @@ -3057,11 +3055,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(const _Engine& __e) : __e_(__e) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} template @@ -3093,33 +3091,33 @@ public: _LIBCPP_INLINE_VISIBILITY const _Engine& base() const _NOEXCEPT {return __e_;} - template + template friend bool operator==( - const independent_bits_engine<_Eng, _Wp, _UInt>& __x, - const independent_bits_engine<_Eng, _Wp, _UInt>& __y); + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y); - template + template friend bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UInt>& __x, - const independent_bits_engine<_Eng, _Wp, _UInt>& __y); + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y); template + class _Eng, size_t _Wp, class _UI> friend basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UInt>& __x); + const independent_bits_engine<_Eng, _Wp, _UI>& __x); template + class _Eng, size_t _Wp, class _UI> friend basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UInt>& __x); + independent_bits_engine<_Eng, _Wp, _UI>& __x); private: _LIBCPP_INLINE_VISIBILITY @@ -3181,40 +3179,40 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) return _Sp; } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator==( - const independent_bits_engine<_Eng, _Wp, _UInt>& __x, - const independent_bits_engine<_Eng, _Wp, _UInt>& __y) + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y) { return __x.base() == __y.base(); } -template +template inline _LIBCPP_INLINE_VISIBILITY bool operator!=( - const independent_bits_engine<_Eng, _Wp, _UInt>& __x, - const independent_bits_engine<_Eng, _Wp, _UInt>& __y) + const independent_bits_engine<_Eng, _Wp, _UI>& __x, + const independent_bits_engine<_Eng, _Wp, _UI>& __y) { return !(__x == __y); } template + class _Eng, size_t _Wp, class _UI> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, - const independent_bits_engine<_Eng, _Wp, _UInt>& __x) + const independent_bits_engine<_Eng, _Wp, _UI>& __x) { return __os << __x.base(); } template + class _Eng, size_t _Wp, class _UI> basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, - independent_bits_engine<_Eng, _Wp, _UInt>& __x) + independent_bits_engine<_Eng, _Wp, _UI>& __x) { _Eng __e; __is >> __e; @@ -3266,7 +3264,7 @@ public: // engine characteristics static _LIBCPP_CONSTEXPR const size_t table_size = __k; -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const result_type _Min = _Engine::_Min; static const result_type _Max = _Engine::_Max; #else @@ -3287,11 +3285,11 @@ public: _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(const _Engine& __e) : __e_(__e) {__init();} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) : __e_(_VSTD::move(__e)) {__init();} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} template @@ -3528,11 +3526,11 @@ public: // constructors _LIBCPP_INLINE_VISIBILITY seed_seq() _NOEXCEPT {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY @@ -3639,7 +3637,7 @@ generate_canonical(_URNG& __g) { const size_t _Dt = numeric_limits<_RealType>::digits; const size_t __b = _Dt < __bits ? _Dt : __bits; -#ifdef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_HAS_NO_CONSTEXPR const size_t __logR = __log2::value; #else const size_t __logR = __log2::value; @@ -3999,30 +3997,16 @@ public: {return !(__x == __y);} }; -#ifndef _LIBCPP_MSVCRT -extern "C" double lgamma_r(double, int *); -#endif - -inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) { -#if defined(_LIBCPP_MSVCRT) - return lgamma(__d); -#else - int __sign; - return lgamma_r(__d, &__sign); -#endif -} - template -binomial_distribution<_IntType>::param_type::param_type(const result_type __t, const double __p) +binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p) : __t_(__t), __p_(__p) { if (0 < __p_ && __p_ < 1) { __r0_ = static_cast((__t_ + 1) * __p_); - __pr_ = _VSTD::exp(__libcpp_lgamma(__t_ + 1.) - - __libcpp_lgamma(__r0_ + 1.) - - __libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + - (__t_ - __r0_) * _VSTD::log(1 - __p_)); + __pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) - + _VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + + (__t_ - __r0_) * _VSTD::log(1 - __p_)); __odds_ratio_ = __p_ / (1 - __p_); } } @@ -5867,11 +5851,11 @@ public: _LIBCPP_INLINE_VISIBILITY param_type(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {__init();} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY param_type(initializer_list __wl) : __p_(__wl.begin(), __wl.end()) {__init();} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template param_type(size_t __nw, double __xmin, double __xmax, _UnaryOperation __fw); @@ -5914,11 +5898,11 @@ public: _LIBCPP_INLINE_VISIBILITY discrete_distribution(_InputIterator __f, _InputIterator __l) : __p_(__f, __l) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY discrete_distribution(initializer_list __wl) : __p_(__wl) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY discrete_distribution(size_t __nw, double __xmin, double __xmax, @@ -6095,10 +6079,10 @@ public: template param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template param_type(initializer_list __bl, _UnaryOperation __fw); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6148,13 +6132,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY piecewise_constant_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY @@ -6284,7 +6268,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -6309,7 +6293,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -6418,10 +6402,10 @@ public: template param_type(_InputIteratorB __fB, _InputIteratorB __lB, _InputIteratorW __fW); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template param_type(initializer_list __bl, _UnaryOperation __fw); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template param_type(size_t __nw, result_type __xmin, result_type __xmax, _UnaryOperation __fw); @@ -6471,13 +6455,13 @@ public: _InputIteratorW __fW) : __p_(__fB, __lB, __fW) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY piecewise_linear_distribution(initializer_list __bl, _UnaryOperation __fw) : __p_(__bl, __fw) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY @@ -6611,7 +6595,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -6636,7 +6620,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type( } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -6738,6 +6722,4 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_RANDOM diff --git a/include/ratio b/include/ratio index 27aa0ded3..fa893637d 100644 --- a/include/ratio +++ b/include/ratio @@ -83,14 +83,12 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // __static_gcd @@ -522,6 +520,4 @@ template _LIBCPP_CONSTEXPR bool ratio_greater_equal_v _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_RATIO diff --git a/include/regex b/include/regex index b70e313cd..2b4c5aaab 100644 --- a/include/regex +++ b/include/regex @@ -765,14 +765,12 @@ typedef regex_token_iterator wsregex_token_iterator; #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD namespace regex_constants @@ -2547,14 +2545,14 @@ public: : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__first, __last);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_regex(initializer_list __il, flag_type __f = regex_constants::ECMAScript) : __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0), __end_(0) {__parse(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // ~basic_regex() = default; @@ -2563,11 +2561,11 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const value_type* __p) {return assign(__p);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(initializer_list __il) {return assign(__il);} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template _LIBCPP_INLINE_VISIBILITY basic_regex& operator=(const basic_string& __p) @@ -2577,7 +2575,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const basic_regex& __that) {return *this = __that;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_regex& assign(basic_regex&& __that) _NOEXCEPT {return *this = _VSTD::move(__that);} @@ -2634,14 +2632,14 @@ public: return assign(basic_regex(__first, __last, __f)); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_regex& assign(initializer_list __il, flag_type __f = regex_constants::ECMAScript) {return assign(__il.begin(), __il.end(), __f);} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // const operations: _LIBCPP_INLINE_VISIBILITY @@ -3965,6 +3963,7 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first if (__temp == __last) __throw_regex_error(); // [__first, __temp) contains all text in [= ... =] + typedef typename _Traits::string_type string_type; string_type __collate_name = __traits_.lookup_collatename(__first, __temp); if (__collate_name.empty()) @@ -6221,7 +6220,7 @@ public: regex_constants::match_default) = delete; #endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, initializer_list __submatches, @@ -6235,7 +6234,7 @@ public: regex_constants::match_flag_type __m = regex_constants::match_default) = delete; #endif -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, @@ -6335,7 +6334,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: @@ -6350,7 +6349,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: __init(__a, __b); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -6570,6 +6569,4 @@ regex_replace(const _CharT* __s, _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_REGEX diff --git a/include/set b/include/set index 30f2fa88f..be5c9528c 100644 --- a/include/set +++ b/include/set @@ -486,12 +486,12 @@ public: return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set(set&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit set(const allocator_type& __a) @@ -504,9 +504,11 @@ public: insert(__s.begin(), __s.end()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES set(set&& __s, const allocator_type& __a); +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY set(initializer_list __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -534,7 +536,9 @@ public: __tree_.__assign_unique(__il.begin(), __il.end()); return *this; } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY set& operator=(set&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -542,7 +546,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -583,7 +587,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -592,15 +596,23 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG - +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY pair insert(const value_type& __v) {return __tree_.__insert_unique(__v);} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + pair insert(value_type&& __v) + {return __tree_.__insert_unique(_VSTD::move(__v));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_unique(__p, __v);} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_unique(__p, _VSTD::move(__v));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -609,19 +621,11 @@ public: __tree_.__insert_unique(__e, *__f); } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - pair insert(value_type&& __v) - {return __tree_.__insert_unique(_VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_unique(__p, _VSTD::move(__v));} - +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -723,7 +727,7 @@ public: #endif }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) @@ -737,7 +741,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -897,14 +901,12 @@ public: return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset(multiset&& __s) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_VSTD::move(__s.__tree_)) {} - - multiset(multiset&& __s, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit multiset(const allocator_type& __a) : __tree_(__a) {} @@ -914,8 +916,11 @@ public: { insert(__s.begin(), __s.end()); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + multiset(multiset&& __s, const allocator_type& __a); +#endif -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY multiset(initializer_list __il, const value_compare& __comp = value_compare()) : __tree_(__comp) @@ -943,7 +948,9 @@ public: __tree_.__assign_multi(__il.begin(), __il.end()); return *this; } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY multiset& operator=(multiset&& __s) _NOEXCEPT_(is_nothrow_move_assignable<__base>::value) @@ -951,7 +958,7 @@ public: __tree_ = _VSTD::move(__s.__tree_); return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __tree_.begin();} @@ -992,7 +999,7 @@ public: size_type max_size() const _NOEXCEPT {return __tree_.max_size();} // modifiers: -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -1001,15 +1008,23 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} -#endif // _LIBCPP_CXX03_LANG - +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + iterator insert(value_type&& __v) + {return __tree_.__insert_multi(_VSTD::move(__v));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __v) {return __tree_.__insert_multi(__p, __v);} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __v) + {return __tree_.__insert_multi(__p, _VSTD::move(__v));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __f, _InputIterator __l) @@ -1018,19 +1033,11 @@ public: __tree_.__insert_multi(__e, *__f); } -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __v) - {return __tree_.__insert_multi(_VSTD::move(__v));} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __v) - {return __tree_.__insert_multi(__p, _VSTD::move(__v));} - +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p);} @@ -1133,7 +1140,7 @@ public: #endif }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) @@ -1147,7 +1154,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/shared_mutex b/include/shared_mutex index 9cb81528c..29e8cef48 100644 --- a/include/shared_mutex +++ b/include/shared_mutex @@ -125,14 +125,12 @@ template #include <__config> -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - #if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX) #include <__mutex_base> +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif @@ -143,7 +141,7 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base +struct _LIBCPP_TYPE_VIS __shared_mutex_base { mutex __mut_; condition_variable __gate1_; @@ -175,11 +173,11 @@ struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base #if _LIBCPP_STD_VER > 14 -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex +class _LIBCPP_TYPE_VIS shared_mutex { - __shared_mutex_base __base; + __shared_mutex_base __base; public: - _LIBCPP_INLINE_VISIBILITY shared_mutex() : __base() {} + shared_mutex() : __base() {} _LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default; shared_mutex(const shared_mutex&) = delete; @@ -201,9 +199,9 @@ public: #endif -class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_timed_mutex +class _LIBCPP_TYPE_VIS shared_timed_mutex { - __shared_mutex_base __base; + __shared_mutex_base __base; public: shared_timed_mutex(); _LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default; @@ -502,6 +500,4 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 11 -_LIBCPP_POP_MACROS - #endif // _LIBCPP_SHARED_MUTEX diff --git a/include/sstream b/include/sstream index b9903f961..40b97854f 100644 --- a/include/sstream +++ b/include/sstream @@ -175,14 +175,12 @@ typedef basic_stringstream wstringstream; #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // basic_stringbuf @@ -214,10 +212,12 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_stringbuf(basic_stringbuf&& __rhs); +#endif // 27.8.1.2 Assign and swap: +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES basic_stringbuf& operator=(basic_stringbuf&& __rhs); #endif void swap(basic_stringbuf& __rhs); @@ -255,7 +255,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& str(__s); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) @@ -346,7 +346,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -641,13 +641,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_istringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_istringstream(basic_istringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_istringstream& operator=(basic_istringstream&& __rhs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY void swap(basic_istringstream& __rhs); @@ -675,7 +675,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri { } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) @@ -694,7 +694,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream& return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs) @@ -758,13 +758,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_ostringstream(const string_type& __s, ios_base::openmode __wch = ios_base::out); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_ostringstream(basic_ostringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_ostringstream& operator=(basic_ostringstream&& __rhs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY void swap(basic_ostringstream& __rhs); @@ -792,7 +792,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri { } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) @@ -811,7 +811,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream& return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -877,13 +877,13 @@ public: inline _LIBCPP_INLINE_VISIBILITY explicit basic_stringstream(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY basic_stringstream(basic_stringstream&& __rhs); // 27.8.2.2 Assign and swap: basic_stringstream& operator=(basic_stringstream&& __rhs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY void swap(basic_stringstream& __rhs); @@ -911,7 +911,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string { } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) @@ -930,7 +930,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -972,6 +972,4 @@ basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_SSTREAM diff --git a/include/stack b/include/stack index b2d4e2395..c797ea5ec 100644 --- a/include/stack +++ b/include/stack @@ -126,28 +126,29 @@ public: _LIBCPP_INLINE_VISIBILITY stack(const stack& __q) : c(__q.c) {} - _LIBCPP_INLINE_VISIBILITY - stack& operator=(const stack& __q) {c = __q.c; return *this;} - - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY stack(stack&& __q) _NOEXCEPT_(is_nothrow_move_constructible::value) : c(_VSTD::move(__q.c)) {} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + stack& operator=(const stack& __q) {c = __q.c; return *this;} + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY stack& operator=(stack&& __q) _NOEXCEPT_(is_nothrow_move_assignable::value) {c = _VSTD::move(__q.c); return *this;} - - _LIBCPP_INLINE_VISIBILITY - explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit stack(const container_type& __c) : c(__c) {} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY explicit stack(const _Alloc& __a, @@ -166,7 +167,7 @@ public: typename enable_if::value>::type* = 0) : c(__s.c, __a) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY stack(container_type&& __c, const _Alloc& __a, @@ -179,7 +180,7 @@ public: typename enable_if::value>::type* = 0) : c(_VSTD::move(__s.c), __a) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY bool empty() const {return c.empty();} @@ -192,10 +193,10 @@ public: _LIBCPP_INLINE_VISIBILITY void push(const value_type& __v) {c.push_back(__v);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} - +#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -205,8 +206,8 @@ public: void emplace(_Args&&... __args) { c.emplace_back(_VSTD::forward<_Args>(__args)...);} #endif -#endif // _LIBCPP_CXX03_LANG - +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void pop() {c.pop_back();} diff --git a/include/stdexcept b/include/stdexcept index 95a96cc07..d501d0916 100644 --- a/include/stdexcept +++ b/include/stdexcept @@ -61,9 +61,9 @@ class _LIBCPP_HIDDEN __libcpp_refstring bool __uses_refcount() const; public: - explicit __libcpp_refstring(const char* __msg); - __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT; - __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT; + explicit __libcpp_refstring(const char* msg); + __libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT; + __libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT; ~__libcpp_refstring(); const char* c_str() const _NOEXCEPT {return __imp_;} diff --git a/include/stdio.h b/include/stdio.h index f12417640..56fb2d83b 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -110,9 +110,9 @@ void perror(const char* s); #ifdef __cplusplus // snprintf -#if defined(_LIBCPP_MSVCRT_LIKE) -extern "C" { -int vasprintf(char **sptr, const char *__restrict fmt, va_list ap); +#if defined(_LIBCPP_MSVCRT) +extern "C++" { +#include "support/win32/support.h" } #endif diff --git a/include/stdlib.h b/include/stdlib.h index f11c5e762..12fd676a1 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -97,6 +97,10 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 extern "C++" { +#ifdef _LIBCPP_MSVCRT +#include "support/win32/locale_win32.h" +#endif // _LIBCPP_MSVCRT + #undef abs #undef div #undef labs diff --git a/include/streambuf b/include/streambuf index a10ce1bf5..86070659a 100644 --- a/include/streambuf +++ b/include/streambuf @@ -116,9 +116,6 @@ protected: #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -479,16 +476,12 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type) return traits_type::eof(); } -#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios) _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios) -#endif _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_STEAMBUF diff --git a/include/string b/include/string index accf1ce27..e1c64faf9 100644 --- a/include/string +++ b/include/string @@ -484,16 +484,14 @@ basic_string operator "" s( const char32_t *str, size_t len ); // C++1 #include #endif +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD // fpos @@ -639,7 +637,7 @@ public: typedef basic_string __self; typedef basic_string_view<_CharT, _Traits> __self_view; typedef _Traits traits_type; - typedef _CharT value_type; + typedef typename traits_type::char_type value_type; typedef _Allocator allocator_type; typedef allocator_traits __alloc_traits; typedef typename __alloc_traits::size_type size_type; @@ -650,7 +648,7 @@ public: typedef typename __alloc_traits::const_pointer const_pointer; static_assert(is_pod::value, "Character type of basic_string must be a POD"); - static_assert((is_same<_CharT, typename traits_type::char_type>::value), + static_assert((is_same<_CharT, value_type>::value), "traits_type::char_type must be the same type as CharT"); static_assert((is_same::value), "Allocator::value_type must be same type as value_type"); @@ -765,7 +763,7 @@ public: basic_string(const basic_string& __str); basic_string(const basic_string& __str, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str) #if _LIBCPP_STD_VER <= 14 @@ -776,7 +774,7 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string(basic_string&& __str, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s); _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s, const _Allocator& __a); @@ -808,12 +806,12 @@ public: template _LIBCPP_INLINE_VISIBILITY basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il); _LIBCPP_INLINE_VISIBILITY basic_string(initializer_list<_CharT> __il, const _Allocator& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS inline ~basic_string(); @@ -827,15 +825,17 @@ public: #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - _LIBCPP_INLINE_VISIBILITY - basic_string& operator=(initializer_list __il) {return assign(__il.begin(), __il.size());} #endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);} basic_string& operator=(value_type __c); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + basic_string& operator=(initializer_list __il) {return assign(__il.begin(), __il.size());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY @@ -901,7 +901,7 @@ public: void resize(size_type __n, value_type __c); _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} - void reserve(size_type __res_arg = 0); + void reserve(size_type res_arg = 0); _LIBCPP_INLINE_VISIBILITY void shrink_to_fit() _NOEXCEPT {reserve();} _LIBCPP_INLINE_VISIBILITY @@ -918,9 +918,9 @@ public: _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(__self_view __sv) {return append(__sv);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);} _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list __il) {return append(__il);} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& append(const basic_string& __str); @@ -968,10 +968,10 @@ public: return __append_forward_unsafe(__first, __last); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& append(initializer_list __il) {return append(__il.begin(), __il.size());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void push_back(value_type __c); _LIBCPP_INLINE_VISIBILITY @@ -985,11 +985,11 @@ public: basic_string& assign(__self_view __sv) { return assign(__sv.data(), __sv.size()); } _LIBCPP_INLINE_VISIBILITY basic_string& assign(const basic_string& __str) { return *this = __str; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY - basic_string& assign(basic_string&& __str) + basic_string& assign(basic_string&& str) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)) - {*this = _VSTD::move(__str); return *this;} + {*this = _VSTD::move(str); return *this;} #endif basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); template @@ -999,7 +999,7 @@ public: __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, basic_string& >::type - assign(const _Tp & __t, size_type __pos, size_type __n=npos); + assign(const _Tp & __t, size_type pos, size_type n=npos); basic_string& assign(const value_type* __s, size_type __n); basic_string& assign(const value_type* __s); basic_string& assign(size_type __n, value_type __c); @@ -1021,10 +1021,10 @@ public: basic_string& >::type assign(_ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& assign(initializer_list __il) {return assign(__il.begin(), __il.size());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& insert(size_type __pos1, const basic_string& __str); @@ -1063,11 +1063,11 @@ public: iterator >::type insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __pos, initializer_list __il) {return insert(__pos, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS basic_string& erase(size_type __pos = 0, size_type __n = npos); _LIBCPP_INLINE_VISIBILITY @@ -1109,11 +1109,11 @@ public: basic_string& >::type replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list __il) {return replace(__i1, __i2, __il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const; _LIBCPP_INLINE_VISIBILITY @@ -1338,15 +1338,15 @@ private: __align_it (__s+1)) - 1;} - inline + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY void __init(const value_type* __s, size_type __sz, size_type __reserve); - inline + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY void __init(const value_type* __s, size_type __sz); - inline + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY void __init(size_type __n, value_type __c); template - inline + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, @@ -1355,7 +1355,7 @@ private: __init(_InputIterator __first, _InputIterator __last); template - inline + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY typename enable_if < __is_forward_iterator<_ForwardIterator>::value, @@ -1408,7 +1408,7 @@ private: void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void __move_assign(basic_string& __str, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value); @@ -1511,7 +1511,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ #else _NOEXCEPT #endif -: __r_(__second_tag(), __a) +: __r_(__a) { #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); @@ -1582,7 +1582,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); __init(__s, traits_type::length(__s)); @@ -1605,7 +1605,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); __init(__s, __n); @@ -1616,7 +1616,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_ template basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) - : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) + : __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc())) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; @@ -1630,7 +1630,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st template basic_string<_CharT, _Traits, _Allocator>::basic_string( const basic_string& __str, const allocator_type& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { if (!__str.__is_long()) __r_.first().__r = __str.__r_.first().__r; @@ -1641,7 +1641,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1664,7 +1664,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { if (__str.__is_long() && __a != __str.__alloc()) // copy, not move __init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size()); @@ -1680,7 +1680,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co #endif } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -1719,7 +1719,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { __init(__n, __c); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1731,7 +1731,7 @@ template basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) @@ -1746,7 +1746,7 @@ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) @@ -1762,7 +1762,7 @@ template basic_string<_CharT, _Traits, _Allocator>::basic_string( const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a, typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *) - : __r_(__second_tag(), __a) + : __r_(__a) { __self_view __sv = __self_view(__t).substr(__pos, __n); __init(__sv.data(), __sv.size()); @@ -1784,7 +1784,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv) template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { __init(__sv.data(), __sv.size()); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1866,7 +1866,7 @@ template inline _LIBCPP_INLINE_VISIBILITY basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) - : __r_(__second_tag(), __a) + : __r_(__a) { __init(__first, __last); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1874,7 +1874,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, #endif } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline _LIBCPP_INLINE_VISIBILITY @@ -1889,10 +1889,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( template inline _LIBCPP_INLINE_VISIBILITY - basic_string<_CharT, _Traits, _Allocator>::basic_string( initializer_list<_CharT> __il, const _Allocator& __a) - : __r_(__second_tag(), __a) + + : __r_(__a) { __init(__il.begin(), __il.end()); #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1900,7 +1900,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string( #endif } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template basic_string<_CharT, _Traits, _Allocator>::~basic_string() @@ -2049,7 +2049,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -2276,9 +2276,7 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe( size_type __n = static_cast(_VSTD::distance(__first, __last)); if (__n) { - typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; - _CharRef __tmp_ref = *__first; - if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size())) + if ( __ptr_in_range(&*__first, data(), data() + size())) { const basic_string __temp (__first, __last, __alloc()); append(__temp.data(), __temp.size()); @@ -2442,9 +2440,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward size_type __n = static_cast(_VSTD::distance(__first, __last)); if (__n) { - typedef typename iterator_traits<_ForwardIterator>::reference _CharRef; - _CharRef __tmp_char = *__first; - if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size())) + if ( __ptr_in_range(&*__first, data(), data() + size())) { const basic_string __temp(__first, __last, __alloc()); return insert(__pos, __temp.data(), __temp.data() + __temp.size()); @@ -3790,7 +3786,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs) return __r; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -3850,7 +3846,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) return _VSTD::move(__lhs); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES // swap @@ -3952,7 +3948,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -3966,7 +3962,7 @@ basic_istream<_CharT, _Traits>& getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -4043,6 +4039,4 @@ _LIBCPP_EXTERN_TEMPLATE(string operator+, allocator + #include <__string> #include #include @@ -177,10 +179,6 @@ namespace std { #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template > @@ -201,10 +199,6 @@ public: typedef ptrdiff_t difference_type; static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1); - static_assert(is_pod::value, "Character type of basic_string_view must be a POD"); - static_assert((is_same<_CharT, typename traits_type::char_type>::value), - "traits_type::char_type must be the same type as CharT"); - // [string.view.cons], construct/copy _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {} @@ -294,6 +288,13 @@ public: const_pointer data() const _NOEXCEPT { return __data; } // [string.view.modifiers], modifiers: + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY + void clear() _NOEXCEPT + { + __data = nullptr; + __size = 0; + } + _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT { @@ -356,9 +357,9 @@ public: _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY int compare( size_type __pos1, size_type __n1, - basic_string_view __sv, size_type __pos2, size_type __n2) const + basic_string_view _sv, size_type __pos2, size_type __n2) const { - return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); + return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2)); } _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY @@ -787,6 +788,4 @@ inline namespace literals #endif _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_STRING_VIEW diff --git a/include/strstream b/include/strstream index b00b9d830..81eef2ab4 100644 --- a/include/strstream +++ b/include/strstream @@ -151,12 +151,12 @@ public: strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0); strstreambuf(const unsigned char* __gnext, streamsize __n); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY strstreambuf(strstreambuf&& __rhs); _LIBCPP_INLINE_VISIBILITY strstreambuf& operator=(strstreambuf&& __rhs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES virtual ~strstreambuf(); @@ -191,7 +191,7 @@ private: void __init(char* __gnext, streamsize __n, char* __pbeg); }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY strstreambuf::strstreambuf(strstreambuf&& __rhs) @@ -226,7 +226,7 @@ strstreambuf::operator=(strstreambuf&& __rhs) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES class _LIBCPP_TYPE_VIS istrstream : public istream @@ -245,7 +245,7 @@ public: istrstream(char* __s, streamsize __n) : istream(&__sb_), __sb_(__s, __n) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY istrstream(istrstream&& __rhs) : istream(_VSTD::move(__rhs)), @@ -261,7 +261,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES virtual ~istrstream(); @@ -294,7 +294,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY ostrstream(ostrstream&& __rhs) : ostream(_VSTD::move(__rhs)), @@ -310,7 +310,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES virtual ~ostrstream(); @@ -354,7 +354,7 @@ public: __sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0)) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY strstream(strstream&& __rhs) : iostream(_VSTD::move(__rhs)), @@ -370,7 +370,7 @@ public: __sb_ = _VSTD::move(__rhs.__sb_); return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES virtual ~strstream(); diff --git a/include/support/fuchsia/xlocale.h b/include/support/fuchsia/xlocale.h deleted file mode 100644 index 1de2fca28..000000000 --- a/include/support/fuchsia/xlocale.h +++ /dev/null @@ -1,23 +0,0 @@ -// -*- C++ -*- -//===------------------- support/fuchsia/xlocale.h ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H -#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H - -#if defined(__Fuchsia__) - -#include -#include -#include -#include - -#endif // defined(__Fuchsia__) - -#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H diff --git a/include/support/win32/limits_msvc_win32.h b/include/support/win32/limits_win32.h similarity index 80% rename from include/support/win32/limits_msvc_win32.h rename to include/support/win32/limits_win32.h index 1ab2e0b6d..406cd3025 100644 --- a/include/support/win32/limits_msvc_win32.h +++ b/include/support/win32/limits_win32.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===------------------ support/win32/limits_msvc_win32.h -----------------===// +//===--------------------- support/win32/limits_win32.h -------------------===// // // The LLVM Compiler Infrastructure // @@ -8,21 +8,17 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H +#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H #if !defined(_LIBCPP_MSVCRT) #error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#endif -#if defined(__clang__) -#error "This header should only be included when using Microsofts C1XX frontend" -#endif +#else #include // CHAR_BIT #include // limit constants -#include // HUGE_VAL -#include // internal MSVC header providing the needed functionality +#if ! defined(__clang__) #define __CHAR_BIT__ CHAR_BIT #define __FLT_MANT_DIG__ FLT_MANT_DIG @@ -65,8 +61,19 @@ #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L // __builtin replacements/workarounds +#include // HUGE_VAL +#include // internal MSVC header providing the needed functionality +#define __builtin_huge_val() HUGE_VAL +#define __builtin_huge_valf() _FInf._Float #define __builtin_huge_vall() _LInf._Long_double +#define __builtin_nan(__dummy) _Nan._Double +#define __builtin_nanf(__dummy) _FNan._Float #define __builtin_nanl(__dummmy) _LNan._Long_double +#define __builtin_nans(__dummy) _Snan._Double +#define __builtin_nansf(__dummy) _FSnan._Float #define __builtin_nansl(__dummy) _LSnan._Long_double +#endif // ! defined(__clang__) -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H +#endif // _LIBCPP_MSVCRT + +#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H diff --git a/include/support/win32/locale_mgmt_win32.h b/include/support/win32/locale_mgmt_win32.h new file mode 100644 index 000000000..b3316d625 --- /dev/null +++ b/include/support/win32/locale_mgmt_win32.h @@ -0,0 +1,33 @@ +// -*- C++ -*- +//===----------------- support/win32/locale_mgmt_win32.h ------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H +#define _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H + +#include // _locale_t +#define locale_t _locale_t +#define LC_COLLATE_MASK _M_COLLATE +#define LC_CTYPE_MASK _M_CTYPE +#define LC_MONETARY_MASK _M_MONETARY +#define LC_NUMERIC_MASK _M_NUMERIC +#define LC_TIME_MASK _M_TIME +#define LC_MESSAGES_MASK _M_MESSAGES +#define LC_ALL_MASK ( LC_COLLATE_MASK \ + | LC_CTYPE_MASK \ + | LC_MESSAGES_MASK \ + | LC_MONETARY_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK ) +#define freelocale _free_locale +// FIXME: base currently unused. Needs manual work to construct the new locale +locale_t newlocale( int mask, const char * locale, locale_t base ); +locale_t uselocale( locale_t newloc ); + +#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_MGMT_WIN32_H diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h index b2b3ac4c7..ebf5bda74 100644 --- a/include/support/win32/locale_win32.h +++ b/include/support/win32/locale_win32.h @@ -11,31 +11,16 @@ #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H -#include <__config> +#include + +#if _VC_CRT_MAJOR_VERSION < 14 +// ctype mask table defined in msvcrt.dll +extern "C" unsigned short __declspec(dllimport) _ctype[]; +#endif + +#include "support/win32/support.h" +#include "support/win32/locale_mgmt_win32.h" #include -#include // _locale_t - -#define LC_COLLATE_MASK _M_COLLATE -#define LC_CTYPE_MASK _M_CTYPE -#define LC_MONETARY_MASK _M_MONETARY -#define LC_NUMERIC_MASK _M_NUMERIC -#define LC_TIME_MASK _M_TIME -#define LC_MESSAGES_MASK _M_MESSAGES -#define LC_ALL_MASK ( LC_COLLATE_MASK \ - | LC_CTYPE_MASK \ - | LC_MESSAGES_MASK \ - | LC_MONETARY_MASK \ - | LC_NUMERIC_MASK \ - | LC_TIME_MASK ) - -#define locale_t _locale_t - -// Locale management functions -#define freelocale _free_locale -// FIXME: base currently unused. Needs manual work to construct the new locale -locale_t newlocale( int mask, const char * locale, locale_t base ); -locale_t uselocale( locale_t newloc ); - lconv *localeconv_l( locale_t loc ); size_t mbrlen_l( const char *__restrict s, size_t n, @@ -52,21 +37,20 @@ size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); wint_t btowc_l( int c, locale_t loc ); int wctob_l( wint_t c, locale_t loc ); - -decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); +inline _LIBCPP_ALWAYS_INLINE +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) +{ + return ___mb_cur_max_l_func(__l); +} // the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+ #define mbtowc_l _mbtowc_l #define strtoll_l _strtoi64_l #define strtoull_l _strtoui64_l -#define strtod_l _strtod_l -#if defined(_LIBCPP_MSVCRT) #define strtof_l _strtof_l +#define strtod_l _strtod_l #define strtold_l _strtold_l -#else -float strtof_l(const char*, char**, locale_t); -long double strtold_l(const char*, char**, locale_t); -#endif + inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, _locale_t loc) @@ -106,9 +90,10 @@ isupper_l(int c, _locale_t loc) #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ ) #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) -_LIBCPP_FUNC_VIS int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); -_LIBCPP_FUNC_VIS int asprintf_l( char **ret, locale_t loc, const char *format, ... ); -_LIBCPP_FUNC_VIS int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); +int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); +int asprintf_l( char **ret, locale_t loc, const char *format, ... ); +int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); + // not-so-pressing FIXME: use locale to determine blank characters inline int isblank_l( int c, locale_t /*loc*/ ) @@ -120,4 +105,10 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ ) return ( c == L' ' || c == L'\t' ); } +#if defined(_LIBCPP_MSVCRT) +inline int isblank( int c, locale_t /*loc*/ ) +{ return ( c == ' ' || c == '\t' ); } +inline int iswblank( wint_t c, locale_t /*loc*/ ) +{ return ( c == L' ' || c == L'\t' ); } +#endif // _LIBCPP_MSVCRT #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H diff --git a/include/support/win32/support.h b/include/support/win32/support.h new file mode 100644 index 000000000..f9613445c --- /dev/null +++ b/include/support/win32/support.h @@ -0,0 +1,185 @@ +// -*- C++ -*- +//===----------------------- support/win32/support.h ----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H +#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H + +// Functions and constants used in libc++ that +// are missing from the Windows C library. + +#include // mbstate_t +#include // va_ macros +// "builtins" not implemented here for Clang or GCC as they provide +// implementations. Assuming required for elsewhere else, certainly MSVC. +#if defined(_LIBCPP_COMPILER_MSVC) +#include +#endif +#if defined(_LIBCPP_MSVCRT) +#include +#endif +#define swprintf _snwprintf +#define vswprintf _vsnwprintf + +#ifndef NOMINMAX +#define NOMINMAX +#endif + +// The mingw headers already define these as static. +#ifndef __MINGW32__ +extern "C" { + +int vasprintf(char **sptr, const char *__restrict fmt, va_list ap); +int asprintf(char **sptr, const char *__restrict fmt, ...); +size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, + size_t nmc, size_t len, mbstate_t *__restrict ps); +size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, + size_t nwc, size_t len, mbstate_t *__restrict ps); +} +#endif // __MINGW32__ + +#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 +#define snprintf _snprintf +#define _Exit _exit +#endif + +#if defined(_LIBCPP_COMPILER_MSVC) + +// Bit builtin's make these assumptions when calling _BitScanForward/Reverse +// etc. These assumptions are expected to be true for Win32/Win64 which this +// file supports. +static_assert(sizeof(unsigned long long) == 8, ""); +static_assert(sizeof(unsigned long) == 4, ""); +static_assert(sizeof(unsigned int) == 4, ""); + +_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) +{ + // Binary: 0101... + static const unsigned int m1 = 0x55555555; + // Binary: 00110011.. + static const unsigned int m2 = 0x33333333; + // Binary: 4 zeros, 4 ones ... + static const unsigned int m4 = 0x0f0f0f0f; + // The sum of 256 to the power of 0,1,2,3... + static const unsigned int h01 = 0x01010101; + // Put count of each 2 bits into those 2 bits. + x -= (x >> 1) & m1; + // Put count of each 4 bits into those 4 bits. + x = (x & m2) + ((x >> 2) & m2); + // Put count of each 8 bits into those 8 bits. + x = (x + (x >> 4)) & m4; + // Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24). + return (x * h01) >> 24; +} + +_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) +{ + return __builtin_popcount(static_cast(x)); +} + +_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) +{ + // Binary: 0101... + static const unsigned long long m1 = 0x5555555555555555; + // Binary: 00110011.. + static const unsigned long long m2 = 0x3333333333333333; + // Binary: 4 zeros, 4 ones ... + static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; + // The sum of 256 to the power of 0,1,2,3... + static const unsigned long long h01 = 0x0101010101010101; + // Put count of each 2 bits into those 2 bits. + x -= (x >> 1) & m1; + // Put count of each 4 bits into those 4 bits. + x = (x & m2) + ((x >> 2) & m2); + // Put count of each 8 bits into those 8 bits. + x = (x + (x >> 4)) & m4; + // Returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... + return static_cast((x * h01) >> 56); +} + +// Returns the number of trailing 0-bits in x, starting at the least significant +// bit position. If x is 0, the result is undefined. +_LIBCPP_ALWAYS_INLINE int __builtin_ctzll(unsigned long long mask) +{ + unsigned long where; +// Search from LSB to MSB for first set bit. +// Returns zero if no set bit is found. +#if defined(_LIBCPP_HAS_BITSCAN64) + (defined(_M_AMD64) || defined(__x86_64__)) + if (_BitScanForward64(&where, mask)) + return static_cast(where); +#else + // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. + // Scan the Low Word. + if (_BitScanForward(&where, static_cast(mask))) + return static_cast(where); + // Scan the High Word. + if (_BitScanForward(&where, static_cast(mask >> 32))) + return static_cast(where + 32); // Create a bit offset from the LSB. +#endif + return 64; +} + +_LIBCPP_ALWAYS_INLINE int __builtin_ctzl(unsigned long mask) +{ + unsigned long where; + // Search from LSB to MSB for first set bit. + // Returns zero if no set bit is found. + if (_BitScanForward(&where, mask)) + return static_cast(where); + return 32; +} + +_LIBCPP_ALWAYS_INLINE int __builtin_ctz(unsigned int mask) +{ + // Win32 and Win64 expectations. + static_assert(sizeof(mask) == 4, ""); + static_assert(sizeof(unsigned long) == 4, ""); + return __builtin_ctzl(static_cast(mask)); +} + +// Returns the number of leading 0-bits in x, starting at the most significant +// bit position. If x is 0, the result is undefined. +_LIBCPP_ALWAYS_INLINE int __builtin_clzll(unsigned long long mask) +{ + unsigned long where; +// BitScanReverse scans from MSB to LSB for first set bit. +// Returns 0 if no set bit is found. +#if defined(_LIBCPP_HAS_BITSCAN64) + if (_BitScanReverse64(&where, mask)) + return static_cast(63 - where); +#else + // Scan the high 32 bits. + if (_BitScanReverse(&where, static_cast(mask >> 32))) + return static_cast(63 - + (where + 32)); // Create a bit offset from the MSB. + // Scan the low 32 bits. + if (_BitScanReverse(&where, static_cast(mask))) + return static_cast(63 - where); +#endif + return 64; // Undefined Behavior. +} + +_LIBCPP_ALWAYS_INLINE int __builtin_clzl(unsigned long mask) +{ + unsigned long where; + // Search from LSB to MSB for first set bit. + // Returns zero if no set bit is found. + if (_BitScanReverse(&where, mask)) + return static_cast(31 - where); + return 32; // Undefined Behavior. +} + +_LIBCPP_ALWAYS_INLINE int __builtin_clz(unsigned int x) +{ + return __builtin_clzl(x); +} +#endif // _LIBCPP_MSVC + +#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H diff --git a/include/thread b/include/thread index 1b8dca394..94c77e0cb 100644 --- a/include/thread +++ b/include/thread @@ -95,7 +95,7 @@ void sleep_for(const chrono::duration& rel_time); #include #include #include <__mutex_base> -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS #include #endif #include <__threading_support> @@ -105,9 +105,6 @@ void sleep_for(const chrono::duration& rel_time); #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - #define __STDCPP_THREADS__ __cplusplus #ifdef _LIBCPP_HAS_NO_THREADS @@ -264,7 +261,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id> : public unary_function<__thread_id, size_t> { _LIBCPP_INLINE_VISIBILITY - size_t operator()(__thread_id __v) const _NOEXCEPT + size_t operator()(__thread_id __v) const { return hash<__libcpp_thread_id>()(__v.__id_); } @@ -294,7 +291,7 @@ public: _LIBCPP_INLINE_VISIBILITY thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp&& __f, _Args&&... __args); -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS explicit thread(_Fp __f); #endif ~thread(); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;} _LIBCPP_INLINE_VISIBILITY thread& operator=(thread&& __t) _NOEXCEPT; -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);} @@ -332,7 +329,7 @@ public: static unsigned hardware_concurrency() _NOEXCEPT; }; -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS template inline _LIBCPP_INLINE_VISIBILITY @@ -372,18 +369,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) __throw_system_error(__ec, "thread constructor failed"); } -inline -thread& -thread::operator=(thread&& __t) _NOEXCEPT -{ - if (!__libcpp_thread_isnull(&__t_)) - terminate(); - __t_ = __t.__t_; - __t.__t_ = _LIBCPP_NULL_THREAD; - return *this; -} - -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_VARIADICS template struct __thread_invoke_pair { @@ -418,7 +404,22 @@ thread::thread(_Fp __f) __throw_system_error(__ec, "thread constructor failed"); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +inline +thread& +thread::operator=(thread&& __t) _NOEXCEPT +{ + if (!__libcpp_thread_isnull(&__t_)) + terminate(); + __t_ = __t.__t_; + __t.__t_ = _LIBCPP_NULL_THREAD; + return *this; +} + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES inline _LIBCPP_INLINE_VISIBILITY void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);} @@ -479,6 +480,4 @@ _LIBCPP_END_NAMESPACE_STD #endif // !_LIBCPP_HAS_NO_THREADS -_LIBCPP_POP_MACROS - #endif // _LIBCPP_THREAD diff --git a/include/tuple b/include/tuple index aa4713faf..f2a747219 100644 --- a/include/tuple +++ b/include/tuple @@ -148,7 +148,7 @@ template _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_VARIADICS // __tuple_leaf @@ -169,7 +169,7 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) template class __tuple_leaf { - _Hp __value_; + _Hp value; template static constexpr bool __can_bind_reference() { @@ -188,28 +188,28 @@ class __tuple_leaf __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() - _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : __value_() + _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) - : __value_() + : value() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) - : __value_(allocator_arg_t(), __a) + : value(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) - : __value_(__a) + : value(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} @@ -223,28 +223,28 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) - : __value_(_VSTD::forward<_Tp>(__t)) + : value(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) - : __value_(_VSTD::forward<_Tp>(__t)) + : value(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) - : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) + : value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) - : __value_(_VSTD::forward<_Tp>(__t), __a) + : value(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} @@ -256,7 +256,7 @@ public: __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { - __value_ = _VSTD::forward<_Tp>(__t); + value = _VSTD::forward<_Tp>(__t); return *this; } @@ -267,8 +267,8 @@ public: return 0; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;} }; template @@ -473,9 +473,9 @@ struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp. template class _LIBCPP_TEMPLATE_VIS tuple { - typedef __tuple_impl::type, _Tp...> _BaseT; + typedef __tuple_impl::type, _Tp...> base; - _BaseT __base_; + base base_; #if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION) static constexpr bool _EnableImplicitReducedArityExtension = true; @@ -628,7 +628,7 @@ public: >::type> _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) - : __base_(allocator_arg_t(), __a, + : base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices::type(), __tuple_types<_Tp...>()) {} @@ -644,7 +644,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : __base_(typename __make_tuple_indices::type(), + : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), @@ -662,7 +662,7 @@ public: > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) - : __base_(typename __make_tuple_indices::type(), + : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), @@ -680,7 +680,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : __base_(allocator_arg_t(), __a, + : base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), @@ -700,7 +700,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) - : __base_(allocator_arg_t(), __a, + : base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), @@ -727,7 +727,7 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible<_BaseT, + is_nothrow_constructible::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -735,7 +735,7 @@ public: _Up... >::value )) - : __base_(typename __make_tuple_indices::type(), + : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), @@ -760,7 +760,7 @@ public: explicit tuple(_Up&&... __u) _NOEXCEPT_(( - is_nothrow_constructible<_BaseT, + is_nothrow_constructible::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, @@ -768,7 +768,7 @@ public: _Up... >::value )) - : __base_(typename __make_tuple_indices::type(), + : base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), @@ -786,7 +786,7 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : __base_(allocator_arg_t(), __a, + : base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -806,7 +806,7 @@ public: _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) - : __base_(allocator_arg_t(), __a, + : base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), @@ -824,8 +824,8 @@ public: >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) - : __base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) + : base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit - tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) - : __base_(_VSTD::forward<_Tuple>(__t)) {} + tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible::value)) + : base_(_VSTD::forward<_Tuple>(__t)) {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) - : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} + : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} template (__t)) {} + : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; @@ -876,7 +876,7 @@ public: tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::value...>::value)) { - __base_.operator=(__t.__base_); + base_.operator=(__t.base_); return *this; } @@ -884,7 +884,7 @@ public: tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all::value...>::value)) { - __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); + base_.operator=(static_cast(__t.base_)); return *this; } @@ -896,15 +896,15 @@ public: > _LIBCPP_INLINE_VISIBILITY tuple& - operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) + operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable::value)) { - __base_.operator=(_VSTD::forward<_Tuple>(__t)); + base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) - {__base_.swap(__t.__base_);} + {base_.swap(__t.base_);} }; template <> @@ -948,7 +948,7 @@ typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); + return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get(); } template @@ -957,7 +957,7 @@ const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; - return static_cast&>(__t.__base_).get(); + return static_cast&>(__t.base_).get(); } template @@ -967,7 +967,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); + static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get()); } template @@ -977,7 +977,7 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( - static_cast&&>(__t.__base_).get()); + static_cast&&>(__t.base_).get()); } #if _LIBCPP_STD_VER > 11 @@ -1345,6 +1345,9 @@ template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; +#endif // _LIBCPP_HAS_NO_VARIADICS + +#ifndef _LIBCPP_CXX03_LANG template template inline _LIBCPP_INLINE_VISIBILITY @@ -1355,6 +1358,7 @@ pair<_T1, _T2>::pair(piecewise_construct_t, second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template @@ -1400,8 +1404,6 @@ _LIBCPP_NOEXCEPT_RETURN( #endif // _LIBCPP_STD_VER > 14 -#endif // !defined(_LIBCPP_CXX03_LANG) - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TUPLE diff --git a/include/type_traits b/include/type_traits index 9db4d6614..3aa84605a 100644 --- a/include/type_traits +++ b/include/type_traits @@ -97,7 +97,6 @@ namespace std template struct is_polymorphic; template struct is_abstract; template struct is_final; // C++14 - template struct is_aggregate; // C++17 template struct is_constructible; template struct is_default_constructible; @@ -287,8 +286,6 @@ namespace std = is_abstract::value; // C++17 template constexpr bool is_final_v = is_final::value; // C++17 - template constexpr bool is_aggregate_v - = is_aggregate::value; // C++17 template constexpr bool is_signed_v = is_signed::value; // C++17 template constexpr bool is_unsigned_v @@ -1275,13 +1272,11 @@ template using remove_all_extents_t = typename remove_all_extents<_T // decay -template -struct __decay { - typedef typename remove_cv<_Up>::type type; -}; - -template -struct __decay<_Up, true> { +template +struct _LIBCPP_TEMPLATE_VIS decay +{ +private: + typedef typename remove_reference<_Tp>::type _Up; public: typedef typename conditional < @@ -1296,15 +1291,6 @@ public: >::type type; }; -template -struct _LIBCPP_TEMPLATE_VIS decay -{ -private: - typedef typename remove_reference<_Tp>::type _Up; -public: - typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type; -}; - #if _LIBCPP_STD_VER > 11 template using decay_t = typename decay<_Tp>::type; #endif @@ -1339,19 +1325,6 @@ template _LIBCPP_CONSTEXPR bool is_final_v = is_final<_Tp>::value; #endif -// is_aggregate -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) - -template struct _LIBCPP_TEMPLATE_VIS -is_aggregate : public integral_constant {}; - -#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) -template -constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; -#endif - -#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) - // is_base_of #ifdef _LIBCPP_HAS_IS_BASE_OF @@ -1981,18 +1954,11 @@ public: typedef typename common_type::type, _Vp>::type type; }; -template <> -struct _LIBCPP_TEMPLATE_VIS common_type -{ -public: - typedef void type; -}; - template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void> { public: - typedef typename common_type<_Tp, _Tp>::type type; + typedef typename decay<_Tp>::type type; }; template @@ -2014,7 +1980,9 @@ struct _LIBCPP_TEMPLATE_VIS common_type {}; template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> - : public common_type<_Tp, _Tp> {}; +{ + typedef typename decay<_Tp>::type type; +}; // bullet 3 - sizeof...(Tp) == 2 @@ -4739,35 +4707,4 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 -// std::byte -namespace std // purposefully not versioned -{ -template - constexpr typename enable_if, byte>::type & - operator<<=(byte& __lhs, _Integer __shift) noexcept - { return __lhs = byte(static_cast(__lhs) << __shift); } - -template - constexpr typename enable_if, byte>::type - operator<< (byte __lhs, _Integer __shift) noexcept - { return byte(static_cast(__lhs) << __shift); } - -template - constexpr typename enable_if, byte>::type & - operator>>=(byte& __lhs, _Integer __shift) noexcept - { return __lhs = byte(static_cast(__lhs) >> __shift); } - -template - constexpr typename enable_if, byte>::type - operator>> (byte __lhs, _Integer __shift) noexcept - { return byte(static_cast(__lhs) >> __shift); } - -template - constexpr typename enable_if, _Integer>::type - to_integer(byte __b) noexcept { return _Integer(__b); } - -} -#endif - #endif // _LIBCPP_TYPE_TRAITS diff --git a/include/typeinfo b/include/typeinfo index 8624b3497..4145ac1a3 100644 --- a/include/typeinfo +++ b/include/typeinfo @@ -108,7 +108,6 @@ protected: #endif public: - _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE virtual ~type_info(); #if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO) diff --git a/include/unordered_map b/include/unordered_map index 0546c0e2f..3f3808c1e 100644 --- a/include/unordered_map +++ b/include/unordered_map @@ -404,7 +404,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { using _VSTD::swap; - swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y)); + swap(static_cast(*this), static_cast(__y)); } }; @@ -475,7 +475,7 @@ public: _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { using _VSTD::swap; - swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y)); + swap(static_cast(*this), static_cast(__y)); } }; @@ -547,7 +547,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(__hash_node_destructor&& __x) _NOEXCEPT @@ -557,7 +557,7 @@ public: { __x.__value_constructed = false; } -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __hash_map_node_destructor(const __hash_node_destructor& __x) : __na_(__x.__na_), @@ -566,7 +566,7 @@ public: { const_cast(__x.__value_constructed) = false; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -819,18 +819,20 @@ public: explicit unordered_map(const allocator_type& __a); unordered_map(const unordered_map& __u); unordered_map(const unordered_map& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_map(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_map(unordered_map&& __u, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_map(initializer_list __il); unordered_map(initializer_list __il, size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); unordered_map(initializer_list __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_map(size_type __n, const allocator_type& __a) @@ -873,13 +875,15 @@ public: #endif return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(unordered_map&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_map& operator=(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -924,11 +928,13 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY pair insert(value_type&& __x) {return __table_.__insert_unique(_VSTD::move(__x));} @@ -1072,7 +1078,7 @@ public: // FIXME: Add debug mode checking for the iterator input return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; } -#endif // _LIBCPP_STD_VER > 14 +#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} @@ -1271,7 +1277,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1308,6 +1314,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( #endif } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( initializer_list __il) @@ -1344,6 +1354,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map( insert(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1354,6 +1368,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u) return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1364,7 +1382,22 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifdef _LIBCPP_CXX03_LANG +template +typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) +{ + __node_allocator& __na = __table_.__node_alloc(); + __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); + __h.get_deleter().__first_constructed = true; + __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); + __h.get_deleter().__second_constructed = true; + return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 +} +#endif template template @@ -1377,7 +1410,20 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, __table_.__insert_unique(*__first); } -#ifndef _LIBCPP_CXX03_LANG +#ifdef _LIBCPP_CXX03_LANG +template +_Tp& +unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) +{ + iterator __i = find(__k); + if (__i != end()) + return __i->second; + __node_holder __h = __construct_node_with_key(__k); + pair __r = __table_.__node_insert_unique(__h.get()); + __h.release(); + return __r.first->second; +} +#else template _Tp& @@ -1396,35 +1442,8 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k) std::piecewise_construct, std::forward_as_tuple(std::move(__k)), std::forward_as_tuple()).first->__cc.second; } -#else // _LIBCPP_CXX03_LANG -template -typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k) -{ - __node_allocator& __na = __table_.__node_alloc(); - __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k); - __h.get_deleter().__first_constructed = true; - __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second)); - __h.get_deleter().__second_constructed = true; - return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03 -} - -template -_Tp& -unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k) -{ - iterator __i = find(__k); - if (__i != end()) - return __i->second; - __node_holder __h = __construct_node_with_key(__k); - pair __r = __table_.__node_insert_unique(__h.get()); - __h.release(); - return __r.first->second; -} - -#endif // _LIBCPP_CXX03_MODE +#endif // !_LIBCPP_CXX03_MODE template _Tp& @@ -1567,11 +1586,13 @@ public: explicit unordered_multimap(const allocator_type& __a); unordered_multimap(const unordered_multimap& __u); unordered_multimap(const unordered_multimap& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_multimap(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multimap(unordered_multimap&& __u, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multimap(initializer_list __il); unordered_multimap(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -1579,7 +1600,7 @@ public: unordered_multimap(initializer_list __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_STD_VER > 11 _LIBCPP_INLINE_VISIBILITY unordered_multimap(size_type __n, const allocator_type& __a) @@ -1622,13 +1643,15 @@ public: #endif return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(unordered_multimap&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_multimap& operator=(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -1665,10 +1688,13 @@ public: _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void insert(initializer_list __il) {insert(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} @@ -1886,7 +1912,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1925,6 +1951,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( #endif } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( initializer_list __il) @@ -1961,6 +1991,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap( insert(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1971,6 +2005,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& @@ -1981,7 +2019,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS diff --git a/include/unordered_set b/include/unordered_set index a14fb0004..fc53c8271 100644 --- a/include/unordered_set +++ b/include/unordered_set @@ -408,11 +408,13 @@ public: explicit unordered_set(const allocator_type& __a); unordered_set(const unordered_set& __u); unordered_set(const unordered_set& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_set(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_set(unordered_set&& __u, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_set(initializer_list __il); unordered_set(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -430,7 +432,7 @@ public: const hasher& __hf, const allocator_type& __a) : unordered_set(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // ~unordered_set() = default; _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(const unordered_set& __u) @@ -438,13 +440,15 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(unordered_set&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY unordered_set& operator=(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -470,7 +474,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template _LIBCPP_INLINE_VISIBILITY pair emplace(_Args&&... __args) @@ -489,31 +493,15 @@ public: iterator emplace_hint(const_iterator, _Args&&... __args) {return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;} #endif - - _LIBCPP_INLINE_VISIBILITY - pair insert(value_type&& __x) - {return __table_.__insert_unique(_VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_DEBUG_LEVEL >= 2 - iterator insert(const_iterator __p, value_type&& __x) - { - _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, - "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" - " referring to this unordered_set"); - return insert(_VSTD::move(__x)).first; - } -#else - iterator insert(const_iterator, value_type&& __x) - {return insert(_VSTD::move(__x)).first;} -#endif - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY pair insert(const value_type& __x) {return __table_.__insert_unique(__x);} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + pair insert(value_type&& __x) + {return __table_.__insert_unique(_VSTD::move(__x));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_DEBUG_LEVEL >= 2 iterator insert(const_iterator __p, const value_type& __x) @@ -527,9 +515,29 @@ public: iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;} #endif +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY +#if _LIBCPP_DEBUG_LEVEL >= 2 + iterator insert(const_iterator __p, value_type&& __x) + { + _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this, + "unordered_set::insert(const_iterator, value_type&&) called with an iterator not" + " referring to this unordered_set"); + return insert(_VSTD::move(__x)).first; + } +#else + iterator insert(const_iterator, value_type&& __x) + {return insert(_VSTD::move(__x)).first;} +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -709,7 +717,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -744,6 +752,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( #endif } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( initializer_list __il) @@ -780,6 +792,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set( insert(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -790,6 +806,10 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u) return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline unordered_set<_Value, _Hash, _Pred, _Alloc>& @@ -800,7 +820,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template @@ -929,11 +949,13 @@ public: explicit unordered_multiset(const allocator_type& __a); unordered_multiset(const unordered_multiset& __u); unordered_multiset(const unordered_multiset& __u, const allocator_type& __a); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_multiset(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_constructible<__table>::value); unordered_multiset(unordered_multiset&& __u, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset(initializer_list __il); unordered_multiset(initializer_list __il, size_type __n, const hasher& __hf = hasher(), @@ -949,7 +971,7 @@ public: unordered_multiset(initializer_list __il, size_type __n, const hasher& __hf, const allocator_type& __a) : unordered_multiset(__il, __n, __hf, key_equal(), __a) {} #endif -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // ~unordered_multiset() = default; _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(const unordered_multiset& __u) @@ -957,12 +979,14 @@ public: __table_ = __u.__table_; return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY unordered_multiset& operator=(unordered_multiset&& __u) _NOEXCEPT_(is_nothrow_move_assignable<__table>::value); +#endif +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS unordered_multiset& operator=(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -988,7 +1012,7 @@ public: _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __table_.end();} -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template _LIBCPP_INLINE_VISIBILITY iterator emplace(_Args&&... __args) @@ -997,27 +1021,29 @@ public: _LIBCPP_INLINE_VISIBILITY iterator emplace_hint(const_iterator __p, _Args&&... __args) {return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} - - _LIBCPP_INLINE_VISIBILITY - iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY - iterator insert(const_iterator __p, value_type&& __x) - {return __table_.__insert_multi(__p, _VSTD::move(__x));} - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list __il) - {insert(__il.begin(), __il.end());} -#endif // _LIBCPP_CXX03_LANG - +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));} +#endif _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, const value_type& __x) {return __table_.__insert_multi(__p, __x);} - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + iterator insert(const_iterator __p, value_type&& __x) + {return __table_.__insert_multi(__p, _VSTD::move(__x));} +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list __il) + {insert(__il.begin(), __il.end());} +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p);} @@ -1198,7 +1224,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__u.begin(), __u.end()); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1233,6 +1259,10 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( #endif } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( initializer_list __il) @@ -1269,6 +1299,10 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset( insert(__il.begin(), __il.end()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1280,6 +1314,10 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline unordered_multiset<_Value, _Hash, _Pred, _Alloc>& @@ -1290,7 +1328,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=( return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template template diff --git a/include/utility b/include/utility index be7320713..1f41c0771 100644 --- a/include/utility +++ b/include/utility @@ -272,14 +272,14 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typename conditional < !is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&& >::type -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES const _Tp& #endif move_if_noexcept(_Tp& __x) _NOEXCEPT @@ -293,7 +293,7 @@ template void as_const(const _Tp&&) = delete; #endif struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_UTILITY) +#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY) extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); #else constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); @@ -608,7 +608,8 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) __x.swap(__y); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template struct __make_pair_return_impl @@ -637,7 +638,7 @@ make_pair(_T1&& __t1, _T2&& __t2) (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); } -#else // _LIBCPP_CXX03_LANG +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -647,7 +648,7 @@ make_pair(_T1 __x, _T2 __y) return pair<_T1, _T2>(__x, __y); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template class _LIBCPP_TEMPLATE_VIS tuple_size > @@ -684,7 +685,8 @@ struct __get_pair<0> const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -696,7 +698,8 @@ struct __get_pair<0> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T1&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.first);} -#endif // _LIBCPP_CXX03_LANG + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; template <> @@ -714,7 +717,8 @@ struct __get_pair<1> const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template static _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -726,7 +730,8 @@ struct __get_pair<1> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _T2&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward(__p.second);} -#endif // _LIBCPP_CXX03_LANG + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }; template @@ -745,7 +750,8 @@ get(const pair<_T1, _T2>& __p) _NOEXCEPT return __get_pair<_Ip>::get(__p); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& @@ -761,7 +767,8 @@ get(const pair<_T1, _T2>&& __p) _NOEXCEPT { return __get_pair<_Ip>::get(_VSTD::move(__p)); } -#endif // _LIBCPP_CXX03_LANG + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #if _LIBCPP_STD_VER > 11 template @@ -899,7 +906,7 @@ inline constexpr in_place_t in_place{}; template -struct _LIBCPP_TEMPLATE_VIS in_place_type_t { +struct _LIBCPP_TYPE_VIS in_place_type_t { explicit in_place_type_t() = default; }; template diff --git a/include/valarray b/include/valarray index ee61238a9..f0f1f62a1 100644 --- a/include/valarray +++ b/include/valarray @@ -347,14 +347,12 @@ template unspecified2 end(const valarray& v); #include #include +#include <__undef_min_max> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template class _LIBCPP_TEMPLATE_VIS valarray; @@ -809,11 +807,13 @@ public: valarray(const value_type& __x, size_t __n); valarray(const value_type* __p, size_t __n); valarray(const valarray& __v); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY valarray(valarray&& __v) _NOEXCEPT; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray(initializer_list __il); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS valarray(const slice_array& __sa); valarray(const gslice_array& __ga); valarray(const mask_array& __ma); @@ -823,12 +823,14 @@ public: // assignment: valarray& operator=(const valarray& __v); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY valarray& operator=(valarray&& __v) _NOEXCEPT; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY valarray& operator=(initializer_list); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY valarray& operator=(const value_type& __x); _LIBCPP_INLINE_VISIBILITY @@ -859,32 +861,32 @@ public: __val_expr<__indirect_expr > operator[](const gslice& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array operator[](const gslice& __gs); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](gslice&& __gs) const; _LIBCPP_INLINE_VISIBILITY gslice_array operator[](gslice&& __gs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr > operator[](const valarray& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array operator[](const valarray& __vb); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __val_expr<__mask_expr > operator[](valarray&& __vb) const; _LIBCPP_INLINE_VISIBILITY mask_array operator[](valarray&& __vb); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](const valarray& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array operator[](const valarray& __vs); -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __val_expr<__indirect_expr > operator[](valarray&& __vs) const; _LIBCPP_INLINE_VISIBILITY indirect_array operator[](valarray&& __vs); -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES // unary operators: valarray operator+() const; @@ -1478,7 +1480,7 @@ public: __stride_(__stride) {__init(__start);} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY gslice(size_t __start, const valarray& __size, @@ -1501,7 +1503,7 @@ public: __stride_(move(__stride)) {__init(__start);} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES // gslice(const gslice&) = default; // gslice(gslice&&) = default; @@ -1654,12 +1656,12 @@ private: __1d_(__gs.__1d_) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES gslice_array(gslice&& __gs, const valarray& __v) : __vp_(const_cast(__v.__begin_)), __1d_(move(__gs.__1d_)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template friend class valarray; }; @@ -2351,7 +2353,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY indirect_array(valarray&& __ia, const valarray& __v) @@ -2359,7 +2361,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template friend class valarray; }; @@ -2570,7 +2572,7 @@ private: __1d_(__ia) {} -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY __indirect_expr(valarray&& __ia, const _RmExpr& __e) @@ -2578,7 +2580,7 @@ private: __1d_(move(__ia)) {} -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES public: _LIBCPP_INLINE_VISIBILITY @@ -2812,7 +2814,7 @@ valarray<_Tp>::valarray(const valarray& __v) } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -2823,6 +2825,10 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT __v.__begin_ = __v.__end_ = nullptr; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template valarray<_Tp>::valarray(initializer_list __il) : __begin_(0), @@ -2849,7 +2855,7 @@ valarray<_Tp>::valarray(initializer_list __il) } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template valarray<_Tp>::valarray(const slice_array& __sa) @@ -2984,7 +2990,7 @@ valarray<_Tp>::operator=(const valarray& __v) return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -2999,6 +3005,10 @@ valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT return *this; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline valarray<_Tp>& @@ -3010,7 +3020,7 @@ valarray<_Tp>::operator=(initializer_list __il) return *this; } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template inline @@ -3122,7 +3132,7 @@ valarray<_Tp>::operator[](const gslice& __gs) return gslice_array(__gs, *this); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3140,7 +3150,7 @@ valarray<_Tp>::operator[](gslice&& __gs) return gslice_array(move(__gs), *this); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3158,7 +3168,7 @@ valarray<_Tp>::operator[](const valarray& __vb) return mask_array(__vb, *this); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3176,7 +3186,7 @@ valarray<_Tp>::operator[](valarray&& __vb) return mask_array(move(__vb), *this); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3194,7 +3204,7 @@ valarray<_Tp>::operator[](const valarray& __vs) return indirect_array(__vs, *this); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -3212,7 +3222,7 @@ valarray<_Tp>::operator[](valarray&& __vs) return indirect_array(move(__vs), *this); } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template valarray<_Tp> @@ -4867,6 +4877,4 @@ end(const valarray<_Tp>& __v) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_VALARRAY diff --git a/include/variant b/include/variant index 8505f3262..099e6c358 100644 --- a/include/variant +++ b/include/variant @@ -53,16 +53,16 @@ namespace std { // 20.7.2.4, modifiers template - T& emplace(Args&&...); + void emplace(Args&&...); template - T& emplace(initializer_list, Args&&...); + void emplace(initializer_list, Args&&...); template - variant_alternative_t& emplace(Args&&...); + void emplace(Args&&...); template - variant_alternative_t& emplace(initializer_list, Args&&...); + void emplace(initializer_list, Args&&...); // 20.7.2.5, value status constexpr bool valueless_by_exception() const noexcept; @@ -358,6 +358,7 @@ struct __traits { static constexpr _Trait __copy_assignable_trait = __common_trait( {__copy_constructible_trait, + __move_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...}); static constexpr _Trait __move_assignable_trait = __common_trait( @@ -424,21 +425,30 @@ struct __base { constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); - return __at(__fmatrix, __vs.index()...)( - _VSTD::forward<_Visitor>(__visitor), - _VSTD::forward<_Vs>(__vs).__as_base()...); + const size_t __indices[] = {__vs.index()...}; + return __at(__fmatrix, __indices)(_VSTD::forward<_Visitor>(__visitor), + _VSTD::forward<_Vs>(__vs).__as_base()...); } private: template inline _LIBCPP_INLINE_VISIBILITY - static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; } + static constexpr const _Tp& __at_impl(const _Tp& __elem, const size_t*) { + return __elem; + } - template + template + inline _LIBCPP_INLINE_VISIBILITY + static constexpr auto&& __at_impl(const array<_Tp, _Np>& __elems, + const size_t* __index) { + return __at_impl(__elems[*__index], __index + 1); + } + + template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __at(const array<_Tp, _Np>& __elems, - size_t __index, _Indices... __indices) { - return __at(__elems[__index], __indices...); + const size_t (&__indices)[_Ip]) { + return __at_impl(__elems, begin(__indices)); } template @@ -754,10 +764,9 @@ public: protected: template inline _LIBCPP_INLINE_VISIBILITY - static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { - ::new ((void*)_VSTD::addressof(__a)) + static void __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { + ::new (_VSTD::addressof(__a)) __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...); - return __a.__value; } template @@ -867,33 +876,33 @@ public: template inline _LIBCPP_INLINE_VISIBILITY - auto& __emplace(_Args&&... __args) { + void __emplace(_Args&&... __args) { this->__destroy(); - auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), + this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), _VSTD::forward<_Args>(__args)...); this->__index = _Ip; - return __res; } protected: - template + template inline _LIBCPP_INLINE_VISIBILITY - void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) { + void __assign_alt(__alt<_Ip, _Tp>& __a, + _Arg&& __arg, + bool_constant<_CopyAssign> __tag) { if (this->index() == _Ip) { __a.__value = _VSTD::forward<_Arg>(__arg); } else { struct { void operator()(true_type) const { - __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); + __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); } void operator()(false_type) const { - __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); + __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); } __assignment* __this; _Arg&& __arg; } __impl{this, _VSTD::forward<_Arg>(__arg)}; - __impl(bool_constant || - !is_nothrow_move_constructible_v<_Tp>>{}); + __impl(__tag); } } @@ -910,7 +919,8 @@ protected: [this](auto& __this_alt, auto&& __that_alt) { this->__assign_alt( __this_alt, - _VSTD::forward(__that_alt).__value); + _VSTD::forward(__that_alt).__value, + is_lvalue_reference<_That>{}); }, *this, _VSTD::forward<_That>(__that)); } @@ -1010,7 +1020,8 @@ public: inline _LIBCPP_INLINE_VISIBILITY void __assign(_Arg&& __arg) { this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), - _VSTD::forward<_Arg>(__arg)); + _VSTD::forward<_Arg>(__arg), + false_type{}); } inline _LIBCPP_INLINE_VISIBILITY @@ -1084,6 +1095,7 @@ class _LIBCPP_TEMPLATE_VIS variant __all...>::value>, private __sfinae_assign_base< __all<(is_copy_constructible_v<_Types> && + is_move_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value, __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> { @@ -1126,7 +1138,7 @@ public: : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template , + enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY @@ -1206,8 +1218,8 @@ public: class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(_Args&&... __args) { - return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + void emplace(_Args&&... __args) { + __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < @@ -1219,8 +1231,8 @@ public: enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { - return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + void emplace(initializer_list<_Up> __il, _Args&&... __args) { + __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } template < @@ -1230,8 +1242,8 @@ public: __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(_Args&&... __args) { - return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); + void emplace(_Args&&... __args) { + __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < @@ -1243,8 +1255,8 @@ public: enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY - _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { - return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); + void emplace(initializer_list<_Up> __il, _Args&&... __args) { + __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } inline _LIBCPP_INLINE_VISIBILITY @@ -1550,7 +1562,7 @@ struct _LIBCPP_TEMPLATE_VIS hash { using result_type = size_t; inline _LIBCPP_INLINE_VISIBILITY - result_type operator()(const argument_type&) const _NOEXCEPT { + result_type operator()(const argument_type&) const { return 66740831; // return a fundamentally attractive random value. } }; diff --git a/include/vector b/include/vector index ee19fb708..ded057b10 100644 --- a/include/vector +++ b/include/vector @@ -275,16 +275,14 @@ void swap(vector& x, vector& y) #include <__split_buffer> #include <__functional_base> +#include <__undef_min_max> + #include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - _LIBCPP_BEGIN_NAMESPACE_STD template @@ -415,10 +413,8 @@ inline _LIBCPP_INLINE_VISIBILITY void __vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT { - pointer __soon_to_be_end = __end_; - while (__new_last != __soon_to_be_end) - __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); - __end_ = __new_last; + while (__new_last != __end_) + __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_)); } template @@ -529,7 +525,12 @@ public: is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0); - +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + _LIBCPP_INLINE_VISIBILITY + vector(initializer_list __il); + _LIBCPP_INLINE_VISIBILITY + vector(initializer_list __il, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY ~vector() @@ -542,14 +543,7 @@ public: vector(const vector& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); - -#ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY - vector(initializer_list __il); - - _LIBCPP_INLINE_VISIBILITY - vector(initializer_list __il, const allocator_type& __a); - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY vector(vector&& __x) #if _LIBCPP_STD_VER > 14 @@ -557,18 +551,17 @@ public: #else _NOEXCEPT_(is_nothrow_move_constructible::value); #endif - _LIBCPP_INLINE_VISIBILITY vector(vector&& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template typename enable_if @@ -593,12 +586,11 @@ public: assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const_reference __u); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT @@ -682,10 +674,9 @@ public: {return _VSTD::__to_raw_pointer(this->__begin_);} _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); - +#ifndef _LIBCPP_HAS_NO_VARIADICS template _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_STD_VER > 14 @@ -693,19 +684,19 @@ public: #else void emplace_back(_Args&&... __args); #endif -#endif // !_LIBCPP_CXX03_LANG - +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES iterator insert(const_iterator __position, value_type&& __x); +#ifndef _LIBCPP_HAS_NO_VARIADICS template iterator emplace(const_iterator __position, _Args&&... __args); -#endif // !_LIBCPP_CXX03_LANG - +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES iterator insert(const_iterator __position, size_type __n, const_reference __x); template typename enable_if @@ -728,12 +719,11 @@ public: iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} -#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); @@ -806,16 +796,18 @@ private: __base::__destruct_at_end(__new_last); __annotate_shrink(__old_size); } - -#ifndef _LIBCPP_CXX03_LANG - template void __push_back_slow_path(_Up&& __x); - - template - void __emplace_back_slow_path(_Args&&... __args); + template + void +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + __push_back_slow_path(_Up&& __x); #else - template void __push_back_slow_path(_Up& __x); + __push_back_slow_path(_Up& __x); +#endif +#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) + template + 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. @@ -1225,7 +1217,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a) } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1272,6 +1264,8 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) } } +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>::vector(initializer_list __il) @@ -1301,6 +1295,8 @@ vector<_Tp, _Allocator>::vector(initializer_list __il, const allocat } } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + template inline _LIBCPP_INLINE_VISIBILITY vector<_Tp, _Allocator>& @@ -1342,7 +1338,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) #endif } -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1564,7 +1560,7 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT template template void -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x) #else vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x) @@ -1595,7 +1591,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x) __push_back_slow_path(__x); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -1615,6 +1611,8 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x) __push_back_slow_path(_VSTD::move(__x)); } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template void @@ -1654,7 +1652,8 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args) #endif } -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline @@ -1759,7 +1758,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x) return __make_iter(__p); } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename vector<_Tp, _Allocator>::iterator @@ -1798,6 +1797,8 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x) return __make_iter(__p); } +#ifndef _LIBCPP_HAS_NO_VARIADICS + template template typename vector<_Tp, _Allocator>::iterator @@ -1837,7 +1838,8 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args) return __make_iter(__p); } -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_VARIADICS +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename vector<_Tp, _Allocator>::iterator @@ -2034,7 +2036,7 @@ vector<_Tp, _Allocator>::swap(vector& __x) _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__end_, __x.__end_); _VSTD::swap(this->__end_cap(), __x.__end_cap()); - __swap_allocator(this->__alloc(), __x.__alloc(), + __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant()); #if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__x); @@ -2229,11 +2231,12 @@ public: vector(const vector& __v); vector(const vector& __v, const allocator_type& __a); vector& operator=(const vector& __v); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS vector(initializer_list __il); vector(initializer_list __il, const allocator_type& __a); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY vector(vector&& __v) #if _LIBCPP_STD_VER > 14 @@ -2245,12 +2248,12 @@ public: _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); - +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list __il) {assign(__il.begin(), __il.end()); return *this;} - -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template typename enable_if @@ -2269,12 +2272,11 @@ public: assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const value_type& __x); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY void assign(initializer_list __il) {assign(__il.begin(), __il.end());} -#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return allocator_type(this->__alloc());} @@ -2383,12 +2385,11 @@ public: iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last); - -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list __il) {return insert(__position, __il.begin(), __il.end());} -#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); @@ -2748,7 +2749,7 @@ vector::vector(_ForwardIterator __first, _ForwardIterator __la } } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template vector::vector(initializer_list __il) @@ -2778,7 +2779,7 @@ vector::vector(initializer_list __il, const alloca } } -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template vector::~vector() @@ -2835,7 +2836,7 @@ vector::operator=(const vector& __v) return *this; } -#ifndef _LIBCPP_CXX03_LANG +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY @@ -2910,7 +2911,7 @@ vector::__move_assign(vector& __c, true_type) __c.__cap() = __c.__size_ = 0; } -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template void @@ -3200,7 +3201,7 @@ vector::swap(vector& __x) _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__size_, __x.__size_); _VSTD::swap(this->__cap(), __x.__cap()); - __swap_allocator(this->__alloc(), __x.__alloc(), + __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant()); } @@ -3359,6 +3360,4 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #endif // _LIBCPP_VECTOR diff --git a/include/wchar.h b/include/wchar.h index a5666e193..c0c6ef754 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -166,12 +166,9 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD } #endif -#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE) -extern "C" { -size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src, - size_t nmc, size_t len, mbstate_t *__restrict ps); -size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src, - size_t nwc, size_t len, mbstate_t *__restrict ps); +#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)) +extern "C++" { +#include // pull in *swprintf defines } // extern "C++" #endif // __cplusplus && _LIBCPP_MSVCRT diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index fe45f5ac0..66bb14c89 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -83,12 +83,7 @@ add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread) add_library_flags_if(LIBCXX_HAS_C_LIB c) add_library_flags_if(LIBCXX_HAS_M_LIB m) add_library_flags_if(LIBCXX_HAS_RT_LIB rt) -if (LIBCXX_USE_COMPILER_RT) - find_compiler_rt_library(builtins LIBCXX_BUILTINS_LIBRARY) - add_library_flags_if(LIBCXX_BUILTINS_LIBRARY "${LIBCXX_BUILTINS_LIBRARY}") -else() - add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) -endif() +add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) # Add the unwinder library. @@ -121,7 +116,6 @@ if (LIBCXX_TARGETING_MSVC) add_library_flags(ucrt${LIB_SUFFIX}) # Universal C runtime add_library_flags(vcruntime${LIB_SUFFIX}) # C++ runtime add_library_flags(msvcrt${LIB_SUFFIX}) # C runtime startup files - add_library_flags(msvcprt${LIB_SUFFIX}) # C++ standard library. Required for exception_ptr internals. # Required for standards-complaint wide character formatting functions # (e.g. `printfw`/`scanfw`) add_library_flags(iso_stdio_wide_specifiers) @@ -156,7 +150,7 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY) "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp" "/usr/lib/libSystem.B.dylib") else() - if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "") + if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "") list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7) if (NOT OSX_HAS_ARMV7 EQUAL -1) set(OSX_RE_EXPORT_LINE @@ -168,10 +162,8 @@ if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY) endif() else() set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp") - if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS) - add_link_flags("/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi-new-delete.exp") - endif() endif() + add_link_flags( "-compatibility_version 1" "-install_name /usr/lib/libc++.1.dylib" @@ -185,7 +177,7 @@ endif() split_list(LIBCXX_COMPILE_FLAGS) split_list(LIBCXX_LINK_FLAGS) -# Add an object library that contains the compiled source files. +# Add a object library that contains the compiled source files. add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) if(WIN32 AND NOT MINGW) target_compile_definitions(cxx_objects @@ -242,13 +234,11 @@ endif() if (LIBCXX_ENABLE_STATIC) add_library(cxx_static STATIC $) target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) - set(CMAKE_STATIC_LIBRARY_PREFIX "lib") set_target_properties(cxx_static PROPERTIES LINK_FLAGS "${LIBCXX_LINK_FLAGS}" OUTPUT_NAME "c++" ) - list(APPEND LIBCXX_TARGETS "cxx_static") # Attempt to merge the libc++.a archive and the ABI library archive into one. if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) diff --git a/lib/libc++abi-new-delete.exp b/lib/libc++abi-new-delete.exp deleted file mode 100644 index a9e651dd6..000000000 --- a/lib/libc++abi-new-delete.exp +++ /dev/null @@ -1,8 +0,0 @@ -__ZdaPv -__ZdlPv -__ZdlPvRKSt9nothrow_t -__Znam -__ZdaPvRKSt9nothrow_t -__Znwm -__ZnwmRKSt9nothrow_t -__ZnamRKSt9nothrow_t diff --git a/lib/libc++abi2.exp b/lib/libc++abi2.exp index eb088f370..47dcbbb88 100644 --- a/lib/libc++abi2.exp +++ b/lib/libc++abi2.exp @@ -209,6 +209,14 @@ __ZNSt20bad_array_new_lengthC2Ev __ZNSt20bad_array_new_lengthD0Ev __ZNSt20bad_array_new_lengthD2Ev __ZSt10unexpectedv +# __ZdaPv +# __ZdlPv +# __ZdlPvRKSt9nothrow_t +# __Znam +# __ZdaPvRKSt9nothrow_t +# __Znwm +# __ZnwmRKSt9nothrow_t +# __ZnamRKSt9nothrow_t __ZTISt10bad_typeid __ZTISt8bad_cast ___cxa_bad_typeid diff --git a/src/chrono.cpp b/src/chrono.cpp index d0e184ad3..9b277a610 100644 --- a/src/chrono.cpp +++ b/src/chrono.cpp @@ -37,7 +37,7 @@ #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN #define VC_EXTRA_LEAN -#include +#include #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 #include #endif diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index 2200aefb8..3f607271b 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -14,7 +14,6 @@ #include "condition_variable" #include "thread" #include "system_error" -#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/exception.cpp b/src/exception.cpp index 4359d1261..0b502cd13 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -20,7 +20,7 @@ #if defined(_LIBCPP_ABI_MICROSOFT) #include "support/runtime/exception_msvc.ipp" -#include "support/runtime/exception_pointer_msvc.ipp" +#include "support/runtime/exception_pointer_unimplemented.ipp" #elif defined(_LIBCPPABI_VERSION) #include "support/runtime/exception_libcxxabi.ipp" #include "support/runtime/exception_pointer_cxxabi.ipp" diff --git a/src/experimental/filesystem/operations.cpp b/src/experimental/filesystem/operations.cpp index 2856ae453..bd7685819 100644 --- a/src/experimental/filesystem/operations.cpp +++ b/src/experimental/filesystem/operations.cpp @@ -513,8 +513,8 @@ bool checked_set(CType* out, ChronoType time) { return true; } -using TimeSpec = struct timespec; -using StatT = struct stat; +using TimeSpec = struct ::timespec; +using StatT = struct ::stat; #if defined(__APPLE__) TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; } diff --git a/src/functional.cpp b/src/functional.cpp deleted file mode 100644 index 5c2646f01..000000000 --- a/src/functional.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------- functional.cpp -------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include "functional" - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION -bad_function_call::~bad_function_call() _NOEXCEPT -{ -} - -const char* -bad_function_call::what() const _NOEXCEPT -{ - return "std::bad_function_call"; -} -#endif - -_LIBCPP_END_NAMESPACE_STD diff --git a/src/include/atomic_support.h b/src/include/atomic_support.h index 08847e630..378541b23 100644 --- a/src/include/atomic_support.h +++ b/src/include/atomic_support.h @@ -29,7 +29,7 @@ #endif #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) -# if defined(_LIBCPP_WARNING) +# if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") # else # warning Building libc++ without __atomic builtins is unsupported diff --git a/src/ios.cpp b/src/ios.cpp index c1d232778..5c5f241be 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -25,7 +25,6 @@ #include "new" #include "streambuf" #include "string" -#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/iostream.cpp b/src/iostream.cpp index 534b47a91..a972be954 100644 --- a/src/iostream.cpp +++ b/src/iostream.cpp @@ -15,14 +15,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_STDIN _ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?cin@__1@std@@3V?$basic_istream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdinbuf ) static char __cin[sizeof(__stdinbuf )]; static mbstate_t mb_cin; _ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?wcin@__1@std@@3V?$basic_istream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -32,14 +32,14 @@ static mbstate_t mb_wcin; #ifndef _LIBCPP_HAS_NO_STDOUT _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?cout@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; static mbstate_t mb_cout; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?wcout@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -48,14 +48,14 @@ static mbstate_t mb_wcout; #endif _ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?cerr@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A") #endif ; _ALIGNAS_TYPE (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; static mbstate_t mb_cerr; _ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] -#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) +#if defined(_MSC_VER) && defined(__clang__) __asm__("?wcerr@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A") #endif ; @@ -63,12 +63,12 @@ _ALIGNAS_TYPE (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf #include -#include "__undef_macros" // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. @@ -49,24 +48,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -struct __libcpp_unique_locale { - __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {} - - ~__libcpp_unique_locale() { - if (__loc_) - freelocale(__loc_); - } - - explicit operator bool() const { return __loc_; } - - locale_t& get() { return __loc_; } - - locale_t __loc_; -private: - __libcpp_unique_locale(__libcpp_unique_locale const&); - __libcpp_unique_locale& operator=(__libcpp_unique_locale const&); -}; - #ifdef __cloc_defined locale_t __cloc() { // In theory this could create a race condition. In practice @@ -90,8 +71,8 @@ T& make(A0 a0) { static typename aligned_storage::type buf; - auto *obj = ::new (&buf) T(a0); - return *obj; + ::new (&buf) T(a0); + return *reinterpret_cast(&buf); } template @@ -110,8 +91,8 @@ T& make(A0 a0, A1 a1, A2 a2) { static typename aligned_storage::type buf; - auto *obj = ::new (&buf) T(a0, a1, a2); - return *obj; + ::new (&buf) T(a0, a1, a2); + return *reinterpret_cast(&buf); } template @@ -502,8 +483,8 @@ locale::__imp::make_global() { // only one thread can get in here and it only gets in once static aligned_storage::type buf; - auto *obj = ::new (&buf) locale(locale::classic()); - return *obj; + ::new (&buf) locale(locale::classic()); + return *reinterpret_cast(&buf); } locale& @@ -1131,7 +1112,13 @@ ctype::classic_table() _NOEXCEPT #elif __sun__ return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#if _VC_CRT_MAJOR_VERSION < 14 + // This is assumed to be safe, which is a nonsense assumption because we're + // going to end up dereferencing it later... + return _ctype+1; // internal ctype mask table defined in msvcrt.dll +#else return __pctype_func(); +#endif #elif defined(__EMSCRIPTEN__) return *__ctype_b_loc(); #elif defined(_NEWLIB_VERSION) @@ -4207,7 +4194,7 @@ __widen_from_utf8<32>::~__widen_from_utf8() static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, - locale_t loc) { + __locale_struct* loc) { if (*ptr == '\0') return false; mbstate_t mb = {}; @@ -4222,7 +4209,7 @@ static bool checked_string_to_wchar_convert(wchar_t& dest, static bool checked_string_to_char_convert(char& dest, const char* ptr, - locale_t __loc) { + __locale_struct* __loc) { if (*ptr == '\0') return false; if (!ptr[1]) { @@ -4317,8 +4304,8 @@ numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); @@ -4355,8 +4342,8 @@ numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)); @@ -5842,8 +5829,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); @@ -5886,8 +5873,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); @@ -5946,8 +5933,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); lconv* lc = __libcpp_localeconv_l(loc.get()); @@ -6011,8 +5998,8 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; - __libcpp_unique_locale loc(nm); - if (!loc) + __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale); + if (loc == nullptr) __throw_runtime_error("moneypunct_byname" " failed to construct for " + string(nm)); diff --git a/src/memory.cpp b/src/memory.cpp index 4e0d3af91..f6f6fe8da 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -120,7 +120,7 @@ __shared_weak_count::lock() _NOEXCEPT object_owners+1)) return this; } - return nullptr; + return 0; } #if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) @@ -128,7 +128,7 @@ __shared_weak_count::lock() _NOEXCEPT const void* __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT { - return nullptr; + return 0; } #endif // _LIBCPP_NO_RTTI @@ -154,7 +154,7 @@ __sp_mut::lock() _NOEXCEPT { auto m = static_cast<__libcpp_mutex_t*>(__lx); unsigned count = 0; - while (!__libcpp_mutex_trylock(m)) + while (__libcpp_mutex_trylock(m) != 0) { if (++count > 16) { diff --git a/src/mutex.cpp b/src/mutex.cpp index c36bd5549..b858e8877 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -12,7 +12,6 @@ #include "limits" #include "system_error" #include "include/atomic_support.h" -#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS diff --git a/src/new.cpp b/src/new.cpp index 2b2682fa6..21b307401 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -183,7 +183,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC if (static_cast(alignment) < sizeof(void*)) alignment = std::align_val_t(sizeof(void*)); void* p; -#if defined(_LIBCPP_MSVCRT_LIKE) +#if defined(_LIBCPP_MSVCRT) while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) #else while (::posix_memalign(&p, static_cast(alignment), size) != 0) @@ -256,7 +256,7 @@ void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) -#if defined(_LIBCPP_MSVCRT_LIKE) +#if defined(_LIBCPP_MSVCRT) ::_aligned_free(ptr); #else ::free(ptr); diff --git a/src/string.cpp b/src/string.cpp index 6a175f221..fb85203d4 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -16,6 +16,9 @@ #include "cerrno" #include "limits" #include "stdexcept" +#ifdef _LIBCPP_MSVCRT +#include "support/win32/support.h" +#endif // _LIBCPP_MSVCRT #include _LIBCPP_BEGIN_NAMESPACE_STD @@ -430,7 +433,7 @@ get_swprintf() #ifndef _LIBCPP_MSVCRT return swprintf; #else - return static_cast(_snwprintf); + return static_cast(swprintf); #endif } diff --git a/src/strstream.cpp b/src/strstream.cpp index 01523cf45..be94f9c89 100644 --- a/src/strstream.cpp +++ b/src/strstream.cpp @@ -13,7 +13,6 @@ #include "cstring" #include "cstdlib" #include "__debug" -#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/support/runtime/exception_pointer_msvc.ipp b/src/support/runtime/exception_pointer_msvc.ipp deleted file mode 100644 index eab5d30a9..000000000 --- a/src/support/runtime/exception_pointer_msvc.ipp +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include // for _CRTIMP2_PURE - -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCreate(_Out_ void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrDestroy(_Inout_ void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCopy(_Out_ void*, - _In_ const void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL -__ExceptionPtrAssign(_Inout_ void*, _In_ const void*); -_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL -__ExceptionPtrCompare(_In_ const void*, _In_ const void*); -_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL -__ExceptionPtrToBool(_In_ const void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrSwap(_Inout_ void*, - _Inout_ void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL -__ExceptionPtrCurrentException(_Out_ void*); -[[noreturn]] _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL -__ExceptionPtrRethrow(_In_ const void*); -_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL -__ExceptionPtrCopyException(_Inout_ void*, _In_ const void*, _In_ const void*); - -namespace std { - -exception_ptr::exception_ptr() _NOEXCEPT { __ExceptionPtrCreate(this); } -exception_ptr::exception_ptr(nullptr_t) _NOEXCEPT { __ExceptionPtrCreate(this); } - -exception_ptr::exception_ptr(const exception_ptr& __other) _NOEXCEPT { - __ExceptionPtrCopy(this, &__other); -} -exception_ptr& exception_ptr::operator=(const exception_ptr& __other) _NOEXCEPT { - __ExceptionPtrAssign(this, &__other); - return *this; -} - -exception_ptr& exception_ptr::operator=(nullptr_t) _NOEXCEPT { - exception_ptr dummy; - __ExceptionPtrAssign(this, &dummy); - return *this; -} - -exception_ptr::~exception_ptr() _NOEXCEPT { __ExceptionPtrDestroy(this); } - -exception_ptr::operator bool() const _NOEXCEPT { - return __ExceptionPtrToBool(this); -} - -bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { - return __ExceptionPtrCompare(&__x, &__y); -} - - -void swap(exception_ptr& lhs, exception_ptr& rhs) _NOEXCEPT { - __ExceptionPtrSwap(&rhs, &lhs); -} - -exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { - exception_ptr __ret = nullptr; - if (__ptr) - __ExceptionPtrCopyException(&__ret, __except, __ptr); - return __ret; -} - -exception_ptr current_exception() _NOEXCEPT { - exception_ptr __ret; - __ExceptionPtrCurrentException(&__ret); - return __ret; -} - -_LIBCPP_NORETURN -void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); } - -nested_exception::nested_exception() _NOEXCEPT : __ptr_(current_exception()) {} - -nested_exception::~nested_exception() _NOEXCEPT {} - -_LIBCPP_NORETURN -void nested_exception::rethrow_nested() const { - if (__ptr_ == nullptr) - terminate(); - rethrow_exception(__ptr_); -} - -} // namespace std diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp index 13a6eaeda..ee1381117 100644 --- a/src/support/win32/locale_win32.cpp +++ b/src/support/win32/locale_win32.cpp @@ -13,14 +13,16 @@ #include #include -using std::__libcpp_locale_guard; +#include + +typedef _VSTD::remove_pointer::type __locale_struct; +typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii; // FIXME: base currently unused. Needs manual work to construct the new locale locale_t newlocale( int mask, const char * locale, locale_t /*base*/ ) { return _create_locale( mask, locale ); } - locale_t uselocale( locale_t newloc ) { locale_t old_locale = _get_current_locale(); @@ -29,78 +31,67 @@ locale_t uselocale( locale_t newloc ) // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); // uselocale sets all categories - // disable setting locale on Windows temporarily because the structure is opaque (PR31516) - //setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); +#if _VC_CRT_MAJOR_VERSION < 14 + setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); +#endif // uselocale returns the old locale_t return old_locale; } - -decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) -{ -#if defined(_LIBCPP_MSVCRT) - return ___mb_cur_max_l_func(__l); -#else - __libcpp_locale_guard __current(__l); - return MB_CUR_MAX; -#endif -} - - lconv *localeconv_l( locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return localeconv(); } size_t mbrlen_l( const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return mbrlen( s, n, ps ); } size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return mbsrtowcs( dst, src, len, ps ); } size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return wcrtomb( s, wc, ps ); } size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s, size_t n, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return mbrtowc( pwc, s, n, ps ); } size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return mbsnrtowcs( dst, src, nms, len, ps ); } size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return wcsnrtombs( dst, src, nwc, len, ps ); } wint_t btowc_l( int c, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return btowc( c ); } int wctob_l( wint_t c, locale_t loc ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return wctob( c ); } int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); va_list ap; va_start( ap, format ); int result = vsnprintf( ret, n, format, ap ); @@ -118,18 +109,6 @@ int asprintf_l( char **ret, locale_t loc, const char *format, ... ) } int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ) { - __libcpp_locale_guard __current(loc); + __locale_raii __current( uselocale(loc), uselocale ); return vasprintf( ret, format, ap ); } - -#if !defined(_LIBCPP_MSVCRT) -float strtof_l(const char* nptr, char** endptr, locale_t loc) { - __libcpp_locale_guard __current(loc); - return strtof(nptr, endptr); -} - -long double strtold_l(const char* nptr, char** endptr, locale_t loc) { - __libcpp_locale_guard __current(loc); - return strtold(nptr, endptr); -} -#endif diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp index dbd1c4c41..e989681a6 100644 --- a/src/support/win32/support.cpp +++ b/src/support/win32/support.cpp @@ -15,6 +15,17 @@ #include // strcpy, wcsncpy #include // mbstate_t +// Some of these functions aren't standard or if they conform, the name does not. + +int asprintf(char **sptr, const char *__restrict format, ...) +{ + va_list ap; + va_start(ap, format); + int result; + result = vasprintf(sptr, format, ap); + va_end(ap); + return result; +} // Like sprintf, but when return value >= 0 it returns // a pointer to a malloc'd string in *sptr. diff --git a/src/system_error.cpp b/src/system_error.cpp index 17f2c9a5b..cbbbb5dcd 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(_LIBCPP_MSVCRT_LIKE) +#if defined(_LIBCPP_MSVCRT) string do_strerror_r(int ev) { char buffer[strerror_buff_size]; if (::strerror_s(buffer, strerror_buff_size, ev) == 0) diff --git a/src/thread.cpp b/src/thread.cpp index 550da8ea7..3f283c385 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -34,7 +34,7 @@ #if defined(_LIBCPP_WIN32API) #include -#endif +#endif // defined(_LIBCPP_WIN32API) _LIBCPP_BEGIN_NAMESPACE_STD @@ -99,7 +99,7 @@ thread::hardware_concurrency() _NOEXCEPT #else // defined(CTL_HW) && defined(HW_NCPU) // TODO: grovel through /proc or check cpuid on x86 and similar // instructions on other architectures. -# if defined(_LIBCPP_WARNING) +# if defined(_LIBCPP_MSVC) _LIBCPP_WARNING("hardware_concurrency not yet implemented") # else # warning hardware_concurrency not yet implemented diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp deleted file mode 100644 index ef3ef7519..000000000 --- a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// void -// random_shuffle(RandomAccessIterator first, RandomAccessIterator last); -// -// template -// void -// random_shuffle(RandomAccessIterator first, RandomAccessIterator last, -// RandomNumberGenerator& rand); - -// -// In C++17, random_shuffle has been removed. -// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -// is defined before including , then random_shuffle will be restored. - -#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE - -#include -#include - -struct gen -{ - std::ptrdiff_t operator()(std::ptrdiff_t n) - { - return n-1; - } -}; - - -int main() -{ - std::vector v; - std::random_shuffle(v.begin(), v.end()); - gen r; - std::random_shuffle(v.begin(), v.end(), r); -} diff --git a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp index 51a1f2307..d8bb363d8 100644 --- a/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp +++ b/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test fails because diagnose_if doesn't emit all of the diagnostics -// when -fdelayed-template-parsing is enabled, like it is on Windows. -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: verify-support, diagnose-if-support // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp index a0b35f335..c84960f37 100644 --- a/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.cons/db_copy.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib // list(list&& c); diff --git a/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp index 570e5a0b3..dd424e89e 100644 --- a/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp @@ -9,9 +9,6 @@ // UNSUPPORTED: c++98, c++03 -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // list(list&& c); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp index 67146bc7c..1d64f9bd9 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp @@ -9,9 +9,6 @@ // UNSUPPORTED: c++98, c++03 -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // template void emplace(const_iterator p, Args&&... args); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp index 24cadbe01..ec5de0264 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator position) with end() diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp index 6d3e7617b..833e2b54d 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_db2.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator position) with iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp index dd592f90c..eef7a98e7 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator first, const_iterator last); with first iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp index d5e8fd9d8..0dd03dc50 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db2.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator first, const_iterator last); with second iterator from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp index 3ae20cdc5..22273a89f 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db3.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator first, const_iterator last); with both iterators from another container diff --git a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp index 6d6e29e47..d1e03c8ac 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/erase_iter_iter_db4.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // Call erase(const_iterator first, const_iterator last); with a bad range diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp index 03b9667cf..7fadb14af 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_iter_iter_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // template diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp index 589af7cc4..0d0fd100f 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // iterator insert(const_iterator position, value_type&& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp index 6999c4053..4fdfbfa50 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_size_value_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // iterator insert(const_iterator position, size_type n, const value_type& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp index 66983f01e..9a13520b9 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_value_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // iterator insert(const_iterator position, const value_type& x); diff --git a/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp index 9151fc1dd..795e66d97 100644 --- a/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // void pop_back(); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp index 541dd056b..7a1180a9b 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // void splice(const_iterator position, list& x); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp index 64ef78ed0..fa5243e32 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // void splice(const_iterator position, list& x, iterator i); diff --git a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp index 9fed4b577..a385b4cf7 100644 --- a/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp +++ b/test/libcxx/containers/sequences/list/list.ops/db_splice_pos_list_iter_iter.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // // void splice(const_iterator position, list& x, iterator first, iterator last); diff --git a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp index 30cf3f42e..43324e941 100644 --- a/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp +++ b/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp @@ -13,7 +13,6 @@ #include #include -#include "test_macros.h" #include "asan_testing.h" class X { @@ -71,7 +70,7 @@ void test_push_back() { } void test_emplace_back() { -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS std::vector v; v.reserve(2); v.push_back(X(2)); @@ -84,7 +83,7 @@ void test_emplace_back() { } assert(v.size() == 1); assert(is_contiguous_container_asan_correct(v)); -#endif +#endif // _LIBCPP_HAS_NO_VARIADICS } void test_insert_range() { @@ -122,7 +121,7 @@ void test_insert() { } void test_emplace() { -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS std::vector v; v.reserve(3); v.insert(v.end(), X(1)); @@ -136,7 +135,7 @@ void test_emplace() { } assert(v.size() == 2); assert(is_contiguous_container_asan_correct(v)); -#endif +#endif // _LIBCPP_HAS_NO_VARIADICS } void test_insert_range2() { diff --git a/test/libcxx/containers/unord/next_pow2.pass.cpp b/test/libcxx/containers/unord/next_pow2.pass.cpp deleted file mode 100644 index 3784eb87c..000000000 --- a/test/libcxx/containers/unord/next_pow2.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// -// -// REQUIRES: long_tests -// UNSUPPORTED: c++98, c++03 - -// Not a portable test - -// <__hash_table> - -// size_t __next_hash_pow2(size_t n); - -// If n <= 1, return n. If n is a power of 2, return n. -// Otherwise, return the next power of 2. - -#include <__hash_table> -#include -#include - -#include - -bool -is_power_of_two(unsigned long n) -{ - return __builtin_popcount(n) == 1; -} - -void test_next_pow2_val(size_t n) -{ - std::size_t npow2 = std::__next_hash_pow2(n); - assert(is_power_of_two(npow2) && npow2 > n); -} - -void -test_next_pow2() -{ - assert(!is_power_of_two(0)); - assert(is_power_of_two(1)); - assert(is_power_of_two(2)); - assert(!is_power_of_two(3)); - - assert(std::__next_hash_pow2(0) == 0); - assert(std::__next_hash_pow2(1) == 1); - - for (std::size_t n = 2; n < (sizeof(std::size_t) * 8 - 1); ++n) - { - std::size_t pow2 = 1ULL << n; - assert(std::__next_hash_pow2(pow2) == pow2); - } - - test_next_pow2_val(3); - test_next_pow2_val(7); - test_next_pow2_val(9); - test_next_pow2_val(15); - test_next_pow2_val(127); - test_next_pow2_val(129); -} - -// Note: this is only really useful when run with -fsanitize=undefined. -void -fuzz_unordered_map_reserve(unsigned num_inserts, - unsigned num_reserve1, - unsigned num_reserve2) -{ - std::unordered_map m; - m.reserve(num_reserve1); - for (unsigned I = 0; I < num_inserts; ++I) m[I] = 0; - m.reserve(num_reserve2); - assert(m.bucket_count() >= num_reserve2); -} - -int main() -{ - test_next_pow2(); - - for (unsigned num_inserts = 0; num_inserts <= 64; ++num_inserts) - for (unsigned num_reserve1 = 1; num_reserve1 <= 64; ++num_reserve1) - for (unsigned num_reserve2 = 1; num_reserve2 <= 64; ++num_reserve2) - fuzz_unordered_map_reserve(num_inserts, num_reserve1, num_reserve2); - - return 0; -} diff --git a/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp b/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp index d6554a63c..d682e7453 100644 --- a/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp +++ b/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp @@ -53,7 +53,7 @@ int main() { // FIXME: It would be great to suppress the below diagnostic all together. // but for now it's sufficient that it appears last. However there is // currently no way to test the order diagnostics are issued. - // expected-error@memory:* {{call to implicitly-deleted default constructor of '__compressed_pair_elem}} + // expected-error@memory:* {{call to implicitly-deleted default constructor of 'std::__1::hash >'}} } { using Set = std::unordered_set; diff --git a/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp index a727b31e4..91cdf85b1 100644 --- a/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp +++ b/test/libcxx/debug/containers/db_associative_container_tests.pass.cpp @@ -12,9 +12,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp index 3ae009a8e..6e2fb7bf3 100644 --- a/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp +++ b/test/libcxx/debug/containers/db_sequence_container_iterators.pass.cpp @@ -12,9 +12,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_string.pass.cpp b/test/libcxx/debug/containers/db_string.pass.cpp index f6434d5c7..8d1a622b4 100644 --- a/test/libcxx/debug/containers/db_string.pass.cpp +++ b/test/libcxx/debug/containers/db_string.pass.cpp @@ -12,9 +12,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp index d6a31e366..5618607fb 100644 --- a/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp +++ b/test/libcxx/debug/containers/db_unord_container_tests.pass.cpp @@ -12,9 +12,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // test container debugging #define _LIBCPP_DEBUG 1 diff --git a/test/libcxx/debug/debug_abort.pass.cpp b/test/libcxx/debug/debug_abort.pass.cpp index 9a1b4753f..b6e7b0bd8 100644 --- a/test/libcxx/debug/debug_abort.pass.cpp +++ b/test/libcxx/debug/debug_abort.pass.cpp @@ -10,9 +10,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=0 -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // Test that the default debug handler aborts the program. #define _LIBCPP_DEBUG 0 diff --git a/test/libcxx/debug/debug_throw.pass.cpp b/test/libcxx/debug/debug_throw.pass.cpp index d1c88400b..716750c78 100644 --- a/test/libcxx/debug/debug_throw.pass.cpp +++ b/test/libcxx/debug/debug_throw.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: libcpp-no-exceptions // MODULES_DEFINES: _LIBCPP_DEBUG=0 -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // Test that the default debug handler can be overridden and test the // throwing debug handler. diff --git a/test/libcxx/debug/debug_throw_register.pass.cpp b/test/libcxx/debug/debug_throw_register.pass.cpp index 0d2586bf3..ec4be700e 100644 --- a/test/libcxx/debug/debug_throw_register.pass.cpp +++ b/test/libcxx/debug/debug_throw_register.pass.cpp @@ -12,9 +12,6 @@ // MODULES_DEFINES: _LIBCPP_DEBUG=1 // MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS -// Can't test the system lib because this test enables debug mode -// UNSUPPORTED: with_system_cxx_lib - // Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT // to throw on failure. diff --git a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp deleted file mode 100644 index 9b8469393..000000000 --- a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - - -// In C++17, the function adapters mem_fun/mem_fun_ref, etc have been removed. -// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS -// is defined before including , then they will be restored. - -#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS - -#include -#include - -int identity(int v) { return v; } -int sum(int a, int b) { return a + b; } - -struct Foo { - int zero() const { return 0; } - int identity(int v) const { return v; } - int sum(int a, int b) const { return a + b; } -}; - -int main() -{ - typedef std::pointer_to_unary_function PUF; - typedef std::pointer_to_binary_function PBF; - assert((std::ptr_fun(identity)(4) == 4)); - assert((std::ptr_fun(sum)(4, 5) == 9)); - - Foo f; - assert((std::mem_fn(&Foo::identity)(f, 5) == 5)); - assert((std::mem_fn(&Foo::sum)(f, 5, 6) == 11)); - - typedef std::mem_fun_ref_t MFR; - typedef std::const_mem_fun_ref_t CMFR; - - assert((std::mem_fun_ref(&Foo::zero)(f) == 0)); - assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5)); -} diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp index 0a9e9fcfa..46dfc999b 100644 --- a/test/libcxx/double_include.sh.cpp +++ b/test/libcxx/double_include.sh.cpp @@ -137,9 +137,6 @@ #include #include #include -#if defined(__cpp_coroutines) -#include -#endif #include #include #include diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp index db7484d46..14f5c4ed8 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default.pass.cpp @@ -8,12 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 // dynarray.cons diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp index 9c6cad8ee..8d7d28b83 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions -// XFAIL: availability // dynarray.cons // explicit dynarray(size_type c); diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp index 5c745e0d1..84c602925 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.data/default.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability // dynarray.data diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp index 1ed51538f..376c94a6b 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - // dynarray.data // void fill(const T& v); diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp index 473313f39..ef9be4532 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp @@ -9,8 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 // UNSUPPORTED: libcpp-no-exceptions -// XFAIL: availability - // dynarray.overview // const_reference at(size_type n) const; diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp index f0aa1e3ff..38aefdfba 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - // dynarray.overview diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp index a5484296f..95262aab1 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - // dynarray.overview // size_type size() const noexcept; diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp index 0ba27cf92..4f1d0978d 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability // dynarray.overview diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp index 4306d1e9c..4bcb229eb 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp @@ -8,14 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 - -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - // dynarray.overview // const_reference at(size_type n) const; diff --git a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp index ab4960035..c0e018093 100644 --- a/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp +++ b/test/libcxx/experimental/containers/sequences/dynarray/dynarray.zero/default.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability // dynarray.zero // dynarray shall provide support for the special case of construction with a size of zero. diff --git a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg b/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg deleted file mode 100644 index 93553b513..000000000 --- a/test/libcxx/experimental/containers/sequences/dynarray/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if ('availability' in config.available_features - and not 'libcpp-no-exceptions' in config.available_features): - config.unsupported = True diff --git a/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp b/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp deleted file mode 100644 index 6f839befb..000000000 --- a/test/libcxx/experimental/filesystem/class.path/path.itr/reverse_iterator_produces_diagnostic.fail.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// class path - -#include -#include - - -namespace fs = std::experimental::filesystem; - -int main() { - using namespace fs; - using RIt = std::reverse_iterator; - - // expected-error@iterator:* {{static_assert failed "The specified iterator type cannot be used with reverse_iterator; Using stashing iterators with reverse_iterator causes undefined behavior"}} - { - RIt r; - ((void)r); - } -} diff --git a/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp b/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp deleted file mode 100644 index 56f47c8fa..000000000 --- a/test/libcxx/experimental/language.support/support.coroutines/dialect_support.sh.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// REQUIRES: fcoroutines-ts - -// RUN: %build -fcoroutines-ts -// RUN: %run - -// A simple "breathing" test that checks that -// can be parsed and used in all dialects, including C++03 in order to match -// Clang's behavior. - -#include - -namespace coro = std::experimental::coroutines_v1; - -coro::suspend_always sa; -coro::suspend_never sn; - -struct MyFuture { - struct promise_type { - typedef coro::coroutine_handle HandleT; - coro::suspend_never initial_suspend() { return sn; } - coro::suspend_always final_suspend() { return sa; } - coro::suspend_never yield_value(int) { return sn; } - MyFuture get_return_object() { - MyFuture f(HandleT::from_promise(*this)); - return f; - } - void return_void() {} - void unhandled_exception() {} - }; - typedef promise_type::HandleT HandleT; - MyFuture() : p() {} - MyFuture(HandleT h) : p(h) {} - - coro::coroutine_handle p; -}; - -MyFuture test_coro() { - co_await sn; - co_yield 42; - co_return; -} - -int main() -{ - MyFuture f = test_coro(); - while (!f.p.done()) - f.p.resume(); - f.p.destroy(); -} diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp index fa3ebf260..d924a57ff 100644 --- a/test/libcxx/iterators/trivial_iterators.pass.cpp +++ b/test/libcxx/iterators/trivial_iterators.pass.cpp @@ -179,7 +179,7 @@ int main() static_assert(( std::__libcpp_is_trivial_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator::const_reverse_iterator>::value), ""); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_is_trivial_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_is_trivial_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp index c37d23433..cc99b83ac 100644 --- a/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp +++ b/test/libcxx/language.support/support.dynamic/alloc.errors/new.badlength/bad_array_length.pass.cpp @@ -8,15 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability - -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 - // test bad_array_length #include diff --git a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp index 388fbebbd..04b40009c 100644 --- a/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp +++ b/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp @@ -10,19 +10,8 @@ // test libc++'s implementation of align_val_t, and the relevent new/delete // overloads in all dialects when -faligned-allocation is present. -// Libc++ defers to the underlying MSVC library to provide the new/delete -// definitions, which does not yet provide aligned allocation -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: -faligned-allocation -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // RUN: %build -faligned-allocation // RUN: %run @@ -85,4 +74,4 @@ int main() { assert(typeid(std::align_val_t).name() == std::string("St11align_val_t")); } #endif -} +} \ No newline at end of file diff --git a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp index 18cc0ca97..9ba422fc0 100644 --- a/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp +++ b/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// 'do_bytes' throws a std::range_error unexpectedly -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: c++98, c++03 // diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp deleted file mode 100644 index bae4175b1..000000000 --- a/test/libcxx/min_max_macros.sh.cpp +++ /dev/null @@ -1,298 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// Test that we can include each header in two TU's and link them together. - -// RUN: %compile -fsyntax-only - -// Prevent from generating deprecated warnings for this test. -#if defined(__DEPRECATED) -#undef __DEPRECATED -#endif - -#define TEST_MACROS() static_assert(min() == true && max() == true, "") -#define min() true -#define max() true - -// Top level headers -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -#include -TEST_MACROS(); -#endif -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -#include -TEST_MACROS(); -#endif -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -#include -TEST_MACROS(); -#endif -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -#include -TEST_MACROS(); -#endif -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#ifndef _LIBCPP_HAS_NO_THREADS -#include -TEST_MACROS(); -#endif -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); - -// experimental headers -#if __cplusplus >= 201103L -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#include -TEST_MACROS(); -#endif // __cplusplus >= 201103L - -// extended headers -#include -TEST_MACROS(); -#include -TEST_MACROS(); diff --git a/test/libcxx/modules/cinttypes_exports.sh.cpp b/test/libcxx/modules/cinttypes_exports.sh.cpp index ce39ceea4..99d20ec65 100644 --- a/test/libcxx/modules/cinttypes_exports.sh.cpp +++ b/test/libcxx/modules/cinttypes_exports.sh.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test fails on Windows because the underlying libc headers on Windows -// are not modular -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/clocale_exports.sh.cpp b/test/libcxx/modules/clocale_exports.sh.cpp index aacddd2d8..69b1a9bd6 100644 --- a/test/libcxx/modules/clocale_exports.sh.cpp +++ b/test/libcxx/modules/clocale_exports.sh.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test fails on Windows because the underlying libc headers on Windows -// are not modular -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: modules-support // UNSUPPORTED: c++98, c++03 diff --git a/test/libcxx/modules/cstdint_exports.sh.cpp b/test/libcxx/modules/cstdint_exports.sh.cpp index 3d3cbe338..8ecc1da28 100644 --- a/test/libcxx/modules/cstdint_exports.sh.cpp +++ b/test/libcxx/modules/cstdint_exports.sh.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test fails on Windows because the underlying libc headers on Windows -// are not modular -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: modules-support // Test that re-exports diff --git a/test/libcxx/modules/inttypes_h_exports.sh.cpp b/test/libcxx/modules/inttypes_h_exports.sh.cpp index 5354c8fef..d1598d7ea 100644 --- a/test/libcxx/modules/inttypes_h_exports.sh.cpp +++ b/test/libcxx/modules/inttypes_h_exports.sh.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test fails on Windows because the underlying libc headers on Windows -// are not modular -// XFAIL: LIBCXX-WINDOWS-FIXME - // REQUIRES: modules-support // Test that intypes.h re-exports stdint.h diff --git a/test/libcxx/selftest/test.arc.pass.mm b/test/libcxx/selftest/test.arc.pass.mm deleted file mode 100644 index ec272a872..000000000 --- a/test/libcxx/selftest/test.arc.pass.mm +++ /dev/null @@ -1,17 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#if __has_feature(objc_arc) == 0 -#error "arc should be enabled" -#endif - -int main() -{ -} diff --git a/test/libcxx/selftest/test.fail.mm b/test/libcxx/selftest/test.fail.mm deleted file mode 100644 index 764daf007..000000000 --- a/test/libcxx/selftest/test.fail.mm +++ /dev/null @@ -1,13 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#if __has_feature(objc_arc) == 0 -#error This test should not compile. -#endif diff --git a/test/libcxx/strings/iterators.exceptions.pass.cpp b/test/libcxx/strings/iterators.exceptions.pass.cpp index 7dea53c4c..b236c5180 100644 --- a/test/libcxx/strings/iterators.exceptions.pass.cpp +++ b/test/libcxx/strings/iterators.exceptions.pass.cpp @@ -80,7 +80,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_reverse_iterator>::value), ""); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/strings/iterators.noexcept.pass.cpp b/test/libcxx/strings/iterators.noexcept.pass.cpp index 20b4e3d76..b8e0b4cdf 100644 --- a/test/libcxx/strings/iterators.noexcept.pass.cpp +++ b/test/libcxx/strings/iterators.noexcept.pass.cpp @@ -28,7 +28,6 @@ #include #include -#include "test_macros.h" #include "test_iterators.h" int main() @@ -73,7 +72,7 @@ int main() static_assert(( std::__libcpp_string_gets_noexcept_iterator::reverse_iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_reverse_iterator>::value), ""); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS // Initializer list (which has no reverse iterators) static_assert(( std::__libcpp_string_gets_noexcept_iterator::iterator> ::value), ""); static_assert(( std::__libcpp_string_gets_noexcept_iterator::const_iterator> ::value), ""); diff --git a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp index 9efa597d7..bf567a302 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -6,6 +6,7 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp index dca493382..1cb61d9af 100644 --- a/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -6,6 +6,7 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// +// // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads diff --git a/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp new file mode 100644 index 000000000..7e4fe2267 --- /dev/null +++ b/test/libcxx/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_mangling.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads + +// TODO(EricWF) Investigate why typeid(...).name() returns a different string +// on GCC 4.9 but not newer GCCs. +// XFAIL: gcc-4.9 +// XFAIL: windows + +// THIS TESTS C++03 EXTENSIONS. + +// + +// template class lock_guard; + +// Test that the the variadic lock guard implementation mangles the same in +// C++11 and C++03. This is important since the mangling of `lock_guard` depends +// on it being declared as a variadic template, even in C++03. + +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#include +#include +#include +#include + +int main() { + const std::string expect = "NSt3__110lock_guardIJNS_5mutexEEEE"; + assert(typeid(std::lock_guard).name() == expect); +} diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp index 6024d9978..bff682ec4 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp index 3ada120cb..3898d08d8 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp index cf3e63847..941e9ff8f 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp index e0681048d..1a5685e8d 100644 --- a/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp +++ b/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// On Windows Clang bugs out when both __declspec and __attribute__ are present, -// the processing goes awry preventing the definition of the types. -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety diff --git a/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp b/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp deleted file mode 100644 index 87cd29264..000000000 --- a/test/libcxx/utilities/memory/util.smartptr/util.smartptr.shared/function_type_default_deleter.fail.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// UNSUPPORTED: c++98, c++03 - -#include - -template struct Tag {}; - -template -using SPtr = std::shared_ptr)>; - -template -using FnType = void(Tag); - -template -void TestFn(Tag) {} - -template -FnType* getFn() { - return &TestFn; -} - -struct Deleter { - template - void operator()(Tp) const { - using RawT = typename std::remove_pointer::type; - static_assert(std::is_function::value || - std::is_same::type, - std::nullptr_t>::value, - ""); - } -}; - -int main() { - { - SPtr<0> s; // OK - SPtr<1> s1(nullptr); // OK - SPtr<2> s2(getFn<2>(), Deleter{}); // OK - SPtr<3> s3(nullptr, Deleter{}); // OK - } - // expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}} - { - SPtr<4> s4(getFn<4>()); // expected-note {{requested here}} - SPtr<5> s5(getFn<5>(), std::default_delete>{}); // expected-note {{requested here}} - } -} diff --git a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp index 886884234..1c715e049 100644 --- a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp +++ b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // type_traits // extension @@ -18,6 +16,7 @@ #include +#ifndef _LIBCPP_HAS_NO_CONSTEXPR struct A { @@ -55,9 +54,11 @@ struct J constexpr J* operator&() const &&; }; +#endif // _LIBCPP_HAS_NO_CONSTEXPR int main() { +#ifndef _LIBCPP_HAS_NO_CONSTEXPR static_assert(std::__has_operator_addressof::value == false, ""); static_assert(std::__has_operator_addressof::value == false, ""); static_assert(std::__has_operator_addressof::value == true, ""); @@ -66,4 +67,5 @@ int main() static_assert(std::__has_operator_addressof::value == true, ""); static_assert(std::__has_operator_addressof::value == true, ""); static_assert(std::__has_operator_addressof::value == true, ""); +#endif // _LIBCPP_HAS_NO_CONSTEXPR } diff --git a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp b/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp deleted file mode 100644 index e3e083bfb..000000000 --- a/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.fail.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template struct is_aggregate; -// template constexpr bool is_aggregate_v = is_aggregate::value; - -#include - -int main () -{ -#ifdef _LIBCPP_HAS_NO_IS_AGGREGATE - // This should not compile when _LIBCPP_HAS_NO_IS_AGGREGATE is defined. - bool b = __is_aggregate(void); - ((void)b); -#else -#error Forcing failure... -#endif -} diff --git a/test/libcxx/utilities/template.bitset/includes.pass.cpp b/test/libcxx/utilities/template.bitset/includes.pass.cpp deleted file mode 100644 index 2e3c2812e..000000000 --- a/test/libcxx/utilities/template.bitset/includes.pass.cpp +++ /dev/null @@ -1,32 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// test that includes , , and - -#include - -#ifndef _LIBCPP_CSTDDEF -#error has not been included -#endif - -#ifndef _LIBCPP_STRING -#error has not been included -#endif - -#ifndef _LIBCPP_STDEXCEPT -#error has not been included -#endif - -#ifndef _LIBCPP_IOSFWD -#error has not been included -#endif - -int main() -{ -} diff --git a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp index 76d5f0d67..c18822bbe 100644 --- a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp +++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp @@ -34,7 +34,7 @@ int main() { // FIXME: The below warnings may get emitted as an error, a warning, or not emitted at all // depending on the flags used to compile this test. { - // expected-warning@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} - // expected-error@tuple:* 0+ {{binding reference member '__value_' to a temporary value}} + // expected-warning@tuple:* 0+ {{binding reference member 'value' to a temporary value}} + // expected-error@tuple:* 0+ {{binding reference member 'value' to a temporary value}} } } diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp new file mode 100644 index 000000000..26556c6eb --- /dev/null +++ b/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp @@ -0,0 +1,209 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// The following compilers don't generate constexpr special members correctly. +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 + +// + +// template class variant; + +// variant& operator=(variant const&); + +#include +#include + +#include "test_macros.h" + +struct NTCopyAssign { + constexpr NTCopyAssign(int v) : value(v) {} + NTCopyAssign(const NTCopyAssign &) = default; + NTCopyAssign(NTCopyAssign &&) = default; + NTCopyAssign &operator=(const NTCopyAssign &that) { + value = that.value; + return *this; + }; + NTCopyAssign &operator=(NTCopyAssign &&) = delete; + int value; +}; + +static_assert(!std::is_trivially_copy_assignable::value, ""); +static_assert(std::is_copy_assignable::value, ""); + +struct TCopyAssign { + constexpr TCopyAssign(int v) : value(v) {} + TCopyAssign(const TCopyAssign &) = default; + TCopyAssign(TCopyAssign &&) = default; + TCopyAssign &operator=(const TCopyAssign &) = default; + TCopyAssign &operator=(TCopyAssign &&) = delete; + int value; +}; + +static_assert(std::is_trivially_copy_assignable::value, ""); + +struct TCopyAssignNTMoveAssign { + constexpr TCopyAssignNTMoveAssign(int v) : value(v) {} + TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default; + TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default; + TCopyAssignNTMoveAssign &operator=(const TCopyAssignNTMoveAssign &) = default; + TCopyAssignNTMoveAssign &operator=(TCopyAssignNTMoveAssign &&that) { + value = that.value; + that.value = -1; + return *this; + } + int value; +}; + +static_assert(std::is_trivially_copy_assignable_v, ""); + +void test_copy_assignment_sfinae() { + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_copy_assignable::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } +} + +template struct Result { size_t index; T value; }; + +void test_copy_assignment_same_index() { + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42); + v = v2; + return {v.index(), std::get<0>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43l); + V v2(42l); + v = v2; + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } +} + +void test_copy_assignment_different_index() { + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42l); + v = v2; + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } +} + +template +constexpr bool test_constexpr_assign_extension_imp( + std::variant&& v, ValueType&& new_value) +{ + const std::variant cp( + std::forward(new_value)); + v = cp; + return v.index() == NewIdx && + std::get(v) == std::get(cp); +} + +void test_constexpr_copy_assignment_extension() { +#ifdef _LIBCPP_VERSION + using V = std::variant; + static_assert(std::is_trivially_copyable::value, ""); + static_assert(std::is_trivially_copy_assignable::value, ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); + static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); +#endif +} + +int main() { + test_copy_assignment_same_index(); + test_copy_assignment_different_index(); + test_copy_assignment_sfinae(); + test_constexpr_copy_assignment_extension(); +} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp new file mode 100644 index 000000000..fb6907dc5 --- /dev/null +++ b/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp @@ -0,0 +1,197 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// The following compilers don't generate constexpr special members correctly. +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 + +// + +// template class variant; + +// variant& operator=(variant&&) noexcept(see below); + +#include +#include + +#include "test_macros.h" + +struct NTMoveAssign { + constexpr NTMoveAssign(int v) : value(v) {} + NTMoveAssign(const NTMoveAssign &) = default; + NTMoveAssign(NTMoveAssign &&) = default; + NTMoveAssign &operator=(const NTMoveAssign &that) = default; + NTMoveAssign &operator=(NTMoveAssign &&that) { + value = that.value; + that.value = -1; + return *this; + }; + int value; +}; + +static_assert(!std::is_trivially_move_assignable::value, ""); +static_assert(std::is_move_assignable::value, ""); + +struct TMoveAssign { + constexpr TMoveAssign(int v) : value(v) {} + TMoveAssign(const TMoveAssign &) = delete; + TMoveAssign(TMoveAssign &&) = default; + TMoveAssign &operator=(const TMoveAssign &) = delete; + TMoveAssign &operator=(TMoveAssign &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_assignable::value, ""); + +struct TMoveAssignNTCopyAssign { + constexpr TMoveAssignNTCopyAssign(int v) : value(v) {} + TMoveAssignNTCopyAssign(const TMoveAssignNTCopyAssign &) = default; + TMoveAssignNTCopyAssign(TMoveAssignNTCopyAssign &&) = default; + TMoveAssignNTCopyAssign &operator=(const TMoveAssignNTCopyAssign &that) { + value = that.value; + return *this; + } + TMoveAssignNTCopyAssign &operator=(TMoveAssignNTCopyAssign &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_assignable_v, ""); + +void test_move_assignment_sfinae() { + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_move_assignable::value, ""); + static_assert(std::is_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } +} + +template struct Result { size_t index; T value; }; + +void test_move_assignment_same_index() { + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42); + v = std::move(v2); + return {v.index(), std::get<0>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43l); + V v2(42l); + v = std::move(v2); + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = std::move(v2); + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } +} + +void test_move_assignment_different_index() { + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42l); + v = std::move(v2); + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = std::move(v2); + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } +} + + +template +constexpr bool test_constexpr_assign_extension_imp( + std::variant&& v, ValueType&& new_value) +{ + std::variant v2( + std::forward(new_value)); + const auto cp = v2; + v = std::move(v2); + return v.index() == NewIdx && + std::get(v) == std::get(cp); +} + +void test_constexpr_move_assignment_extension() { +#ifdef _LIBCPP_VERSION + using V = std::variant; + static_assert(std::is_trivially_copyable::value, ""); + static_assert(std::is_trivially_move_assignable::value, ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); + static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); +#endif +} + +int main() { + test_move_assignment_same_index(); + test_move_assignment_different_index(); + test_move_assignment_sfinae(); + test_constexpr_move_assignment_extension(); +} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp new file mode 100644 index 000000000..0d30a78a4 --- /dev/null +++ b/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp @@ -0,0 +1,120 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class variant; + +// variant(variant const&); + +#include +#include + +#include "test_macros.h" + +struct NTCopy { + constexpr NTCopy(int v) : value(v) {} + NTCopy(const NTCopy &that) : value(that.value) {} + NTCopy(NTCopy &&) = delete; + int value; +}; + +static_assert(!std::is_trivially_copy_constructible::value, ""); +static_assert(std::is_copy_constructible::value, ""); + +struct TCopy { + constexpr TCopy(int v) : value(v) {} + TCopy(TCopy const &) = default; + TCopy(TCopy &&) = delete; + int value; +}; + +static_assert(std::is_trivially_copy_constructible::value, ""); + +struct TCopyNTMove { + constexpr TCopyNTMove(int v) : value(v) {} + TCopyNTMove(const TCopyNTMove&) = default; + TCopyNTMove(TCopyNTMove&& that) : value(that.value) { that.value = -1; } + int value; +}; + +static_assert(std::is_trivially_copy_constructible::value, ""); + +void test_copy_ctor_sfinae() { + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(std::is_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } +} + +void test_copy_ctor_basic() { + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2 = v; + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2) == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2 = v; + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2) == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2).value == 42, ""); + } +} + +int main() { + test_copy_ctor_basic(); + test_copy_ctor_sfinae(); +} diff --git a/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp b/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp new file mode 100644 index 000000000..91e8c194d --- /dev/null +++ b/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp @@ -0,0 +1,153 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// + +// template class variant; + +// variant(variant&&) noexcept(see below); + +#include +#include + +#include "test_macros.h" + +struct NTMove { + constexpr NTMove(int v) : value(v) {} + NTMove(const NTMove &) = delete; + NTMove(NTMove &&that) : value(that.value) { that.value = -1; } + int value; +}; + +static_assert(!std::is_trivially_move_constructible::value, ""); +static_assert(std::is_move_constructible::value, ""); + +struct TMove { + constexpr TMove(int v) : value(v) {} + TMove(const TMove &) = delete; + TMove(TMove &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_constructible::value, ""); + +struct TMoveNTCopy { + constexpr TMoveNTCopy(int v) : value(v) {} + TMoveNTCopy(const TMoveNTCopy& that) : value(that.value) {} + TMoveNTCopy(TMoveNTCopy&&) = default; + int value; +}; + +static_assert(std::is_trivially_move_constructible::value, ""); + +void test_move_ctor_sfinae() { + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert(std::is_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } +} + +template +struct Result { size_t index; T value; }; + +void test_move_ctor_basic() { + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2 = std::move(v); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2 = std::move(v); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value.value == 42, ""); + } +} + +int main() { + test_move_ctor_basic(); + test_move_ctor_sfinae(); +} diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp index 0c1cc1544..9a954d934 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp @@ -16,9 +16,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" template @@ -37,7 +38,8 @@ test() assert(ia[i] == ib[i]); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void test1() @@ -53,7 +55,8 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast(i)); } -#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -92,7 +95,7 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1*>, output_iterator*> >(); test1*>, input_iterator*> >(); test1*>, forward_iterator*> >(); @@ -127,5 +130,5 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp index 9b3df5af4..c5f9d3ac7 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp @@ -16,9 +16,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" template @@ -37,7 +38,8 @@ test() assert(ia[i] == ib[i]); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void test1() @@ -53,7 +55,8 @@ test1() for (unsigned i = 0; i < N; ++i) assert(*ib[i] == static_cast(i)); } -#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -69,7 +72,7 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1*>, bidirectional_iterator*> >(); test1*>, random_access_iterator*> >(); test1*>, std::unique_ptr*>(); @@ -81,5 +84,5 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp index ce74684f3..8eddfbc4d 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp @@ -17,7 +17,9 @@ #include #include - +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#include +#endif #include "test_iterators.h" diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp index e2abf7cce..e24598a9b 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // requires ShuffleIterator diff --git a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp index 313b6bac4..c923d847f 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template Rand> // requires ShuffleIterator diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp index a77a9eddb..80f86568c 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove.pass.cpp @@ -17,9 +17,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" template @@ -38,7 +39,8 @@ test() assert(ia[5] == 4); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void test1() @@ -60,7 +62,8 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -69,10 +72,12 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1*> >(); test1*> >(); test1*> >(); test1*>(); -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp index 8532998eb..de3f0a741 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_copy_if.pass.cpp @@ -21,8 +21,6 @@ #include "test_iterators.h" -bool equalToTwo(int v) { return v == 2; } - template void test() @@ -30,8 +28,8 @@ test() int ia[] = {0, 1, 2, 3, 4, 2, 3, 4, 2}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa]; - OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), - OutIter(ib), equalToTwo); + OutIter r = std::remove_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), + std::bind2nd(std::equal_to(), 2)); assert(base(r) == ib + sa-3); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp index c40f3e727..b23443129 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.remove/remove_if.pass.cpp @@ -18,9 +18,10 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" #include "counting_predicates.hpp" @@ -45,7 +46,8 @@ test() assert(cp.count() == sa); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + struct pred { bool operator()(const std::unique_ptr& i) {return *i == 2;} @@ -75,7 +77,8 @@ test1() assert(*ia[4] == 3); assert(*ia[5] == 4); } -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -84,10 +87,12 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1*> >(); test1*> >(); test1*> >(); test1*>(); -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp index f2ffece12..1eff3d39e 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_copy_if.pass.cpp @@ -23,8 +23,6 @@ #include "test_iterators.h" -bool equalToTwo(int v) { return v == 2; } - template void test() @@ -32,8 +30,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), - OutIter(ib), equalToTwo, 5); + OutIter r = std::replace_copy_if(InIter(ia), InIter(ia+sa), OutIter(ib), + std::bind2nd(std::equal_to(), 2), 5); assert(base(r) == ib + sa); assert(ib[0] == 0); assert(ib[1] == 1); diff --git a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp index ebb2945d7..8d6ab04e1 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.replace/replace_if.pass.cpp @@ -22,15 +22,13 @@ #include "test_iterators.h" -bool equalToTwo(int v) { return v == 2; } - template void test() { int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); - std::replace_if(Iter(ia), Iter(ia+sa), equalToTwo, 5); + std::replace_if(Iter(ia), Iter(ia+sa), std::bind2nd(std::equal_to(), 2), 5); assert(ia[0] == 0); assert(ia[1] == 1); assert(ia[2] == 5); diff --git a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp index 84f2c8c9f..64a5a6a5a 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.swap/swap_ranges.pass.cpp @@ -16,9 +16,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" template @@ -37,7 +38,8 @@ test() assert(j[2] == 3); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template void test1() @@ -57,7 +59,8 @@ test1() assert(*j[1] == 2); assert(*j[2] == 3); } -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES void test2() { @@ -128,7 +131,8 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1*>, forward_iterator*> >(); test1*>, bidirectional_iterator*> >(); test1*>, random_access_iterator*> >(); @@ -148,7 +152,8 @@ int main() test1*, bidirectional_iterator*> >(); test1*, random_access_iterator*> >(); test1*, std::unique_ptr*>(); -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test2(); } diff --git a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp index 6c5e621e4..68556fd98 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.transform/unary_transform.pass.cpp @@ -21,8 +21,6 @@ #include "test_iterators.h" -int plusOne(int v) { return v + 1; } - template void test() @@ -30,8 +28,8 @@ test() int ia[] = {0, 1, 2, 3, 4}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); int ib[sa] = {0}; - OutIter r = std::transform(InIter(ia), InIter(ia+sa), - OutIter(ib), plusOne); + OutIter r = std::transform(InIter(ia), InIter(ia+sa), OutIter(ib), + std::bind2nd(std::plus(), 1)); assert(base(r) == ib + sa); assert(ib[0] == 1); assert(ib[1] == 2); diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp index 049ccfe98..ab4ffad60 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique.pass.cpp @@ -17,9 +17,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" template @@ -83,7 +84,7 @@ test() assert(ii[2] == 2); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES struct do_nothing { @@ -167,7 +168,8 @@ test1() assert(*ii[1] == 1); assert(*ii[2] == 2); } -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -176,10 +178,12 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1 >(); test1 >(); test1 >(); test1(); -#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp index 164005205..c6df235be 100644 --- a/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp +++ b/test/std/algorithms/alg.modifying.operations/alg.unique/unique_pred.pass.cpp @@ -17,9 +17,10 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include +#endif -#include "test_macros.h" #include "test_iterators.h" struct count_equal @@ -109,7 +110,7 @@ test() assert(count_equal::count == si-1); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES struct do_nothing { @@ -209,7 +210,8 @@ test1() assert(*ii[2] == 2); assert(count_equal::count == si-1); } -#endif // TEST_STD_VER >= 11 + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { @@ -218,10 +220,12 @@ int main() test >(); test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1 >(); test1 >(); test1 >(); test1(); -#endif + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp index ec0526c2d..025bc06a6 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.count/count_if.pass.cpp @@ -20,24 +20,17 @@ #include "test_iterators.h" -struct eq { - eq (int val) : v(val) {} - bool operator () (int v2) const { return v == v2; } - int v; - }; - - int main() { int ia[] = {0, 1, 2, 2, 0, 1, 2, 3}; const unsigned sa = sizeof(ia)/sizeof(ia[0]); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - eq(2)) == 3); + std::bind2nd(std::equal_to(),2)) == 3); assert(std::count_if(input_iterator(ia), input_iterator(ia + sa), - eq(7)) == 0); + std::bind2nd(std::equal_to(),7)) == 0); assert(std::count_if(input_iterator(ia), input_iterator(ia), - eq(2)) == 0); + std::bind2nd(std::equal_to(),2)) == 0); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp index 761d71bbf..bde6ff389 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp @@ -20,22 +20,16 @@ #include "test_iterators.h" -struct eq { - eq (int val) : v(val) {} - bool operator () (int v2) const { return v == v2; } - int v; - }; - int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if(input_iterator(ia), input_iterator(ia+s), - eq(3)); + std::bind2nd(std::equal_to(), 3)); assert(*r == 3); r = std::find_if(input_iterator(ia), input_iterator(ia+s), - eq(10)); + std::bind2nd(std::equal_to(), 10)); assert(r == input_iterator(ia+s)); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp index 2e52e2603..661e643f0 100644 --- a/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp +++ b/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp @@ -20,23 +20,16 @@ #include "test_iterators.h" -struct ne { - ne (int val) : v(val) {} - bool operator () (int v2) const { return v != v2; } - int v; - }; - - int main() { int ia[] = {0, 1, 2, 3, 4, 5}; const unsigned s = sizeof(ia)/sizeof(ia[0]); input_iterator r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - ne(3)); + std::bind2nd(std::not_equal_to(), 3)); assert(*r == 3); r = std::find_if_not(input_iterator(ia), input_iterator(ia+s), - ne(10)); + std::bind2nd(std::not_equal_to(), 10)); assert(r == input_iterator(ia+s)); } diff --git a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp b/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp deleted file mode 100644 index fd24edb43..000000000 --- a/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each_n.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// InputIterator for_each_n(InputIterator first, Size n, Function f); - - -#include -#include - -#include "test_iterators.h" - -struct for_each_test -{ - for_each_test(int c) : count(c) {} - int count; - void operator()(int& i) {++i; ++count;} -}; - -int main() -{ - typedef input_iterator Iter; - int ia[] = {0, 1, 2, 3, 4, 5}; - const unsigned s = sizeof(ia)/sizeof(ia[0]); - - { - auto f = for_each_test(0); - Iter it = std::for_each_n(Iter(ia), 0, std::ref(f)); - assert(it == Iter(ia)); - assert(f.count == 0); - } - - { - auto f = for_each_test(0); - Iter it = std::for_each_n(Iter(ia), s, std::ref(f)); - - assert(it == Iter(ia+s)); - assert(f.count == s); - for (unsigned i = 0; i < s; ++i) - assert(ia[i] == static_cast(i+1)); - } - - { - auto f = for_each_test(0); - Iter it = std::for_each_n(Iter(ia), 1, std::ref(f)); - - assert(it == Iter(ia+1)); - assert(f.count == 1); - for (unsigned i = 0; i < 1; ++i) - assert(ia[i] == static_cast(i+2)); - } -} diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp index 33b8ff9ae..8e7931f7e 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp @@ -18,9 +18,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" struct indirect_less { @@ -29,6 +29,7 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES std::mt19937 randomness; @@ -52,7 +53,7 @@ int main() { test(1000); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -67,5 +68,5 @@ int main() } delete [] ia; } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp index 1b1987aa9..38d09ceda 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp @@ -19,10 +19,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -30,6 +29,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + std::mt19937 randomness; void test(int N) @@ -50,7 +51,7 @@ int main() { test(1000); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -64,5 +65,5 @@ int main() } delete [] ia; } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp index 02839abab..c0a05e420 100644 --- a/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp @@ -18,10 +18,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -29,6 +28,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + std::mt19937 randomness; void test(int N) @@ -52,7 +53,7 @@ int main() test(10); test(1000); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { const int N = 1000; std::unique_ptr* ia = new std::unique_ptr [N]; @@ -64,5 +65,5 @@ int main() assert(std::is_sorted(ia, ia+N, indirect_less())); delete [] ia; } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp index fa30797bd..88249ed78 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp @@ -21,10 +21,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -32,6 +31,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + std::mt19937 randomness; void @@ -77,7 +78,7 @@ int main() test(1000); test(1009); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -85,5 +86,5 @@ int main() std::nth_element(v.begin(), v.begin() + v.size()/2, v.end(), indirect_less()); assert(static_cast(*v[v.size()/2]) == v.size()/2); } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp index fb7976713..847a58291 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp @@ -21,10 +21,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -32,6 +31,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + std::mt19937 randomness; void @@ -83,7 +84,7 @@ int main() test_larger_sorts(1009); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -92,5 +93,5 @@ int main() for (int i = 0; static_cast(i) < v.size()/2; ++i) assert(*v[i] == i); } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp index 87d66c472..c77015993 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/sort/sort_comp.pass.cpp @@ -20,10 +20,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -31,6 +30,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + int main() { { @@ -42,7 +43,7 @@ int main() assert(std::is_sorted(v.begin(), v.end())); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -53,5 +54,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp index 8306cc3b1..347711bf5 100644 --- a/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp @@ -21,10 +21,9 @@ #include #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include -#include "test_macros.h" - struct indirect_less { template @@ -32,6 +31,8 @@ struct indirect_less {return *x < *y;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + std::mt19937 randomness; struct first_only @@ -71,7 +72,7 @@ int main() { test(); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > v(1000); for (int i = 0; static_cast(i) < v.size(); ++i) @@ -82,5 +83,5 @@ int main() assert(*v[1] == 1); assert(*v[2] == 2); } -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/Emplaceable.h b/test/std/containers/Emplaceable.h index f9319d410..34dd32620 100644 --- a/test/std/containers/Emplaceable.h +++ b/test/std/containers/Emplaceable.h @@ -10,10 +10,7 @@ #ifndef EMPLACEABLE_H #define EMPLACEABLE_H -#include -#include "test_macros.h" - -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES class Emplaceable { @@ -52,5 +49,6 @@ struct hash } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + #endif // EMPLACEABLE_H diff --git a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp index 8d27eabdf..f8fc21f1f 100644 --- a/test/std/containers/associative/map/map.access/index_tuple.pass.cpp +++ b/test/std/containers/associative/map/map.access/index_tuple.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -19,13 +17,17 @@ #include +#ifndef _LIBCPP_HAS_NO_VARIADICS #include +#endif int main() { +#ifndef _LIBCPP_HAS_NO_VARIADICS using namespace std; map, size_t> m; m[make_tuple(2,3)]=7; +#endif } diff --git a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp index 354911b76..679600662 100644 --- a/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -46,6 +45,7 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -70,4 +70,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp index 0504b1adc..c55d18f54 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -42,6 +41,7 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -62,4 +62,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp index d9c1fb898..3133eb2e0 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; typedef test_compare > C; @@ -43,6 +42,7 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef test_compare > C; @@ -64,4 +64,6 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.key_comp() == C(3)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp index 70783e625..d7552b360 100644 --- a/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/initializer_list_compare_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; typedef test_compare > C; @@ -46,6 +45,7 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A(6)); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef test_compare > C; @@ -69,6 +69,7 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == A()); } +#if TEST_STD_VER > 11 { typedef std::pair V; typedef min_allocator A; @@ -93,6 +94,7 @@ int main() assert(*next(m.begin(), 2) == V(3, 1)); assert(m.get_allocator() == a); } +#endif { typedef std::pair V; typedef explicit_allocator A; @@ -117,4 +119,6 @@ int main() assert(m.key_comp() == C(3)); assert(m.get_allocator() == a); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp index 923a2124e..705fb5804 100644 --- a/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/iter_iter_comp_alloc.pass.cpp @@ -92,6 +92,7 @@ int main() V(3, 2), }; { + typedef std::pair V; typedef min_allocator A; typedef test_compare > C; A a; @@ -105,6 +106,7 @@ int main() assert(m.get_allocator() == a); } { + typedef std::pair V; typedef explicit_allocator A; typedef test_compare > C; A a; diff --git a/test/std/containers/associative/map/map.cons/move.pass.cpp b/test/std/containers/associative/map/map.cons/move.pass.cpp index dd68f9c39..2d19b88bd 100644 --- a/test/std/containers/associative/map/map.cons/move.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair V; { typedef test_compare > C; @@ -70,6 +69,7 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#if TEST_STD_VER >= 11 { typedef test_compare > C; typedef min_allocator A; @@ -115,4 +115,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp index 5f7ab8ece..8349f13fd 100644 --- a/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -190,6 +189,7 @@ int main() } assert(Counter_base::gConstructed == 0); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -268,4 +268,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp index 8c0ef6e9a..09b41d3b1 100644 --- a/test/std/containers/associative/map/map.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/map/map.cons/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -145,6 +144,7 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -185,4 +185,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp index 3b595fc73..63d014fe8 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map M; typedef std::pair R; @@ -93,6 +92,7 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#if TEST_STD_VER >= 11 { typedef std::map, min_allocator>> M; typedef std::pair R; @@ -160,4 +160,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp index 7236276a2..319a23952 100644 --- a/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::map M; typedef M::iterator R; @@ -90,6 +89,7 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#if TEST_STD_VER >= 11 { typedef std::map, min_allocator>> M; typedef M::iterator R; @@ -155,4 +155,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp index de8191a6b..9cf3f3dcf 100644 --- a/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class map @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::pair V; std::map m = @@ -44,6 +43,7 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#if TEST_STD_VER >= 11 { typedef std::pair V; std::map, min_allocator> m = @@ -66,4 +66,6 @@ int main() assert(*next(m.begin()) == V(2, 1)); assert(*next(m.begin(), 2) == V(3, 1)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp index ae4ab349d..4c0326d90 100644 --- a/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -51,6 +50,7 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } +#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -80,4 +80,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp index 54b948c3e..6f645b63b 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -50,6 +49,7 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } +#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -78,4 +78,6 @@ int main() assert(*++i == V(3, 1.5)); assert(*++i == V(3, 2)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp index a78e1889a..6d20d14f4 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef std::multimap C; @@ -54,6 +53,7 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } +#if TEST_STD_VER >= 11 { typedef test_compare > Cmp; typedef std::multimap>> C; @@ -86,4 +86,6 @@ int main() assert(*++i == V(3, 2)); assert(m.key_comp() == Cmp(4)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp index ba6f76e52..8d12a059b 100644 --- a/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef test_allocator > A; @@ -57,6 +56,8 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A(5)); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 { typedef test_compare > Cmp; typedef min_allocator > A; @@ -91,6 +92,7 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A()); } +#if TEST_STD_VER > 11 { typedef test_compare > C; typedef std::pair V; @@ -122,6 +124,7 @@ int main() assert(*++i == V(3, 2)); assert(m.get_allocator() == a); } +#endif { typedef test_compare > Cmp; typedef explicit_allocator > A; @@ -156,4 +159,5 @@ int main() assert(m.key_comp() == Cmp(4)); assert(m.get_allocator() == A{}); } +#endif } diff --git a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp index 769c709cf..7edec7736 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef std::pair V; { typedef test_compare > C; @@ -76,6 +75,7 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#if TEST_STD_VER >= 11 { typedef test_compare > C; typedef min_allocator A; @@ -127,4 +127,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp index 5882283ab..6ce7127ea 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -190,6 +189,7 @@ int main() } assert(Counter_base::gConstructed == 0); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -268,4 +268,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp index 247425415..924e9ddf1 100644 --- a/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair V; typedef std::pair VC; @@ -145,6 +144,7 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#if TEST_STD_VER >= 11 { typedef std::pair V; typedef std::pair VC; @@ -185,4 +185,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp index 024cc670e..7f5b698fa 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap M; typedef M::iterator R; @@ -85,6 +84,7 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> M; typedef M::iterator R; @@ -145,4 +145,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp index d5fde83a7..a6ed318c7 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multimap M; typedef M::iterator R; @@ -90,6 +89,7 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> M; typedef M::iterator R; @@ -155,4 +155,6 @@ int main() assert(m.begin()->first == 2); assert(m.begin()->second == 3.5); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp index 20e0ba17e..89befb3e9 100644 --- a/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multimap @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multimap C; typedef C::value_type V; @@ -54,6 +53,7 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } +#if TEST_STD_VER >= 11 { typedef std::multimap, min_allocator>> C; typedef C::value_type V; @@ -86,4 +86,6 @@ int main() assert(*++i == V(3, 2)); assert(*++i == V(3, 1.5)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp index 9e67f97f9..df46d376e 100644 --- a/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp @@ -183,6 +183,7 @@ int main() #endif #if TEST_STD_VER > 11 { + typedef std::pair V; typedef std::multimap> M; typedef std::pair R; diff --git a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp index 474b7b6ac..f5295e52d 100644 --- a/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp @@ -147,6 +147,7 @@ int main() #endif #if TEST_STD_VER > 11 { + typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp index 28ff33254..8a650fa55 100644 --- a/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp @@ -155,6 +155,7 @@ int main() #endif #if TEST_STD_VER > 11 { + typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; V ar[] = diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp index 4f4b3884f..05760dc0e 100644 --- a/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp +++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp @@ -155,6 +155,7 @@ int main() #endif #if TEST_STD_VER > 11 { + typedef std::pair V; typedef std::multimap> M; typedef M::iterator R; V ar[] = diff --git a/test/std/containers/associative/multiset/emplace.pass.cpp b/test/std/containers/associative/multiset/emplace.pass.cpp index 7e2628db0..93842a250 100644 --- a/test/std/containers/associative/multiset/emplace.pass.cpp +++ b/test/std/containers/associative/multiset/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -69,6 +68,7 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -78,4 +78,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/test/std/containers/associative/multiset/emplace_hint.pass.cpp index 2b9b92d0b..48519fd43 100644 --- a/test/std/containers/associative/multiset/emplace_hint.pass.cpp +++ b/test/std/containers/associative/multiset/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -69,6 +68,7 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -78,4 +78,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp index 23a65a3cc..590c66801 100644 --- a/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -40,6 +39,8 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -57,4 +58,5 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } +#endif } diff --git a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp index f39fca5c8..0afc8dc87 100644 --- a/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -47,6 +46,8 @@ int main() assert(m.size() == 4); assert(*r == 3); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -71,4 +72,5 @@ int main() assert(m.size() == 4); assert(*r == 3); } +#endif } diff --git a/test/std/containers/associative/multiset/insert_rv.pass.cpp b/test/std/containers/associative/multiset/insert_rv.pass.cpp index 68d348793..3ee464bc5 100644 --- a/test/std/containers/associative/multiset/insert_rv.pass.cpp +++ b/test/std/containers/associative/multiset/insert_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::multiset M; typedef M::iterator R; @@ -47,6 +46,8 @@ int main() assert(m.size() == 4); assert(*r == 3); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> M; typedef M::iterator R; @@ -71,4 +72,5 @@ int main() assert(m.size() == 4); assert(*r == 3); } +#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp index 915a15fc6..2c5318afd 100644 --- a/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -37,6 +36,8 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -52,4 +53,5 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp index f3ee002dc..b3d6066eb 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::multiset C; typedef C::value_type V; @@ -37,6 +36,8 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#if TEST_STD_VER >= 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -51,6 +52,7 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#if TEST_STD_VER > 11 { typedef std::multiset, min_allocator> C; typedef C::value_type V; @@ -67,4 +69,6 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == a); } +#endif +#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp index 3312ca138..c67657aff 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef std::multiset C; typedef C::value_type V; @@ -35,4 +34,5 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp index e495fce13..83114893a 100644 --- a/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef test_allocator A; typedef std::multiset C; @@ -38,4 +37,5 @@ int main() assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp index 2adfb5c37..5a905cf15 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare > C; @@ -77,6 +76,8 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -114,4 +115,5 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#endif } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp index 29797c3ee..3da3fc09a 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -184,4 +183,5 @@ int main() } assert(Counter_base::gConstructed == 0); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp index e767ff1a4..b0ec4f394 100644 --- a/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class multiset @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -142,6 +141,8 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare > C; @@ -181,4 +182,5 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif } diff --git a/test/std/containers/associative/set/emplace.pass.cpp b/test/std/containers/associative/set/emplace.pass.cpp index 5d50a2435..47ef455a9 100644 --- a/test/std/containers/associative/set/emplace.pass.cpp +++ b/test/std/containers/associative/set/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef std::pair R; @@ -75,6 +74,7 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef std::pair R; @@ -85,4 +85,6 @@ int main() assert(m.size() == 1); assert(*r.first == 2); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/emplace_hint.pass.cpp b/test/std/containers/associative/set/emplace_hint.pass.cpp index 8962c0cbd..036f4d6df 100644 --- a/test/std/containers/associative/set/emplace_hint.pass.cpp +++ b/test/std/containers/associative/set/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef M::iterator R; @@ -69,6 +68,7 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef M::iterator R; @@ -78,4 +78,6 @@ int main() assert(m.size() == 1); assert(*r == 2); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_initializer_list.pass.cpp b/test/std/containers/associative/set/insert_initializer_list.pass.cpp index 3114d48ab..490d75905 100644 --- a/test/std/containers/associative/set/insert_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/insert_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -40,6 +39,7 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -57,4 +57,6 @@ int main() assert(*++i == V(8)); assert(*++i == V(10)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/insert_iter_rv.pass.cpp b/test/std/containers/associative/set/insert_iter_rv.pass.cpp index 9579988c0..be827d644 100644 --- a/test/std/containers/associative/set/insert_iter_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_iter_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef M::iterator R; @@ -47,6 +46,7 @@ int main() assert(m.size() == 3); assert(*r == 3); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef M::iterator R; @@ -71,4 +71,6 @@ int main() assert(m.size() == 3); assert(*r == 3); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/insert_rv.pass.cpp b/test/std/containers/associative/set/insert_rv.pass.cpp index 25cbfcb88..e528ef347 100644 --- a/test/std/containers/associative/set/insert_rv.pass.cpp +++ b/test/std/containers/associative/set/insert_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::set M; typedef std::pair R; @@ -51,6 +50,7 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> M; typedef std::pair R; @@ -79,4 +79,6 @@ int main() assert(m.size() == 3); assert(*r.first == 3); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp index 9906a1c0b..70e174a59 100644 --- a/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -37,6 +36,7 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -52,4 +52,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp index 31521b2f3..5bb5460dd 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::set C; typedef C::value_type V; @@ -36,6 +35,7 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#if TEST_STD_VER >= 11 { typedef std::set, min_allocator> C; typedef C::value_type V; @@ -50,4 +50,6 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp index ea72b6dc0..a0afa02cf 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS typedef test_compare > Cmp; typedef std::set C; typedef C::value_type V; @@ -35,4 +34,5 @@ int main() assert(*++i == V(5)); assert(*++i == V(6)); assert(m.key_comp() == Cmp(10)); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp index f6cb734c3..80d41b0b5 100644 --- a/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/initializer_list_compare_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_compare > Cmp; typedef test_allocator A; @@ -42,6 +41,7 @@ int main() assert(m.key_comp() == Cmp(10)); assert(m.get_allocator() == A(4)); } +#if TEST_STD_VER > 11 { typedef test_compare > Cmp; typedef test_allocator A; @@ -59,4 +59,6 @@ int main() assert(*++i == V(6)); assert(m.get_allocator() == A(4)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/associative/set/set.cons/move.pass.cpp b/test/std/containers/associative/set/set.cons/move.pass.cpp index dd313e4cd..c836d4550 100644 --- a/test/std/containers/associative/set/set.cons/move.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int V; typedef test_compare > C; @@ -71,6 +70,7 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -102,4 +102,6 @@ int main() assert(mo.size() == 0); assert(distance(mo.begin(), mo.end()) == 0); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp index 9e1cd816b..ba2adf5bb 100644 --- a/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -185,4 +184,5 @@ int main() assert(Counter_base::gConstructed == 0); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp index 7862f7bf7..07cb4153f 100644 --- a/test/std/containers/associative/set/set.cons/move_assign.pass.cpp +++ b/test/std/containers/associative/set/set.cons/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class set @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly V; typedef test_compare > C; @@ -142,6 +141,7 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#if TEST_STD_VER >= 11 { typedef MoveOnly V; typedef test_compare > C; @@ -181,4 +181,6 @@ int main() assert(m3.key_comp() == C(5)); assert(m1.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp index 6210a59c3..b102f117d 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" template @@ -31,11 +30,11 @@ struct test : base(comp, c, a) {} test(const value_compare& comp, const container_type& c, const test_allocator& a) : base(comp, c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(const value_compare& comp, container_type&& c, const test_allocator& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp index b1d13fb8b..4d99fc147 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" template @@ -31,11 +30,11 @@ struct test : base(comp, a) {} test(const value_compare& comp, const container_type& c, const test_allocator& a) : base(comp, c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(const value_compare& comp, container_type&& c, const test_allocator& a) : base(comp, std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} using base::c; diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp index df255b4cf..8bdf7db86 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -19,6 +17,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -53,9 +52,11 @@ struct test using base::c; }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test qo(std::less(), make > >(5), test_allocator(2)); @@ -63,4 +64,5 @@ int main() assert(q.size() == 5); assert(q.c.get_allocator() == test_allocator(6)); assert(q.top() == MoveOnly(4)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp index 4b20b265f..d43e53819 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue& operator=(priority_queue&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,12 +28,15 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue qo(std::less(), make >(5)); std::priority_queue q; q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp index 719f6d980..b61fb88a5 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // explicit priority_queue(const Compare& comp, container_type&& c); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,10 +28,13 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q(std::less(), make >(5)); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp index 450dff37c..7abe796e5 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES int a[] = {3, 5, 2, 0, 6, 8, 1}; const int n = sizeof(a)/sizeof(a[0]); std::priority_queue q(a+n/2, a+n, @@ -29,4 +28,5 @@ int main() std::vector(a, a+n/2)); assert(q.size() == n); assert(q.top() == MoveOnly(8)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp index 229ec02fc..aac8403e5 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue(priority_queue&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,11 +28,14 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue qo(std::less(), make >(5)); std::priority_queue q = std::move(qo); assert(q.size() == 5); assert(q.top() == MoveOnly(4)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp index e0547d64a..5dec2b910 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/default_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue() @@ -17,6 +15,7 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 #include #include @@ -31,5 +30,5 @@ int main() typedef std::priority_queue C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp index 9c2058d47..021899267 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.cons/move_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue(priority_queue&&) @@ -17,6 +15,8 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include #include diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp index be928fc2e..4f14e93f5 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue(); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q; q.emplace(1, 2.5); assert(q.top() == Emplaceable(1, 2.5)); @@ -29,4 +28,5 @@ int main() assert(q.top() == Emplaceable(3, 4.5)); q.emplace(2, 3.5); assert(q.top() == Emplaceable(3, 4.5)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp index 7f4827267..4b20a9bf9 100644 --- a/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // priority_queue(); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::priority_queue q; q.push(1); assert(q.top() == 1); @@ -29,4 +28,5 @@ int main() assert(q.top() == 3); q.push(2); assert(q.top() == 3); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp index 404db1240..b3ee75818 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" struct test @@ -25,10 +24,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp index 06a53fe38..e4fff91f0 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,7 +16,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" template @@ -38,10 +37,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp index 243585693..0163588ef 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -20,6 +18,7 @@ #include "test_allocator.h" #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -48,10 +47,13 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); assert(q.get_allocator() == test_allocator(4)); assert(q.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp index 76428e33f..7237bf271 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -20,6 +18,7 @@ #include "test_allocator.h" #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -48,11 +47,14 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); test q2(std::move(q), test_allocator(5)); assert(q2.get_allocator() == test_allocator(5)); assert(q2.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp index 57e22963e..8dd5d2f64 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // queue(queue&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,11 +28,14 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); std::queue q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp index 1b3f25608..f72067b0a 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/ctor_rcontainer.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // explicit queue(container_type&& c); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,9 +28,12 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); assert(q.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp index 7518bcc71..781d74016 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/default_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // queue() @@ -16,6 +14,8 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include #include @@ -29,5 +29,5 @@ int main() typedef std::queue C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp index a89fbef8b..58c8f9ddf 100644 --- a/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.cons/move_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // queue(queue&&) @@ -16,6 +14,7 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 #include #include @@ -30,5 +29,5 @@ int main() typedef std::queue C; static_assert(std::is_nothrow_move_constructible::value, ""); } -#endif +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp index 0932b7d99..af1b7e20c 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // queue& operator=(queue&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,12 +28,15 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q(make >(5)); std::queue q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp index 2e0a19a7f..d8992821f 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/push_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push(value_type&& v); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::queue q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -33,4 +32,5 @@ int main() assert(q.size() == 3); assert(q.front() == MoveOnly(1)); assert(q.back() == MoveOnly(3)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp index bac8378eb..94899d4f1 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_alloc.pass.cpp @@ -15,7 +15,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" struct test @@ -25,10 +24,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp index 237870b2c..b3cf39207 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp @@ -16,7 +16,6 @@ #include #include -#include "test_macros.h" #include "test_allocator.h" template @@ -38,10 +37,10 @@ struct test explicit test(const test_allocator& a) : base(a) {} test(const container_type& c, const test_allocator& a) : base(c, a) {} -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test(container_type&& c, const test_allocator& a) : base(std::move(c), a) {} test(test&& q, const test_allocator& a) : base(std::move(q), a) {} -#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES test_allocator get_allocator() {return c.get_allocator();} }; diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp index b0da1ef8b..374aa996f 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rcontainer_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -20,6 +18,7 @@ #include "test_allocator.h" #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -48,10 +47,13 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); assert(q.get_allocator() == test_allocator(4)); assert(q.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp index e75a8a267..5fa5bd2a8 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_rqueue_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -20,6 +18,7 @@ #include "test_allocator.h" #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -48,11 +47,14 @@ struct test allocator_type get_allocator() {return this->c.get_allocator();} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test q(make(5), test_allocator(4)); test q2(std::move(q), test_allocator(5)); assert(q2.get_allocator() == test_allocator(5)); assert(q2.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp index d837e3d65..44fab41a6 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // stack(stack&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,11 +28,14 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); std::stack q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp index 01d467460..ab08da938 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/ctor_rcontainer.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // explicit stack(container_type&& c); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,9 +28,12 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); assert(q.size() == 5); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp index 03c709ef6..2e217c545 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/default_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // stack() @@ -16,6 +14,7 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 #include #include @@ -30,5 +29,5 @@ int main() typedef std::stack C; static_assert(std::is_nothrow_default_constructible::value, ""); } -#endif +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp index 92aef08ba..af6793f46 100644 --- a/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.cons/move_noexcept.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // stack(stack&&) @@ -16,6 +14,8 @@ // This tests a conforming extension +// UNSUPPORTED: c++98, c++03 + #include #include @@ -29,5 +29,5 @@ int main() typedef std::stack C; static_assert(std::is_nothrow_move_constructible::value, ""); } -#endif +#endif // _LIBCPP_VERSION } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp index cbb63462a..75cbec1c4 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // stack& operator=(stack&& q); @@ -18,6 +16,7 @@ #include "MoveOnly.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -29,12 +28,15 @@ make(int n) return c; } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q(make >(5)); std::stack q2; q2 = std::move(q); assert(q2.size() == 5); assert(q.empty()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp index 9165f6ecc..67d0ea338 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push(value_type&& v); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::stack q; q.push(MoveOnly(1)); assert(q.size() == 1); @@ -30,4 +29,5 @@ int main() q.push(MoveOnly(3)); assert(q.size() == 3); assert(q.top() == MoveOnly(3)); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/array/array.size/size.pass.cpp b/test/std/containers/sequences/array/array.size/size.pass.cpp index 2fe535512..a833fdc04 100644 --- a/test/std/containers/sequences/array/array.size/size.pass.cpp +++ b/test/std/containers/sequences/array/array.size/size.pass.cpp @@ -14,8 +14,6 @@ #include #include -#include "test_macros.h" - // std::array is explicitly allowed to be initialized with A a = { init-list };. // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" @@ -38,7 +36,7 @@ int main() assert(c.max_size() == 0); assert(c.empty()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { typedef double T; typedef std::array C; diff --git a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp index fdb751da6..dea6492a5 100644 --- a/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void assign(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d; d.assign({3, 4, 5, 6}); @@ -29,6 +28,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::deque> d; d.assign({3, 4, 5, 6}); @@ -38,4 +38,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp index dd70cda18..dbf27053a 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -28,6 +27,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::deque> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -36,4 +36,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp index 2619569e1..9be3c63a6 100644 --- a/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/initializer_list_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque(initializer_list il, const Allocator& a = allocator_type()); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -30,6 +29,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::deque> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -39,4 +39,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp index 6e935a52b..68875139d 100644 --- a/test/std/containers/sequences/deque/deque.cons/move.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque(deque&&); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -52,6 +51,7 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == c1.get_allocator()); } +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -67,4 +67,6 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == c1.get_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp index 5a9a77c74..4aa0fa682 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque(deque&& c, const allocator_type& a); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -67,6 +66,7 @@ int main() assert(c3.get_allocator() == A(3)); assert(c1.size() != 0); } +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -82,4 +82,6 @@ int main() assert(c3.get_allocator() == A()); assert(c1.size() == 0); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp index 8a65bc2d2..ed8f1544b 100644 --- a/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque& operator=(deque&& c); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -70,6 +69,7 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == A(5)); } +#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); @@ -86,4 +86,6 @@ int main() assert(c1.size() == 0); assert(c3.get_allocator() == A()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp index 117e94289..597f642db 100644 --- a/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.cons/op_equal_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // deque& operator=(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d; d = {3, 4, 5, 6}; @@ -29,6 +28,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::deque> d; d = {3, 4, 5, 6}; @@ -38,4 +38,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp index 6d33424fe..5f7804023 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert(const_iterator p, initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::deque d(10, 1); std::deque::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -60,4 +59,5 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp index 060d83b5e..b5c881064 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_back_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_back(value_type&& v); @@ -21,6 +19,7 @@ #include "MoveOnly.h" #include "min_allocator.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -58,19 +57,24 @@ void test(int size) } } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); for (int j = 0; j < N; ++j) test >(rng[j]); } +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2046, 2047, 2048, 2049, 4094, 4095, 4096}; const int N = sizeof(rng)/sizeof(rng[0]); for (int j = 0; j < N; ++j) test> >(rng[j]); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp index df3d2d099..8e734a639 100644 --- a/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp +++ b/test/std/containers/sequences/deque/deque.modifiers/push_front_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_front(value_type&& v); @@ -20,6 +18,7 @@ #include "MoveOnly.h" #include "min_allocator.h" +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template C @@ -67,9 +66,11 @@ testN(int start, int N) test(c1, -10); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); @@ -77,6 +78,7 @@ int main() for (int j = 0; j < N; ++j) testN >(rng[i], rng[j]); } +#if TEST_STD_VER >= 11 { int rng[] = {0, 1, 2, 3, 1023, 1024, 1025, 2047, 2048, 2049}; const int N = sizeof(rng)/sizeof(rng[0]); @@ -84,4 +86,6 @@ int main() for (int j = 0; j < N; ++j) testN> >(rng[i], rng[j]); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp index 69fb6eb4c..d4dda02b8 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void assign(initializer_list il); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -43,6 +42,7 @@ int main() assert(*i == 10+n); assert(n == 4); } +#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -65,4 +65,6 @@ int main() assert(*i == 10+n); assert(n == 4); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp index 61118353d..935284831 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // forward_list& operator=(forward_list&& x); @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef test_allocator A; @@ -160,6 +159,7 @@ int main() assert(c1.get_allocator() == A(10)); assert(c0.empty()); } +#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef min_allocator A; @@ -194,4 +194,6 @@ int main() assert(c1.get_allocator() == A()); assert(c0.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp index 84f1eb996..3d35916cc 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/assign_op_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // forward_list& operator=(initializer_list il); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -43,6 +42,7 @@ int main() assert(*i == 10+n); assert(n == 4); } +#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -65,4 +65,6 @@ int main() assert(*i == 10+n); assert(n == 4); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp index 7575c0e81..ac73d142a 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // forward_list(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -29,6 +28,7 @@ int main() assert(*i == n); assert(n == 10); } +#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -38,4 +38,6 @@ int main() assert(*i == n); assert(n == 10); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp index cf9cbffa7..844be2001 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/init_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // forward_list(initializer_list il, const allocator_type& a); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef test_allocator A; @@ -32,6 +31,7 @@ int main() assert(n == 10); assert(c.get_allocator() == A(14)); } +#if TEST_STD_VER >= 11 { typedef int T; typedef min_allocator A; @@ -43,4 +43,6 @@ int main() assert(n == 10); assert(c.get_allocator() == A()); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp index 92a9e39fc..a5948b9ef 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // forward_list(forward_list&& x); @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef test_allocator A; @@ -53,6 +52,7 @@ int main() assert(c0.empty()); assert(c.get_allocator() == A(10)); } +#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef min_allocator A; @@ -68,4 +68,6 @@ int main() assert(c0.empty()); assert(c.get_allocator() == A()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp new file mode 100644 index 000000000..2d963a1be --- /dev/null +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// explicit forward_list(size_type n); + +#include +#include + +#include "DefaultOnly.h" + +int main() +{ + { + typedef DefaultOnly T; + typedef std::forward_list C; + unsigned N = 10; + C c = N; + unsigned n = 0; + for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n) +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + assert(*i == T()); +#else + ; +#endif + assert(n == N); + } +} diff --git a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp index 061dd6da0..b536ccf49 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.cons/size.pass.cpp @@ -36,11 +36,6 @@ void check_allocator(unsigned n, Allocator const &alloc = Allocator()) int main() { - { // test that the ctor is explicit - typedef std::forward_list C; - static_assert((std::is_constructible::value), ""); - static_assert((!std::is_convertible::value), ""); - } { typedef DefaultOnly T; typedef std::forward_list C; diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp index 8d7c4e989..dd8ea88c2 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/emplace_after.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef Emplaceable T; typedef std::forward_list C; @@ -53,6 +52,7 @@ int main() assert(*next(c.begin(), 3) == Emplaceable(2, 3.5)); assert(distance(c.begin(), c.end()) == 4); } +#if TEST_STD_VER >= 11 { typedef Emplaceable T; typedef std::forward_list> C; @@ -84,4 +84,6 @@ int main() assert(*next(c.begin(), 3) == Emplaceable(2, 3.5)); assert(distance(c.begin(), c.end()) == 4); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp index 90ee0d231..15e1a08b0 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert_after(const_iterator p, initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; typedef std::forward_list C; @@ -45,6 +44,7 @@ int main() assert(*next(c.begin(), 3) == 1); assert(*next(c.begin(), 4) == 2); } +#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -70,4 +70,6 @@ int main() assert(*next(c.begin(), 3) == 1); assert(*next(c.begin(), 4) == 2); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp index 173ccaa62..2e21cc79d 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert_after(const_iterator p, value_type&& v); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list C; @@ -53,6 +52,7 @@ int main() assert(*next(c.begin(), 3) == 2); assert(distance(c.begin(), c.end()) == 4); } +#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef std::forward_list> C; @@ -85,4 +85,6 @@ int main() assert(*next(c.begin(), 3) == 2); assert(distance(c.begin(), c.end()) == 4); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp index 545b0e68a..d831ceb28 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/pop_front.pass.cpp @@ -32,7 +32,7 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list C; @@ -45,6 +45,8 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef int T; typedef std::forward_list> C; @@ -58,6 +60,7 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list> C; @@ -70,5 +73,6 @@ int main() c.pop_front(); assert(distance(c.begin(), c.end()) == 0); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif } diff --git a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp index 7fc2b9d76..dfcd2cf90 100644 --- a/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp +++ b/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_front(value_type&& v); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef MoveOnly T; typedef std::forward_list C; @@ -33,6 +32,7 @@ int main() assert(*next(c.begin()) == 1); assert(distance(c.begin(), c.end()) == 2); } +#if TEST_STD_VER >= 11 { typedef MoveOnly T; typedef std::forward_list> C; @@ -45,4 +45,6 @@ int main() assert(*next(c.begin()) == 1); assert(distance(c.begin(), c.end()) == 2); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp index 4704cf40a..9b2c6d68c 100644 --- a/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void assign(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d; d.assign({3, 4, 5, 6}); @@ -30,6 +29,7 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#if TEST_STD_VER >= 11 { std::list> d; d.assign({3, 4, 5, 6}); @@ -40,4 +40,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp index eec214205..2f863c616 100644 --- a/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // list& operator=(list&& c); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list > l(test_allocator(5)); std::list > lo(test_allocator(5)); @@ -63,6 +62,7 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#if TEST_STD_VER >= 11 { std::list > l(min_allocator{}); std::list > lo(min_allocator{}); @@ -77,4 +77,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp index 8f04e7342..40413203b 100644 --- a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // list(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -29,6 +28,7 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#if TEST_STD_VER >= 11 { std::list> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -38,4 +38,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp index 3388e00df..6040c648e 100644 --- a/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/initializer_list_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // list(initializer_list il, const Allocator& a = allocator_type()); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -31,6 +30,7 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#if TEST_STD_VER >= 11 { std::list> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -41,4 +41,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp index 7236f7cc6..9f8a536b3 100644 --- a/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // list(list&& c, const allocator_type& a); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list > l(test_allocator(5)); std::list > lo(test_allocator(5)); @@ -60,6 +59,7 @@ int main() assert(!l.empty()); assert(l2.get_allocator() == other_allocator(4)); } +#if TEST_STD_VER >= 11 { std::list > l(min_allocator{}); std::list > lo(min_allocator{}); @@ -73,4 +73,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == min_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp index b638e219d..1097bdab2 100644 --- a/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.cons/op_equal_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // list& operator=(initializer_list il); @@ -19,6 +17,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d; d = {3, 4, 5, 6}; @@ -29,6 +28,7 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#if TEST_STD_VER >= 11 { std::list> d; d = {3, 4, 5, 6}; @@ -39,4 +39,6 @@ int main() assert(*i++ == 5); assert(*i++ == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp index 2d5231e78..91845e564 100644 --- a/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert(const_iterator p, initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::list d(10, 1); std::list::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6}); @@ -41,6 +40,7 @@ int main() assert(*i++ == 1); assert(*i++ == 1); } +#if TEST_STD_VER >= 11 { std::list> d(10, 1); std::list>::iterator i = d.insert(next(d.cbegin(), 2), {3, 4, 5, 6}); @@ -62,4 +62,6 @@ int main() assert(*i++ == 1); assert(*i++ == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp index 3d9d00abe..10acede51 100644 --- a/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/push_back_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_back(value_type&& x); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list l1; l1.push_back(MoveOnly(1)); @@ -31,6 +30,7 @@ int main() assert(l1.front() == MoveOnly(1)); assert(l1.back() == MoveOnly(2)); } +#if TEST_STD_VER >= 11 { std::list> l1; l1.push_back(MoveOnly(1)); @@ -41,4 +41,6 @@ int main() assert(l1.front() == MoveOnly(1)); assert(l1.back() == MoveOnly(2)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp index 6fef6ade9..5321ee0fa 100644 --- a/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp +++ b/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_front(value_type&& x); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list l1; l1.push_front(MoveOnly(1)); @@ -31,6 +30,7 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } +#if TEST_STD_VER >= 11 { std::list> l1; l1.push_front(MoveOnly(1)); @@ -41,4 +41,6 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp index 60146a88b..ac7a2ce38 100644 --- a/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void assign(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d.assign({true, false, false, true}); @@ -29,6 +28,7 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#if TEST_STD_VER >= 11 { std::vector> d; d.assign({true, false, false, true}); @@ -38,4 +38,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp index 13cd65f33..f07c1d900 100644 --- a/test/std/containers/sequences/vector.bool/assign_move.pass.cpp +++ b/test/std/containers/sequences/vector.bool/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector& operator=(vector&& c); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -62,6 +61,7 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -76,4 +76,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp index c737f05fd..81a8ae475 100644 --- a/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp +++ b/test/std/containers/sequences/vector.bool/emplace_back.pass.cpp @@ -48,7 +48,7 @@ int main() assert(c.front() == false); assert(c.back() == true); #endif - c.emplace_back(true); + c.emplace_back(1 == 1); assert(c.size() == 3); assert(c.front() == false); assert(c[1] == true); @@ -82,7 +82,7 @@ int main() assert(c.front() == false); assert(c.back() == true); #endif - c.emplace_back(true); + c.emplace_back(1 == 1); assert(c.size() == 3); assert(c.front() == false); assert(c[1] == true); diff --git a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp index a850fa2f1..07bae0eb7 100644 --- a/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d = {true, false, false, true}; assert(d.size() == 4); @@ -28,6 +27,7 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#if TEST_STD_VER >= 11 { std::vector> d = {true, false, false, true}; assert(d.size() == 4); @@ -36,4 +36,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp index 9a2df4290..5f7f5144f 100644 --- a/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/vector.bool/initializer_list_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(initializer_list il, const Allocator& a = allocator_type()); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector> d({true, false, false, true}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -30,6 +29,7 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#if TEST_STD_VER >= 11 { std::vector> d({true, false, false, true}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -39,4 +39,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp index df4cb199b..3a176d94e 100644 --- a/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/insert_iter_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert(const_iterator p, initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d(10, true); std::vector::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); @@ -40,6 +39,7 @@ int main() assert(d[12] == true); assert(d[13] == true); } +#if TEST_STD_VER >= 11 { std::vector> d(10, true); std::vector>::iterator i = d.insert(d.cbegin() + 2, {false, true, true, false}); @@ -60,4 +60,6 @@ int main() assert(d[12] == true); assert(d[13] == true); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/move.pass.cpp b/test/std/containers/sequences/vector.bool/move.pass.cpp index f189e2b97..f3a11ec56 100644 --- a/test/std/containers/sequences/vector.bool/move.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(vector&& c); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -46,6 +45,7 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -59,4 +59,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp index b3b6f9649..7aaa7c555 100644 --- a/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(vector&& c, const allocator_type& a); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -59,6 +58,7 @@ int main() assert(!l.empty()); assert(l2.get_allocator() == other_allocator(4)); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -72,4 +72,6 @@ int main() assert(l.empty()); assert(l2.get_allocator() == min_allocator()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp index 61874338d..4b959cf00 100644 --- a/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector.bool/op_equal_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector& operator=(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d = {true, false, false, true}; @@ -29,6 +28,7 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#if TEST_STD_VER >= 11 { std::vector> d; d = {true, false, false, true}; @@ -38,4 +38,6 @@ int main() assert(d[2] == false); assert(d[3] == true); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp index 89f5a6645..4f82792fa 100644 --- a/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp +++ b/test/std/containers/sequences/vector.bool/vector_bool.pass.cpp @@ -31,7 +31,6 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); @@ -44,7 +43,6 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); bool ba[] = {true, false, true, true, false}; T vb(std::begin(ba), std::end(ba)); H h; diff --git a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp index 273bdad9a..6409acaf6 100644 --- a/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp +++ b/test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp @@ -13,8 +13,6 @@ #include #include - -#include "test_macros.h" #include "test_allocator.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -22,30 +20,7 @@ int main() { - { - 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)); - } - { - // Add 1 for implementations that dynamically allocate a container proxy. - 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)); - } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector v(100); v.resize(50); @@ -69,6 +44,32 @@ int main() assert(v.capacity() >= 200); assert(is_contiguous_container_asan_correct(v)); } +#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES + { + 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)); + } + { + // Add 1 for implementations that dynamically allocate a container proxy. + 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 TEST_STD_VER >= 11 { std::vector> v(100); v.resize(50); diff --git a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp index 853f75583..222fa9c78 100644 --- a/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/assign_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void assign(initializer_list il); @@ -22,6 +20,7 @@ template void test ( Vec &v ) { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS v.assign({3, 4, 5, 6}); assert(v.size() == 4); assert(is_contiguous_container_asan_correct(v)); @@ -29,6 +28,7 @@ void test ( Vec &v ) assert(v[1] == 4); assert(v[2] == 5); assert(v[3] == 6); +#endif } int main() @@ -41,6 +41,8 @@ int main() test(d1); test(d2); } + +#if TEST_STD_VER >= 11 { typedef std::vector> V; V d1; @@ -49,4 +51,5 @@ int main() test(d1); test(d2); } +#endif } diff --git a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp index c2b6b8378..acbee97bc 100644 --- a/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/assign_move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector& operator=(vector&& c); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -77,6 +76,7 @@ int main() assert(l2.get_allocator() == lo.get_allocator()); assert(is_contiguous_container_asan_correct(l2)); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -96,4 +96,6 @@ int main() 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/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp index edbad8c0d..408bcc3b1 100644 --- a/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(initializer_list il); @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -29,6 +28,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::vector> d = {3, 4, 5, 6}; assert(d.size() == 4); @@ -38,4 +38,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp index ac5d0178e..f4c3b5c1e 100644 --- a/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/initializer_list_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(initializer_list il, const Allocator& a = allocator_type()); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector> d({3, 4, 5, 6}, test_allocator(3)); assert(d.get_allocator() == test_allocator(3)); @@ -32,6 +31,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::vector> d({3, 4, 5, 6}, min_allocator()); assert(d.get_allocator() == min_allocator()); @@ -42,4 +42,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp index cd50d5432..d51b364f3 100644 --- a/test/std/containers/sequences/vector/vector.cons/move.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(vector&& c); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -69,6 +68,7 @@ int main() assert(*j == 3); assert(is_contiguous_container_asan_correct(c2)); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -98,4 +98,6 @@ int main() assert(*j == 3); assert(is_contiguous_container_asan_correct(c2)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp index 767a0ce3d..fcdd35ae1 100644 --- a/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector(vector&& c, const allocator_type& a); @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector > l(test_allocator(5)); std::vector > lo(test_allocator(5)); @@ -76,6 +75,7 @@ int main() assert(l2.get_allocator() == other_allocator(4)); assert(is_contiguous_container_asan_correct(l2)); } +#if TEST_STD_VER >= 11 { std::vector > l(min_allocator{}); std::vector > lo(min_allocator{}); @@ -94,4 +94,6 @@ int main() assert(l2.get_allocator() == min_allocator()); assert(is_contiguous_container_asan_correct(l2)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp index 21dd5c384..4e5a20413 100644 --- a/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.cons/op_equal_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // vector& operator=(initializer_list il); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d; d = {3, 4, 5, 6}; @@ -31,6 +30,7 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#if TEST_STD_VER >= 11 { std::vector> d; d = {3, 4, 5, 6}; @@ -41,4 +41,6 @@ int main() assert(d[2] == 5); assert(d[3] == 6); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp deleted file mode 100644 index 5f053eb85..000000000 --- a/test/std/containers/sequences/vector/vector.modifiers/clear.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// void clear(); - -#include -#include - -#include "min_allocator.h" -#include "asan_testing.h" - -int main() -{ - { - int a[] = {1, 2, 3}; - std::vector c(a, a+3); - c.clear(); - assert(c.empty()); - LIBCPP_ASSERT(c.__invariants()); - LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); - } -#if TEST_STD_VER >= 11 - { - int a[] = {1, 2, 3}; - std::vector> c(a, a+3); - c.clear(); - assert(c.empty()); - LIBCPP_ASSERT(c.__invariants()); - LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); - } -#endif -} diff --git a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp index e5e0277fa..7e4aed8c1 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template iterator emplace(const_iterator pos, Args&&... args); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector v; v.reserve(3); @@ -39,6 +38,7 @@ int main() assert(v[0] == 3); assert(is_contiguous_container_asan_correct(v)); } +#if TEST_STD_VER >= 11 { std::vector> v; v.reserve(3); @@ -57,4 +57,6 @@ int main() assert(v[0] == 3); assert(is_contiguous_container_asan_correct(v)); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp index 785a5be8b..dbdccf13b 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -18,21 +18,6 @@ #include "min_allocator.h" #include "asan_testing.h" -#ifndef TEST_HAS_NO_EXCEPTIONS -struct Throws { - Throws() : v_(0) {} - Throws(int v) : v_(v) {} - Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } - Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } - Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } - Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } - int v_; - static bool sThrows; - }; - -bool Throws::sThrows = false; -#endif - int main() { { @@ -87,17 +72,4 @@ int main() assert(is_contiguous_container_asan_correct(l1)); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS -// Test for LWG2853: -// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. - { - Throws arr[] = {1, 2, 3}; - std::vector v(arr, arr+3); - Throws::sThrows = true; - v.erase(v.begin()); - v.erase(--v.end()); - v.erase(v.begin()); - assert(v.size() == 0); - } -#endif } diff --git a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp index 2fc4981b6..f7fa0dba2 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -18,21 +18,6 @@ #include "min_allocator.h" #include "asan_testing.h" -#ifndef TEST_HAS_NO_EXCEPTIONS -struct Throws { - Throws() : v_(0) {} - Throws(int v) : v_(v) {} - Throws(const Throws &rhs) : v_(rhs.v_) { if (sThrows) throw 1; } - Throws( Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; } - Throws& operator=(const Throws &rhs) { v_ = rhs.v_; return *this; } - Throws& operator=( Throws &&rhs) { v_ = rhs.v_; return *this; } - int v_; - static bool sThrows; - }; - -bool Throws::sThrows = false; -#endif - int main() { int a1[] = {1, 2, 3}; @@ -140,17 +125,4 @@ int main() assert(is_contiguous_container_asan_correct(outer[1])); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS -// Test for LWG2853: -// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T. - { - Throws arr[] = {1, 2, 3}; - std::vector v(arr, arr+3); - Throws::sThrows = true; - v.erase(v.begin(), --v.end()); - assert(v.size() == 1); - v.erase(v.begin(), v.end()); - assert(v.size() == 0); - } -#endif } diff --git a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp index 9072d427c..b0fe123aa 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/insert_iter_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert(const_iterator p, initializer_list il); @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::vector d(10, 1); std::vector::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -42,6 +41,7 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } +#if TEST_STD_VER >= 11 { std::vector> d(10, 1); std::vector>::iterator i = d.insert(d.cbegin() + 2, {3, 4, 5, 6}); @@ -63,4 +63,6 @@ int main() assert(d[12] == 1); assert(d[13] == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp index ac1fffd9d..f4a1f5d5f 100644 --- a/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp +++ b/test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // void push_back(value_type&& x); @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::vector c; c.push_back(MoveOnly(0)); @@ -82,6 +81,7 @@ int main() for (int j = 0; static_cast(j) < c.size(); ++j) assert(c[j] == MoveOnly(j)); } +#if TEST_STD_VER >= 11 { std::vector> c; c.push_back(MoveOnly(0)); @@ -110,4 +110,6 @@ int main() for (int j = 0; static_cast(j) < c.size(); ++j) assert(c[j] == MoveOnly(j)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp index 9fca1f105..4d92b3d4c 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/assign_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -29,6 +27,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::allocator > A; typedef std::unordered_map= 11 { typedef min_allocator > A; typedef std::unordered_map // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator > A; typedef std::unordered_map= 11 { typedef min_allocator > A; typedef std::unordered_map= 1 + { + std::unordered_map s1 = {{1, 1}, {2, 2}, {3, 3}}; + std::unordered_map::iterator i = s1.begin(); + std::pair k = *i; + std::unordered_map s2; + s2 = std::move(s1); + assert(*i == k); + s2.erase(i); + assert(s2.size() == 2); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp index b06e4db13..bebab0375 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -62,6 +61,7 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -158,5 +158,7 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // TEST_STD_VER > 11 +#endif +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp index ca48808f4..9055e3dcd 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -65,6 +64,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -98,4 +98,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp index 02360f8ac..db0010b34 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -66,6 +65,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -100,4 +100,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp index c6a397656..c76ce3968 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -33,6 +31,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -68,6 +67,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -103,4 +103,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp index 5acc4c34b..6cb57d4ff 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -33,6 +31,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map >, @@ -69,6 +68,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map >, @@ -141,4 +141,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp index 296363166..681c0e95b 100644 --- a/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.cnstr/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair P; typedef test_allocator> A; @@ -114,6 +113,7 @@ int main() assert(c0.empty()); } +#if TEST_STD_VER >= 11 { typedef std::pair P; typedef min_allocator> A; @@ -196,4 +196,6 @@ int main() assert(c0.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp index 18c83dd31..26f716166 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map C; typedef std::pair R; @@ -50,6 +49,7 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -75,4 +75,6 @@ int main() assert(r.first->first == 5); assert(r.first->second == Emplaceable(6, 7)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp index ce7fa835c..477f2cf02 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -18,6 +16,9 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif #include #include @@ -27,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_map C; typedef C::iterator R; @@ -49,6 +51,7 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -72,4 +75,19 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } +#endif +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_map C; + typedef C::iterator R; + typedef C::value_type P; + C c; + C c2; + R r = c.emplace_hint(c2.end(), std::piecewise_construct, + std::forward_as_tuple(3), + std::forward_as_tuple()); + assert(false); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp index 477a229d0..a4d8b5d41 100644 --- a/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.map/unord.map.modifiers/insert_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_map C; typedef std::pair P; @@ -46,6 +45,7 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } +#if TEST_STD_VER >= 11 { typedef std::unordered_map, std::equal_to, min_allocator>> C; @@ -67,4 +67,6 @@ int main() assert(c.at(3) == "three"); assert(c.at(4) == "four"); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp index cefbf4596..6d27dec98 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -30,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator > A; typedef std::unordered_multimap= 11 { typedef min_allocator > A; typedef std::unordered_multimap // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator > A; typedef std::unordered_multimap= 11 { typedef min_allocator > A; typedef std::unordered_multimap= 1 + { + std::unordered_multimap s1 = {{1, 1}, {2, 2}, {3, 3}}; + std::unordered_multimap::iterator i = s1.begin(); + std::pair k = *i; + std::unordered_multimap s2; + s2 = std::move(s1); + assert(*i == k); + s2.erase(i); + assert(s2.size() == 2); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp index 1a222cef1..445fd2d82 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -84,6 +83,7 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -250,5 +250,7 @@ int main() assert(c.get_allocator() == a); assert(!(c.get_allocator() == A())); } -#endif // TEST_STD_VER > 11 +#endif +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp index ef75b6ce0..92a43b482 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -87,6 +86,7 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -142,4 +142,6 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == min_allocator >())); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp index 998125391..d7afafcae 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -88,6 +87,7 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == test_allocator >())); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -144,4 +144,6 @@ int main() assert(c.key_eq() == test_compare >()); assert((c.get_allocator() == min_allocator >())); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp index 1ca94641c..9842a4bbd 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -33,6 +31,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -90,6 +89,7 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == test_allocator >())); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -147,4 +147,6 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == min_allocator >())); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp index e8efefbee..244c3f5c6 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -33,6 +31,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap >, @@ -91,6 +90,7 @@ int main() assert(c.key_eq() == test_compare >(9)); assert((c.get_allocator() == test_allocator >(10))); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap >, @@ -208,4 +208,6 @@ int main() assert(c.key_eq() == test_compare >(9)); assert(c.get_allocator() == A{}); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp index 0e004522c..878ef598f 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -34,6 +32,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::pair P; typedef test_allocator> A; @@ -162,6 +161,7 @@ int main() assert(c0.empty()); } +#if TEST_STD_VER >= 11 { typedef std::pair P; typedef min_allocator> A; @@ -290,4 +290,6 @@ int main() assert(c0.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp index 68e5267a9..96678cf33 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap C; typedef C::iterator R; @@ -47,6 +46,7 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -69,4 +69,6 @@ int main() assert(r->first == 5); assert(r->second == Emplaceable(6, 7)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp index 86950e289..a8095135c 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -18,6 +16,9 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif #include #include @@ -28,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multimap C; typedef C::iterator R; @@ -58,6 +60,7 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -89,4 +92,19 @@ int main() assert(r->first == 3); LIBCPP_ASSERT(r->second == Emplaceable(5, 6)); } +#endif +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_multimap C; + typedef C::iterator R; + typedef C::value_type P; + C c; + C c2; + R r = c.emplace_hint(c2.end(), std::piecewise_construct, + std::forward_as_tuple(3), + std::forward_as_tuple()); + assert(false); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp index ef1577170..e0b1c6941 100644 --- a/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -27,6 +25,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multimap C; typedef std::pair P; @@ -72,6 +71,7 @@ int main() assert(static_cast(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap, std::equal_to, min_allocator>> C; @@ -118,4 +118,6 @@ int main() assert(static_cast(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast(std::distance(c.cbegin(), c.cend())) == c.size()); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/emplace.pass.cpp b/test/std/containers/unord/unord.multiset/emplace.pass.cpp index 5d925c8d4..d8d9e9bc5 100644 --- a/test/std/containers/unord/unord.multiset/emplace.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -42,6 +41,7 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -59,4 +59,6 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp index d9bab1f49..3756476dc 100644 --- a/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.multiset/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -18,6 +16,9 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif #include #include @@ -27,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -44,6 +46,7 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -62,4 +65,16 @@ int main() assert(c.size() == 3); assert(*r == Emplaceable(5, 6)); } +#endif +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_multiset C; + typedef C::iterator R; + C c1; + C c2; + R r = c1.emplace_hint(c2.begin(), 5, 6); + assert(false); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp index ffe6534b2..f5026e102 100644 --- a/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_hint_rvalue.pass.cpp @@ -15,10 +15,13 @@ // iterator insert(const_iterator p, value_type&& x); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif + #include #include -#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -46,7 +49,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -69,6 +72,8 @@ int main() assert(c.size() == 4); assert(*r == 5); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -92,6 +97,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -115,5 +121,18 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_multiset C; + typedef C::iterator R; + typedef C::value_type P; + C c; + C c2; + C::const_iterator e = c2.end(); + R r = c.insert(e, P(3.5)); + assert(false); + } +#endif +#endif } diff --git a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp index 88661b569..9010cac99 100644 --- a/test/std/containers/unord/unord.multiset/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset C; typedef int P; @@ -45,6 +44,7 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -66,4 +66,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp index 893949010..04f9e3416 100644 --- a/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.multiset/insert_rvalue.pass.cpp @@ -18,7 +18,6 @@ #include #include -#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -45,7 +44,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset C; typedef C::iterator R; @@ -67,6 +66,8 @@ int main() assert(c.size() == 4); assert(*r == 5); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -89,6 +90,7 @@ int main() assert(c.size() == 4); assert(*r == 5.5); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_multiset, std::equal_to, min_allocator> C; @@ -111,5 +113,6 @@ int main() assert(c.size() == 4); assert(*r == 5); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp index ce664034d..3e4230530 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -29,6 +27,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator A; typedef std::unordered_multiset= 11 { typedef min_allocator A; typedef std::unordered_multiset // template , class Pred = equal_to, @@ -30,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator A; typedef std::unordered_multiset= 11 { typedef test_allocator A; typedef std::unordered_multiset= 1 + { + std::unordered_multiset s1 = {1, 2, 3}; + std::unordered_multiset::iterator i = s1.begin(); + int k = *i; + std::unordered_multiset s2; + s2 = std::move(s1); + assert(*i == k); + s2.erase(i); + assert(s2.size() == 2); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp index df49abe07..ced52b5e6 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -30,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -60,6 +59,7 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -159,5 +159,7 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // TEST_STD_VER > 11 +#endif +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp index b83507934..845139f98 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -63,6 +62,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -95,4 +95,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp index 92edfc35b..4dc78bd26 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -65,6 +64,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -98,4 +98,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp index 877306db6..f33120859 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -66,6 +65,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -100,4 +100,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp index e77be8463..17f064f46 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_multiset >, @@ -67,6 +66,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset >, @@ -102,4 +102,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp index fb144d9b1..bc804b42e 100644 --- a/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator A; @@ -121,6 +120,7 @@ int main() assert(c0.empty()); } +#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator A; @@ -203,4 +203,6 @@ int main() assert(c0.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace.pass.cpp b/test/std/containers/unord/unord.set/emplace.pass.cpp index c09ad1505..19af80658 100644 --- a/test/std/containers/unord/unord.set/emplace.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -26,6 +24,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef std::pair R; @@ -45,6 +44,7 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -65,4 +65,6 @@ int main() assert(*r.first == Emplaceable(5, 6)); assert(!r.second); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp index 16f9eff19..97f3591d0 100644 --- a/test/std/containers/unord/unord.set/emplace_hint.pass.cpp +++ b/test/std/containers/unord/unord.set/emplace_hint.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -18,6 +16,9 @@ // template // iterator emplace_hint(const_iterator p, Args&&... args); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif #include #include @@ -27,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef C::iterator R; @@ -44,6 +46,7 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -62,4 +65,16 @@ int main() assert(c.size() == 2); assert(*r == Emplaceable(5, 6)); } +#endif +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_set C; + typedef C::iterator R; + C c1; + C c2; + R r = c1.emplace_hint(c2.begin(), 5, 6); + assert(false); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp index 676c39527..da94bc553 100644 --- a/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_hint_rvalue.pass.cpp @@ -15,10 +15,13 @@ // iterator insert(const_iterator p, value_type&& x); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif + #include #include -#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -46,7 +49,7 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef C::iterator R; @@ -69,6 +72,8 @@ int main() assert(c.size() == 3); assert(*r == 5); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -92,6 +97,7 @@ int main() assert(c.size() == 3); assert(*r == 5.5); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -115,5 +121,18 @@ int main() assert(c.size() == 3); assert(*r == 5); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if _LIBCPP_DEBUG >= 1 + { + typedef std::unordered_set C; + typedef C::iterator R; + typedef C::value_type P; + C c; + C c2; + C::const_iterator e = c2.end(); + R r = c.insert(e, P(3.5)); + assert(false); + } +#endif +#endif } diff --git a/test/std/containers/unord/unord.set/insert_init.pass.cpp b/test/std/containers/unord/unord.set/insert_init.pass.cpp index c106fed10..27b7290eb 100644 --- a/test/std/containers/unord/unord.set/insert_init.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set C; typedef int P; @@ -45,6 +44,7 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -66,4 +66,6 @@ int main() assert(c.count(3) == 1); assert(c.count(4) == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp index 45b168d89..5d12f225c 100644 --- a/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp +++ b/test/std/containers/unord/unord.set/insert_rvalue.pass.cpp @@ -18,7 +18,6 @@ #include #include -#include "test_macros.h" #include "MoveOnly.h" #include "min_allocator.h" @@ -49,7 +48,7 @@ int main() assert(*r.first == 5.5); assert(r.second); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set C; typedef std::pair R; @@ -75,6 +74,8 @@ int main() assert(*r.first == 5); assert(r.second); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#if TEST_STD_VER >= 11 { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -101,6 +102,7 @@ int main() assert(*r.first == 5.5); assert(r.second); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef std::unordered_set, std::equal_to, min_allocator> C; @@ -127,5 +129,6 @@ int main() assert(*r.first == 5); assert(r.second); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp index 4f7ccfec6..2db01a21e 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/assign_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -29,6 +27,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef test_allocator A; typedef std::unordered_set= 11 { typedef min_allocator A; typedef std::unordered_set // template , class Pred = equal_to, @@ -30,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef test_allocator A; typedef std::unordered_set= 11 { typedef min_allocator A; typedef std::unordered_set= 1 + { + std::unordered_set s1 = {1, 2, 3}; + std::unordered_set::iterator i = s1.begin(); + int k = *i; + std::unordered_set s2; + s2 = std::move(s1); + assert(*i == k); + s2.erase(i); + assert(s2.size() == 2); + } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp index 7ba340bf9..eea61c7ab 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -30,7 +28,8 @@ int main() { - { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + { typedef std::unordered_set >, test_compare >, @@ -60,6 +59,7 @@ int main() assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -160,4 +160,6 @@ int main() assert(c.max_load_factor() == 1); } #endif +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp index 0ca9b4857..95baa3df2 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -31,6 +29,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -63,6 +62,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -95,4 +95,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp index 45ed588a7..108d67b66 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -65,6 +64,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -98,4 +98,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp index 8ace22a58..5cb4d499a 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -66,6 +65,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -100,4 +100,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp index 4fd50a818..7c1cbc866 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/init_size_hash_equal_allocator.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -32,6 +30,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::unordered_set >, @@ -67,6 +66,7 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#if TEST_STD_VER >= 11 { typedef std::unordered_set >, @@ -102,4 +102,6 @@ int main() assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp index bcd10b077..4d2830b3a 100644 --- a/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp +++ b/test/std/containers/unord/unord.set/unord.set.cnstr/move_alloc.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Pred = equal_to, @@ -30,6 +28,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { typedef int P; typedef test_allocator A; @@ -112,6 +111,7 @@ int main() assert(c0.empty()); } +#if TEST_STD_VER >= 11 { typedef int P; typedef min_allocator A; @@ -153,4 +153,6 @@ int main() assert(c0.empty()); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp deleted file mode 100644 index fc37c9a59..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.cxx1z.fail.cpp +++ /dev/null @@ -1,25 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// pointer_to_binary_function -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -double binary_f(int i, short j) {return i - j + .75;} - -int main() -{ - typedef std::pointer_to_binary_function F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp index e47731a65..41c99998c 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_binary_function.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // pointer_to_binary_function diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp index 2d713b3be..126cf32af 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // pointer_to_unary_function diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp deleted file mode 100644 index 2d2321936..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.cxx1z.fail.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// pointer_to_unary_function -// ptr_fun(Result (*f)(Arg)); -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -double unary_f(int i) {return 0.5 - i;} - -int main() -{ - assert(std::ptr_fun(unary_f)(36) == -35.5); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp index 65f2a8d34..c7ce90df3 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun1.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // pointer_to_unary_function diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp deleted file mode 100644 index 202abe25e..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.cxx1z.fail.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// pointer_to_binary_function -// ptr_fun(Result (*f)(Arg1, Arg2)); -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -double binary_f(int i, short j) {return i - j + .75;} - -int main() -{ - assert(std::ptr_fun(binary_f)(36, 27) == 9.75); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp index 5628c026c..17c4b611a 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/ptr_fun2.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // pointer_to_binary_function diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp deleted file mode 100644 index 1c56aa9f5..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// const_mem_fun_t -// mem_fun(S (T::*f)() const); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - const A a = A(); - assert(std::mem_fun(&A::a3)(&a) == 1); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp index 4693c816c..455eed9b3 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp deleted file mode 100644 index c727e955b..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// const_mem_fun1_t -// mem_fun(S (T::*f)(A) const); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - const A a = A(); - assert(std::mem_fun(&A::a4)(&a, 6) == 5); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp index 9f0b605d9..46fd6d28d 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp deleted file mode 100644 index 39b3112da..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// const_mem_fun1_ref_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::const_mem_fun1_ref_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp index 65fc8c07e..0c4bb93ff 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_ref_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp deleted file mode 100644 index f07a3b798..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// const_mem_fun1_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::const_mem_fun1_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp index 71588fa1f..ca670bcde 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun1_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp deleted file mode 100644 index fea1441b3..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// const_mem_fun_ref_t -// mem_fun_ref(S (T::*f)() const); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - const A a = A(); - assert(std::mem_fun_ref(&A::a3)(a) == 1); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp index 22f44c65c..74d8950de 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp deleted file mode 100644 index f993b7ce1..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// const_mem_fun1_ref_t -// mem_fun_ref(S (T::*f)(A) const); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - const A a = A(); - assert(std::mem_fun_ref(&A::a4)(a, 6) == 5); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp index 267b80681..b858561ae 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref1.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // const_mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp deleted file mode 100644 index e195213f9..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// const_mem_fun_ref_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::const_mem_fun_ref_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp index 6f80993cb..9eec24e57 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_ref_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp deleted file mode 100644 index 228eb3da6..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// const_mem_fun_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::const_mem_fun_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp index 01945fc46..9681b74d7 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/const_mem_fun_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // const_mem_fun_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp deleted file mode 100644 index 8f59a1ae2..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// mem_fun_t -// mem_fun(S (T::*f)()); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - A a; - assert(std::mem_fun(&A::a1)(&a) == 5); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp index f3c12973f..d0d286009 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp deleted file mode 100644 index 6191de3fb..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// mem_fun1_t -// mem_fun(S (T::*f)(A)); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - A a; - assert(std::mem_fun(&A::a2)(&a, 5) == 6); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp index 30f3c9422..acee9afee 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp deleted file mode 100644 index 0effd33f3..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// mem_fun1_ref_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::mem_fun1_ref_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp index 0b63bb76d..a78cbf25c 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_ref_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp deleted file mode 100644 index aa8e25abe..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// mem_fun1_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::mem_fun1_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp index 79895c4b4..90ba9bbf7 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun1_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun1_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp deleted file mode 100644 index ff7f28af8..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// mem_fun_ref_t -// mem_fun_ref(S (T::*f)()); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - A a; - assert(std::mem_fun_ref(&A::a1)(a) == 5); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp index 8a6a8b943..d3843fc53 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp deleted file mode 100644 index 82d47fefd..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.cxx1z.fail.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// mem_fun1_ref_t -// mem_fun_ref(S (T::*f)(A)); -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - A a; - assert(std::mem_fun_ref(&A::a2)(a, 5) == 6); -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp index 142b16a6b..39a324d10 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref1.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // mem_fun1_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp deleted file mode 100644 index f1cf01c5c..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// mem_fun_ref_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::mem_fun_ref_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp index 5af028b39..236d8d094 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_ref_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun_ref_t diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp deleted file mode 100644 index e6a1ed330..000000000 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.cxx1z.fail.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// mem_fun_t -// Removed in c++1z -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -#include -#include -#include - -#include "test_macros.h" - -struct A -{ - char a1() {return 5;} - short a2(int i) {return short(i+1);} - int a3() const {return 1;} - double a4(unsigned i) const {return i-1;} -}; - -int main() -{ - typedef std::mem_fun_t F; -} diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp index c33e2f7d7..3fc84cd05 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp +++ b/test/std/depr/depr.function.objects/depr.adaptors/depr.member.pointer.adaptors/mem_fun_t.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // mem_fun_t diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp index 796e4ad87..b6b75263c 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.bind.1st/bind1st.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // binder1st diff --git a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp index cbf1dbf9f..b7feb243b 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.bind.2nd/bind2nd.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // binder2nd diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp index 480148b76..8b7aaf0fd 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.binder.1st/binder1st.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // class binder1st diff --git a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp index 3dfb1f02d..645c1688c 100644 --- a/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp +++ b/test/std/depr/depr.lib.binders/depr.lib.binder.2nd/binder2nd.pass.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// // -// REQUIRES: c++98 || c++03 || c++11 || c++14 // template // class binder2nd diff --git a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp index c829a97b4..dda19a951 100644 --- a/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp +++ b/test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -9,10 +9,6 @@ // -// There was an overflow in the dylib on older macOS versions -// UNSUPPORTED: availability=macosx10.8 -// UNSUPPORTED: availability=macosx10.7 - // class strstreambuf // int overflow(int c); diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp index 0783de85c..65ecc4921 100644 --- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp @@ -7,13 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // class error_category @@ -31,7 +24,7 @@ void test_message_for_bad_value() { errno = E2BIG; // something that message will never generate const std::error_category& e_cat1 = std::generic_category(); const std::string msg = e_cat1.message(-1); - LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error"); + LIBCPP_ASSERT(msg == "Unknown error -1"); assert(errno == E2BIG); } diff --git a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp index 8cccb0255..d1a94883f 100644 --- a/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp @@ -13,13 +13,6 @@ // const error_category& system_category(); -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - #include #include #include @@ -31,7 +24,7 @@ void test_message_for_bad_value() { errno = E2BIG; // something that message will never generate const std::error_category& e_cat1 = std::system_category(); const std::string msg = e_cat1.message(-1); - LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error"); + LIBCPP_ASSERT(msg == "Unknown error -1"); assert(errno == E2BIG); } diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp index dac13bdb8..4091f446a 100644 --- a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp @@ -29,7 +29,6 @@ test(int i) typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); diff --git a/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp index eef37c68b..d455210c2 100644 --- a/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp +++ b/test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp @@ -29,7 +29,6 @@ test(int i) typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); H h; T ec(i, std::system_category()); const std::size_t result = h(ec); diff --git a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp index 7140fab88..17b01fe63 100644 --- a/test/std/experimental/any/any.class/any.assign/copy.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/copy.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any& operator=(any const &); diff --git a/test/std/experimental/any/any.class/any.assign/move.pass.cpp b/test/std/experimental/any/any.class/any.assign/move.pass.cpp index 35fc56c24..49508febd 100644 --- a/test/std/experimental/any/any.class/any.assign/move.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/move.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any& operator=(any &&); diff --git a/test/std/experimental/any/any.class/any.assign/value.pass.cpp b/test/std/experimental/any/any.class/any.assign/value.pass.cpp index 8ff4ad594..b42a4ba2b 100644 --- a/test/std/experimental/any/any.class/any.assign/value.pass.cpp +++ b/test/std/experimental/any/any.class/any.assign/value.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any& operator=(any const &); @@ -181,4 +174,4 @@ int main() { test_assign_throws(); test_assign_throws(); test_assign_throws(); -} +} \ No newline at end of file diff --git a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp index 47f12d739..69341ca6b 100644 --- a/test/std/experimental/any/any.class/any.cons/copy.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/copy.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any(any const &); diff --git a/test/std/experimental/any/any.class/any.cons/move.pass.cpp b/test/std/experimental/any/any.class/any.cons/move.pass.cpp index c5395daa3..2a050946a 100644 --- a/test/std/experimental/any/any.class/any.cons/move.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/move.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any(any &&) noexcept; diff --git a/test/std/experimental/any/any.class/any.cons/value.pass.cpp b/test/std/experimental/any/any.class/any.cons/value.pass.cpp index fcace5028..a3ab0edc8 100644 --- a/test/std/experimental/any/any.class/any.cons/value.pass.cpp +++ b/test/std/experimental/any/any.class/any.cons/value.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template any(Value &&) @@ -120,4 +113,4 @@ int main() { test_copy_value_throws(); test_copy_value_throws(); test_move_value_throws(); -} +} \ No newline at end of file diff --git a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp index 1b0b75d61..781ed73f2 100644 --- a/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp +++ b/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any::clear() noexcept diff --git a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp index 9f499b4a1..b1d315468 100644 --- a/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp +++ b/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any::swap(any &) noexcept diff --git a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp index ca6d1de11..47fe52f7b 100644 --- a/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp +++ b/test/std/experimental/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp @@ -9,8 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx - // // template diff --git a/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp b/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp index 1c52a64fc..c6cc68d72 100644 --- a/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp +++ b/test/std/experimental/any/any.nonmembers/any.cast/not_copy_constructible.fail.cpp @@ -42,4 +42,4 @@ int main() { any_cast(static_cast(a)); // expected-error@experimental/any:* 3 {{static_assert failed "_ValueType is required to be a reference or a CopyConstructible type."}} // expected-error@experimental/any:* 3 {{calling a private constructor of class 'no_copy'}} -} +} \ No newline at end of file diff --git a/test/std/experimental/any/any.nonmembers/swap.pass.cpp b/test/std/experimental/any/any.nonmembers/swap.pass.cpp index e79bc9ef0..a3fbd43d9 100644 --- a/test/std/experimental/any/any.nonmembers/swap.pass.cpp +++ b/test/std/experimental/any/any.nonmembers/swap.pass.cpp @@ -34,8 +34,7 @@ int main() swap(a1, a2); - // Support testing against system dylibs that don't have bad_any_cast. - assert(*any_cast(&a1) == 2); - assert(*any_cast(&a2) == 1); + assert(any_cast(a1) == 2); + assert(any_cast(a2) == 1); } } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 078e00666..4c83481aa 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -54,6 +54,12 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" +template +std::reverse_iterator mkRev(It it) { + return std::reverse_iterator(it); +} + + namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { @@ -141,11 +147,7 @@ void decompPathTest() assert(checkCollectionsEqual(p.begin(), p.end(), TC.elements.begin(), TC.elements.end())); // check backwards - - std::vector Parts; - for (auto it = p.end(); it != p.begin(); ) - Parts.push_back(*--it); - assert(checkCollectionsEqual(Parts.begin(), Parts.end(), + assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), TC.elements.rbegin(), TC.elements.rend())); } } diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp deleted file mode 100644 index 30081fc3a..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.capacity/operator_bool.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// constexpr explicit operator bool() const noexcept - -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test() { - static_assert(std::is_nothrow_constructible::value, ""); - static_assert(!std::is_convertible::value, ""); - { - constexpr C c; ((void)c); - static_assert(bool(c) == false, ""); - } - { // null case - const C c = {}; ((void)c); - ASSERT_NOEXCEPT(bool(c)); - if (c) - assert(false); - else - assert(true); - assert(c.address() == nullptr); - assert(bool(c) == false); - } - { // non-null case - char dummy = 42; - C c = C::from_address((void*)&dummy); - assert(c.address() == &dummy); - assert(bool(c) == true); - } -} - -int main() -{ - do_test>(); - do_test>(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp deleted file mode 100644 index 278ea9d06..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/equal_comp.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// bool operator==(coroutine_handle<>, coroutine_handle<>) noexcept -// bool operator!=(coroutine_handle<>, coroutine_handle<>) noexcept - -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { - const C LHS = C::from_address(reinterpret_cast(LHSVal)); - const C RHS = C::from_address(reinterpret_cast(RHSVal)); - const bool ExpectIsEqual = (LHSVal == RHSVal); - assert((LHS == RHS) == ExpectIsEqual); - assert((RHS == LHS) == ExpectIsEqual); - assert((LHS != RHS) == !ExpectIsEqual); - assert((RHS != LHS) == !ExpectIsEqual); - { - static_assert(noexcept(LHS == RHS), ""); - static_assert(noexcept(LHS != RHS), ""); - ASSERT_SAME_TYPE(decltype(LHS == RHS), bool); - ASSERT_SAME_TYPE(decltype(LHS != RHS), bool); - } -} - -int main() -{ - std::pair const TestCases[] = { - {0, 0}, - {16, 16}, - {0, 16}, - {16, 0} - }; - for (auto& TC : TestCases) { - do_test>(TC.first, TC.second); - do_test>(TC.first, TC.second); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp deleted file mode 100644 index e92adf033..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.compare/less_comp.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// bool operator<(coroutine_handle<>, coroutine_handle<>) noexcept -// bool operator>(coroutine_handle<>, coroutine_handle<>) noexcept -// bool operator>=(coroutine_handle<>, coroutine_handle<>) noexcept -// bool operator<=(coroutine_handle<>, coroutine_handle<>) noexcept - -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { - const C LHS = C::from_address(reinterpret_cast(LHSVal)); - const C RHS = C::from_address(reinterpret_cast(RHSVal)); - assert((LHS < RHS) == (LHSVal < RHSVal)); - assert((RHS < LHS) == (RHSVal < LHSVal)); - assert((LHS > RHS) == (LHSVal > RHSVal)); - assert((RHS > LHS) == (RHSVal > LHSVal)); - assert((LHS <= RHS) == (LHSVal <= RHSVal)); - assert((RHS <= LHS) == (RHSVal <= LHSVal)); - assert((LHS >= RHS) == (LHSVal >= RHSVal)); - assert((RHS >= LHS) == (RHSVal >= LHSVal)); - { - static_assert(noexcept(LHS < RHS), ""); - static_assert(noexcept(LHS > RHS), ""); - static_assert(noexcept(LHS <= RHS), ""); - static_assert(noexcept(LHS >= RHS), ""); - ASSERT_SAME_TYPE(decltype(LHS < RHS), bool); - ASSERT_SAME_TYPE(decltype(LHS > RHS), bool); - ASSERT_SAME_TYPE(decltype(LHS <= RHS), bool); - ASSERT_SAME_TYPE(decltype(LHS >= RHS), bool); - } -} - -int main() -{ - std::pair const TestCases[] = { - {0, 0}, - {16, 16}, - {0, 16}, - {16, 0} - }; - for (auto& TC : TestCases) { - do_test>(TC.first, TC.second); - do_test>(TC.first, TC.second); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp deleted file mode 100644 index 240d93245..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.completion/done.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// bool done() const - -#include -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test(coro::coroutine_handle const& H) { - // FIXME Add a runtime test - { - ASSERT_SAME_TYPE(decltype(H.done()), bool); - LIBCPP_ASSERT_NOT_NOEXCEPT(H.done()); - } -} - -int main() -{ - do_test(coro::coroutine_handle<>{}); - do_test(coro::coroutine_handle{}); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp deleted file mode 100644 index 0cd3d05c2..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/assign.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// coroutine_handle& operator=(nullptr_t) noexcept - -#include -#include -#include - -namespace coro = std::experimental; - -template -void do_test() { - int dummy = 42; - void* dummy_h = &dummy; - { - C c; ((void)c); - static_assert(std::is_nothrow_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - } - { - C c = C::from_address(dummy_h); - assert(c.address() == &dummy); - c = nullptr; - assert(c.address() == nullptr); - c = nullptr; - assert(c.address() == nullptr); - } - { - C c; - C& cr = (c = nullptr); - assert(&c == &cr); - } -} - -int main() -{ - do_test>(); - do_test>(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp deleted file mode 100644 index be5174dd3..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.con/construct.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// constexpr coroutine_handle() noexcept -// constexpr coroutine_handle(nullptr_t) noexcept - -#include -#include -#include - -namespace coro = std::experimental; - -template -void do_test() { - { - constexpr C c; - static_assert(std::is_nothrow_default_constructible::value, ""); - static_assert(c.address() == nullptr, ""); - } - { - constexpr C c(nullptr); - static_assert(std::is_nothrow_constructible::value, ""); - static_assert(c.address() == nullptr, ""); - } - { - C c; - assert(c.address() == nullptr); - } - { - C c(nullptr); - assert(c.address() == nullptr); - } -} - -int main() -{ - do_test>(); - do_test>(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp deleted file mode 100644 index aba5eb663..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/address.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// constexpr void* address() const noexcept - -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test() { - { - constexpr C c; ((void)c); - static_assert(c.address() == nullptr, ""); - } - { - const C c = {}; ((void)c); - ASSERT_NOEXCEPT(c.address()); - ASSERT_SAME_TYPE(decltype(c.address()), void*); - assert(c.address() == nullptr); - } - { - char dummy = 42; - C c = C::from_address((void*)&dummy); - assert(c.address() == &dummy); - } -} - -int main() -{ - do_test>(); - do_test>(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp deleted file mode 100644 index 1c87b9443..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.fail.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 -// - -// template -// struct coroutine_handle; - -// static coroutine_handle from_address(void*) noexcept - -// Test that `from_address` is explicitly ill-formed when called with a typed -// pointer. The user cannot possibly have a typed pointer to the coroutine. -// FIXME: This behavior is an extension, and should upstreamed into the TS or -// the test removed if the TS changes are rejected. - -#include -#include -#include - -namespace coro = std::experimental; - -int main() -{ - { - using H = coro::coroutine_handle<>; - // expected-error@experimental/coroutine:* 3 {{coroutine_handle::from_address cannot be called with non-void pointers}} - H::from_address((int*)nullptr); // expected-note {{requested here}} - H::from_address((const void*)nullptr); // expected-note {{requested here}} - H::from_address((const char*)nullptr); // expected-note {{requested here}} - } - { - using H = coro::coroutine_handle; - // expected-error@experimental/coroutine:* 1 {{static_assert failed "coroutine_handle::from_address cannot be used with pointers to the coroutine's promise type; use 'from_promise' instead"}} - H::from_address((const char*)nullptr); // expected-note {{requested here}} - // expected-error@experimental/coroutine:* 1 {{coroutine_handle::from_address cannot be called with non-void pointers}} - H::from_address((int*)nullptr); // expected-note {{requested here}} - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp deleted file mode 100644 index 636d5da4e..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.export/from_address.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// static coroutine_handle from_address(void*) noexcept - -#include -#include -#include - -namespace coro = std::experimental; - -template -void do_test() { - { - C c = C::from_address(nullptr); - static_assert(noexcept(C::from_address(nullptr)), ""); - // FIXME: Should the return type not be 'C'? - static_assert(std::is_same::value, ""); - assert(c.address() == nullptr); - } - { - char dummy = 42; - C c = C::from_address((void*)&dummy); - assert(c.address() == &dummy); - } -} - -int main() -{ - do_test>(); - do_test>(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp deleted file mode 100644 index 342232962..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.hash/hash.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// namespace std { -// template struct hash>; -// } - -#include -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test(uintptr_t LHSVal, uintptr_t RHSVal) { - const size_t ExpectLHS = std::hash{}(reinterpret_cast(LHSVal)); - const size_t ExpectRHS = std::hash{}(reinterpret_cast(RHSVal)); - const C LHS = C::from_address(reinterpret_cast(LHSVal)); - const C RHS = C::from_address(reinterpret_cast(RHSVal)); - const std::hash h; - // FIXME: libc++'s implementation hash's the result of LHS.address(), so we - // expect that value. However this is not required. - assert(h(LHS) == ExpectLHS); - assert(h(RHS) == ExpectRHS); - assert((h(LHS) == h(RHS)) == (LHSVal == RHSVal)); - { - ASSERT_SAME_TYPE(decltype(h(LHS)), size_t); - ASSERT_NOEXCEPT(std::hash{}(LHS)); - } -} - -int main() -{ - std::pair const TestCases[] = { - {0, 0}, - {0, 8}, - {8, 8}, - {8, 16} - }; - for (auto& TC : TestCases) { - do_test>(TC.first, TC.second); - do_test>(TC.first, TC.second); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp deleted file mode 100644 index 4a61047a8..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// Promise& promise() const - -#include -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -void do_test(coro::coroutine_handle&& H) { - - // FIXME Add a runtime test - { - ASSERT_SAME_TYPE(decltype(H.promise()), Promise&); - LIBCPP_ASSERT_NOT_NOEXCEPT(H.promise()); - } - { - auto const& CH = H; - ASSERT_SAME_TYPE(decltype(CH.promise()), Promise&); - LIBCPP_ASSERT_NOT_NOEXCEPT(CH.promise()); - } -} - -int main() -{ - do_test(coro::coroutine_handle{}); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp deleted file mode 100644 index df3337c4c..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/destroy.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// void destroy() - -#include -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -template -auto has_destroy_imp(H&& h, int) -> decltype(h.destroy(), std::true_type{}); -template -auto has_destroy_imp(H&&, long) -> std::false_type; - -template -constexpr bool has_destroy() { - return decltype(has_destroy_imp(std::declval(), 0))::value; -} - -template -void do_test(coro::coroutine_handle&& H) { - using HType = coro::coroutine_handle; - // FIXME Add a runtime test - { - ASSERT_SAME_TYPE(decltype(H.destroy()), void); - LIBCPP_ASSERT_NOT_NOEXCEPT(H.destroy()); - static_assert(has_destroy(), ""); - static_assert(has_destroy(), ""); - } - { - static_assert(!has_destroy(), ""); - static_assert(!has_destroy(), ""); - } -} - -int main() -{ - do_test(coro::coroutine_handle<>{}); - do_test(coro::coroutine_handle{}); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp deleted file mode 100644 index 21c05e2be..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.resumption/resume.pass.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// template -// struct coroutine_handle; - -// void operator()() -// void resume() - -#include -#include -#include -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - - -template -auto has_resume_imp(H&& h, int) -> decltype(h.resume(), std::true_type{}); -template -auto has_resume_imp(H&&, long) -> std::false_type; - -template -constexpr bool has_resume() { - return decltype(has_resume_imp(std::declval(), 0))::value; -} - - -template -auto has_call_operator_imp(H&& h, int) -> decltype(h(), std::true_type{}); -template -auto has_call_operator_imp(H&&, long) -> std::false_type; - -template -constexpr bool has_call_operator() { - return decltype(has_call_operator_imp(std::declval(), 0))::value; -} - -template -void do_test(coro::coroutine_handle&& H) { - using HType = coro::coroutine_handle; - // FIXME Add a runtime test - { - ASSERT_SAME_TYPE(decltype(H.resume()), void); - ASSERT_SAME_TYPE(decltype(H()), void); - LIBCPP_ASSERT_NOT_NOEXCEPT(H.resume()); - LIBCPP_ASSERT_NOT_NOEXCEPT(H()); - static_assert(has_resume(), ""); - static_assert(has_resume(), ""); - static_assert(has_call_operator(), ""); - static_assert(has_call_operator(), ""); - } - { - static_assert(!has_resume(), ""); - static_assert(!has_resume(), ""); - static_assert(!has_call_operator(), ""); - static_assert(!has_call_operator(), ""); - } -} - -int main() -{ - do_test(coro::coroutine_handle<>{}); - do_test(coro::coroutine_handle{}); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp deleted file mode 100644 index 844d34cc4..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/void_handle.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include - -namespace coro = std::experimental; - -struct A { - using promise_type = A*; -}; - -struct B {}; -struct C {}; - -namespace std { namespace experimental { - template <> - struct coroutine_traits<::A, int> { - using promise_type = int*; - }; - template - struct coroutine_traits<::B, Args...> { - using promise_type = B*; - }; - template <> - struct coroutine_traits<::C> { - using promise_type = void; - }; -}} - -template -void check_type() { - using P = typename coro::coroutine_traits::promise_type ; - static_assert(std::is_same::value, ""); -}; - -int main() -{ - check_type(); - check_type(); - check_type(); - check_type(); -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp deleted file mode 100644 index e26f333aa..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.traits/promise_type.pass.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include - -namespace coro = std::experimental; - -template -constexpr bool has_promise_type(int) { return true; } -template -constexpr bool has_promise_type(long) { return false; } -template -constexpr bool has_promise_type() { return has_promise_type(0); } - -struct A { - using promise_type = A*; -}; - -struct B {}; -struct C {}; -struct D { -private: - using promise_type = void; -}; -struct E {}; - -namespace std { namespace experimental { - template <> - struct coroutine_traits<::A, int> { - using promise_type = int*; - }; - template - struct coroutine_traits<::B, Args...> { - using promise_type = B*; - }; - template <> - struct coroutine_traits<::C> { - using promise_type = void; - }; -}} - -template -void check_type() { - using Traits = coro::coroutine_traits; - static_assert(has_promise_type(), ""); - static_assert(std::is_same::value, ""); -} - -template -void check_no_type() { - using Traits = coro::coroutine_traits; - static_assert(!has_promise_type(), ""); -} - -int main() -{ - { - check_type(); - check_type(); - check_type(); - check_type(); - } - { - check_no_type(); - check_no_type(); - check_no_type(); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp deleted file mode 100644 index b10e72082..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_always.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -using SuspendT = std::experimental::coroutines_v1::suspend_always; - -TEST_SAFE_STATIC SuspendT safe_sa; -constexpr SuspendT constexpr_sa; - -constexpr bool check_suspend_constexpr() { - SuspendT s{}; - const SuspendT scopy(s); ((void)scopy); - SuspendT smove(std::move(s)); ((void)smove); - s = scopy; - s = std::move(smove); - return true; -} - -int main() -{ - using H = coro::coroutine_handle<>; - using S = SuspendT; - H h{}; - S s{}; - S const& cs = s; - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_ready()), ""); - static_assert(std::is_same::value, ""); - assert(s.await_ready() == false); - assert(cs.await_ready() == false); - } - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_suspend(h)), ""); - static_assert(std::is_same::value, ""); - s.await_suspend(h); - cs.await_suspend(h); - } - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_resume()), ""); - static_assert(std::is_same::value, ""); - s.await_resume(); - cs.await_resume(); - } - { - static_assert(std::is_nothrow_default_constructible::value, ""); - static_assert(std::is_nothrow_copy_constructible::value, ""); - static_assert(std::is_nothrow_move_constructible::value, ""); - static_assert(std::is_nothrow_copy_assignable::value, ""); - static_assert(std::is_nothrow_move_assignable::value, ""); - static_assert(std::is_trivially_copyable::value, ""); - static_assert(check_suspend_constexpr(), ""); - } - { - // suppress unused warnings for the global constexpr test variable - ((void)constexpr_sa); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp deleted file mode 100644 index 9c2f39238..000000000 --- a/test/std/experimental/language.support/support.coroutines/coroutine.trivial.awaitables/suspend_never.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include -#include - -#include "test_macros.h" - -namespace coro = std::experimental; - -// Test that the type is in the correct namespace -using SuspendT = std::experimental::coroutines_v1::suspend_never; - -TEST_SAFE_STATIC SuspendT safe_sn; -constexpr SuspendT constexpr_sn; - -constexpr bool check_suspend_constexpr() { - SuspendT s{}; - const SuspendT scopy(s); ((void)scopy); - SuspendT smove(std::move(s)); ((void)smove); - s = scopy; - s = std::move(smove); - return true; -} - - -int main() -{ - using H = coro::coroutine_handle<>; - using S = SuspendT; - H h{}; - S s{}; - S const& cs = s; - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_ready()), ""); - static_assert(std::is_same::value, ""); - assert(s.await_ready() == true); - assert(cs.await_ready() == true); - } - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_suspend(h)), ""); - static_assert(std::is_same::value, ""); - s.await_suspend(h); - cs.await_suspend(h); - } - { - LIBCPP_STATIC_ASSERT(noexcept(s.await_resume()), ""); - static_assert(std::is_same::value, ""); - s.await_resume(); - cs.await_resume(); - } - { - static_assert(std::is_nothrow_default_constructible::value, ""); - static_assert(std::is_nothrow_copy_constructible::value, ""); - static_assert(std::is_nothrow_move_constructible::value, ""); - static_assert(std::is_nothrow_copy_assignable::value, ""); - static_assert(std::is_nothrow_move_assignable::value, ""); - static_assert(std::is_trivially_copyable::value, ""); - static_assert(check_suspend_constexpr(), ""); - } - { - // suppress unused warnings for the global constexpr test variable - ((void)constexpr_sn); - } -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp deleted file mode 100644 index b8606317a..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/await_result.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include - -using namespace std::experimental; - -struct coro_t { - struct promise_type { - coro_t get_return_object() { - coroutine_handle{}; - return {}; - } - suspend_never initial_suspend() { return {}; } - suspend_never final_suspend() { return {}; } - void return_void() {} - static void unhandled_exception() {} - }; -}; - -struct B { - ~B() {} - bool await_ready() { return true; } - B await_resume() { return {}; } - template void await_suspend(F) {} -}; - - -struct A { - ~A() {} - bool await_ready() { return true; } - int await_resume() { return 42; } - template void await_suspend(F) {} -}; - -int last_value = -1; -void set_value(int x) { - last_value = x; -} - -coro_t f(int n) { - if (n == 0) { - set_value(0); - co_return; - } - int val = co_await A{}; - ((void)val); - set_value(42); -} - -coro_t g() { B val = co_await B{}; } - -int main() { - last_value = -1; - f(0); - assert(last_value == 0); - f(1); - assert(last_value == 42); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp deleted file mode 100644 index 12ab92ff3..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/bool_await_suspend.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// See https://bugs.llvm.org/show_bug.cgi?id=33271 -// UNSUPPORTED: ubsan - -#include -#include - -using namespace std::experimental; - -struct coro_t { - struct promise_type { - coro_t get_return_object() { - return coroutine_handle::from_promise(*this); - } - suspend_never initial_suspend() { return {}; } - suspend_never final_suspend() { return {}; } - void return_void() {} - void unhandled_exception() {} - }; - coro_t(coroutine_handle hh) : h(hh) {} - coroutine_handle h; -}; - -struct NoSuspend { - bool await_ready() { return false; } - void await_resume() {} - template bool await_suspend(F) { return false; } -}; - -struct DoSuspend { - bool await_ready() { return false; } - void await_resume() {} - template bool await_suspend(F) { return true; } -}; - -bool f_started, f_resumed = false; -coro_t f() { - f_started = true; - co_await DoSuspend{}; - f_resumed = true; -} - -bool g_started, g_resumed = false; -coro_t g() { - g_started = true; - co_await NoSuspend{}; - g_resumed = true; -} - -int main() { - assert(!f_started && !f_resumed && !g_started && !g_resumed); - auto fret = f(); - assert(f_started && !f_resumed); - fret.h.destroy(); - assert(f_started && !f_resumed); - g(); - assert(g_started && g_resumed); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp deleted file mode 100644 index 77070cc5a..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/expected.pass.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include -using namespace std::experimental; - -struct error {}; - -template -struct expected { - - struct Data { - T val; - Error error; - }; - Data data; - - struct DataPtr { - Data *p; - ~DataPtr() { delete p; } - }; - - expected() {} - expected(T val) : data{std::move(val),{}} {} - expected(struct error, Error error) : data{{}, std::move(error)} {} - expected(DataPtr & p) : data{std::move(p.p->val), std::move(p.p->error)} {} - - struct promise_type { - Data* data; - DataPtr get_return_object() { data = new Data{}; return {data}; } - suspend_never initial_suspend() { return {}; } - suspend_never final_suspend() { return {}; } - void return_value(T v) { data->val = std::move(v); data->error = {};} - void unhandled_exception() {} - }; - - bool await_ready() { return !data.error; } - T await_resume() { return std::move(data.val); } - void await_suspend(coroutine_handle h) { - h.promise().data->error =std::move(data.error); - h.destroy(); - } - - T const& value() { return data.val; } - Error const& error() { return data.error; } -}; - -expected g() { return {0}; } -expected h() { return {error{}, 42}; } - -extern "C" void print(int); - -bool f1_started, f1_resumed = false; -expected f1() { - f1_started = true; - (void)(co_await g()); - f1_resumed = true; - co_return 100; -} - -bool f2_started, f2_resumed = false; -expected f2() { - f2_started = true; - (void)(co_await h()); - f2_resumed = true; - co_return 200; -} - -int main() { - auto c1 = f1(); - assert(f1_started && f1_resumed); - assert(c1.value() == 100); - assert(c1.error() == 0); - - auto c2 = f2(); - assert(f2_started && !f2_resumed); - assert(c2.value() == 0); - assert(c2.error() == 42); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp deleted file mode 100644 index 20bcf60fb..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/fullexpr-dtor.pass.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include - -#include "test_macros.h" - -using namespace std::experimental; - -int alive = 0; -int ctor_called = 0; -int dtor_called = 0; -void reset() { - assert(alive == 0); - alive = 0; - ctor_called = 0; - dtor_called = 0; -} -struct Noisy { - Noisy() { ++alive; ++ctor_called; } - ~Noisy() { --alive; ++dtor_called; } -#if TEST_STD_VER > 14 - Noisy(Noisy const&) = delete; -#else - // FIXME: This test depends on copy elision taking place in C++14 - // (pre-c++17 guaranteed copy elision) - Noisy(Noisy const&); -#endif -}; - -struct Bug { - bool await_ready() { return true; } - void await_suspend(std::experimental::coroutine_handle<>) {} - Noisy await_resume() { return {}; } -}; -struct coro2 { - struct promise_type { - suspend_never initial_suspend() { return{}; } - suspend_never final_suspend() { return{}; } - coro2 get_return_object() { return{}; } - void return_void() {} - Bug yield_value(int) { return {}; } - void unhandled_exception() {} - }; -}; - -// Checks that destructors are correctly invoked for the object returned by -// coawait. -coro2 a() { - reset(); - { - auto x = co_await Bug{}; - assert(alive == 1); - assert(ctor_called == 1); - assert(dtor_called == 0); - ((void)x); - } - assert(alive == 0); - assert(dtor_called == 1); -} - -coro2 b() { - reset(); - { - (void)(co_await Bug{}); - assert(ctor_called == 1); - assert(dtor_called == 1); - assert(alive == 0); - } - assert(ctor_called == 1); - assert(dtor_called == 1); - assert(alive == 0); - -} - -coro2 c() { - reset(); - { - auto x = co_yield 42; - assert(alive == 1); - assert(ctor_called == 1); - assert(dtor_called == 0); - } - assert(alive == 0); - assert(ctor_called == 1); - assert(dtor_called == 1); -} - -coro2 d() { - reset(); - { - (void)(co_yield 42); - assert(ctor_called == 1); - assert(dtor_called == 1); - assert(alive == 0); - } - assert(alive == 0); - assert(ctor_called == 1); - assert(dtor_called == 1); -} - -int main() { - a(); - b(); - c(); - d(); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp deleted file mode 100644 index c92e26184..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/generator.pass.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// See https://bugs.llvm.org/show_bug.cgi?id=33271 -// UNSUPPORTED: ubsan - -#include -#include -#include - -#include "coroutine_types.h" - -using namespace std::experimental; - -struct minig { - struct promise_type { - int current_value; - suspend_always yield_value(int value) { - this->current_value = value; - return {}; - } - suspend_always initial_suspend() { return {}; } - suspend_always final_suspend() { return {}; } - minig get_return_object() { return minig{this}; }; - void return_void() {} - void unhandled_exception() {} - }; - - bool move_next() { - p.resume(); - return !p.done(); - } - int current_value() { return p.promise().current_value; } - - minig(minig &&rhs) : p(rhs.p) { rhs.p = nullptr; } - - ~minig() { - if (p) - p.destroy(); - } - -private: - explicit minig(promise_type *p) - : p(coroutine_handle::from_promise(*p)) {} - - coroutine_handle p; -}; - - -minig mini_count(int n) { - for (int i = 0; i < n; i++) { - co_yield i; - } -} - -generator count(int n) { - for (int i = 0; i < n; ++i) - co_yield i; -} - -generator range(int from, int n) { - for (int i = from; i < n; ++i) - co_yield i; -} - -void test_count() { - const std::vector expect = {0, 1, 2, 3, 4}; - std::vector got; - for (auto x : count(5)) - got.push_back(x); - assert(expect == got); -} - -void test_range() { - int sum = 0; - for (auto v: range(1, 20)) - sum += v; - assert(sum == 190); -} - -void test_mini_generator() { - int sum = 0; - auto g = mini_count(5); - while (g.move_next()) { - sum += g.current_value(); - } - assert(sum == 10); -} - -int main() { - test_count(); - test_range(); - test_mini_generator(); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp deleted file mode 100644 index 1fdf2c855..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include - -using namespace std::experimental; - -bool cancel = false; - -struct goroutine -{ - static int const N = 10; - static int count; - static coroutine_handle<> stack[N]; - - static void schedule(coroutine_handle<>& rh) - { - assert(count < N); - stack[count++] = rh; - rh = nullptr; - } - - ~goroutine() {} - - static void go(goroutine) {} - - static void run_one() - { - assert(count > 0); - stack[--count](); - } - - struct promise_type - { - suspend_never initial_suspend() { - return {}; - } - suspend_never final_suspend() { - return {}; - } - void return_void() {} - goroutine get_return_object() { - return{}; - } - void unhandled_exception() {} - }; -}; -int goroutine::count; -coroutine_handle<> goroutine::stack[N]; - -coroutine_handle workaround; - -class channel; - -struct push_awaiter { - channel* ch; - bool await_ready() {return false; } - void await_suspend(coroutine_handle<> rh); - void await_resume() {} -}; - -struct pull_awaiter { - channel * ch; - - bool await_ready(); - void await_suspend(coroutine_handle<> rh); - int await_resume(); -}; - -class channel -{ - using T = int; - - friend struct push_awaiter; - friend struct pull_awaiter; - - T const* pvalue = nullptr; - coroutine_handle<> reader = nullptr; - coroutine_handle<> writer = nullptr; -public: - push_awaiter push(T const& value) - { - assert(pvalue == nullptr); - assert(!writer); - pvalue = &value; - - return { this }; - } - - pull_awaiter pull() - { - assert(!reader); - - return { this }; - } - - void sync_push(T const& value) - { - assert(!pvalue); - pvalue = &value; - assert(reader); - reader(); - assert(!pvalue); - reader = nullptr; - } - - auto sync_pull() - { - while (!pvalue) goroutine::run_one(); - auto result = *pvalue; - pvalue = nullptr; - if (writer) - { - auto wr = writer; - writer = nullptr; - wr(); - } - return result; - } -}; - -void push_awaiter::await_suspend(coroutine_handle<> rh) -{ - ch->writer = rh; - if (ch->reader) goroutine::schedule(ch->reader); -} - - -bool pull_awaiter::await_ready() { - return !!ch->writer; -} -void pull_awaiter::await_suspend(coroutine_handle<> rh) { - ch->reader = rh; -} -int pull_awaiter::await_resume() { - auto result = *ch->pvalue; - ch->pvalue = nullptr; - if (ch->writer) { - //goroutine::schedule(ch->writer); - auto wr = ch->writer; - ch->writer = nullptr; - wr(); - } - return result; -} - -goroutine pusher(channel& left, channel& right) -{ - for (;;) { - auto val = co_await left.pull(); - co_await right.push(val + 1); - } -} - -const int N = 100; -channel* c = new channel[N + 1]; - -int main() { - for (int i = 0; i < N; ++i) - goroutine::go(pusher(c[i], c[i + 1])); - - c[0].sync_push(0); - int result = c[N].sync_pull(); - - assert(result == 100); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp deleted file mode 100644 index e3c965303..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/multishot_func.pass.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include - -using namespace std::experimental; - -// This file tests, multishot, movable std::function like thing using coroutine -// for compile-time type erasure and unerasure. -template struct func { - struct Input {R a, b;}; - - struct promise_type { - Input* I; - R result; - func get_return_object() { return {this}; } - suspend_always initial_suspend() { return {}; } - suspend_never final_suspend() { return {}; } - void return_void() {} - template - suspend_always yield_value(F&& f) { - result = f(I->a, I->b); - return {}; - } - void unhandled_exception() {} - }; - - R operator()(Input I) { - h.promise().I = &I; - h.resume(); - R result = h.promise().result; - return result; - }; - - func() {} - func(func &&rhs) : h(rhs.h) { rhs.h = nullptr; } - func(func const &) = delete; - - func &operator=(func &&rhs) { - if (this != &rhs) { - if (h) - h.destroy(); - h = rhs.h; - rhs.h = nullptr; - } - return *this; - } - - template static func Create(F f) { - for (;;) { - co_yield f; - } - } - - template func(F f) : func(Create(f)) {} - - ~func() { - if (h) - h.destroy(); - } - -private: - func(promise_type *promise) - : h(coroutine_handle::from_promise(*promise)) {} - coroutine_handle h; -}; - -int Do(int acc, int n, func f) { - for (int i = 0; i < n; ++i) - acc = f({acc, i}); - return acc; -} - -int main() { - int result = Do(1, 10, [](int a, int b) {return a + b;}); - assert(result == 46); -} diff --git a/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp b/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp deleted file mode 100644 index ae0a950dc..000000000 --- a/test/std/experimental/language.support/support.coroutines/end.to.end/oneshot_func.pass.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -#include -#include -#include - -using namespace std::experimental; - -// This file tests, one shot, movable std::function like thing using coroutine -// for compile-time type erasure and unerasure. - -template struct func { - struct promise_type { - R result; - func get_return_object() { return {this}; } - suspend_always initial_suspend() { return {}; } - suspend_always final_suspend() { return {}; } - void return_value(R v) { result = v; } - void unhandled_exception() {} - }; - - R operator()() { - h.resume(); - R result = h.promise().result; - h.destroy(); - h = nullptr; - return result; - }; - - func() {} - func(func &&rhs) : h(rhs.h) { rhs.h = nullptr; } - func(func const &) = delete; - - func &operator=(func &&rhs) { - if (this != &rhs) { - if (h) - h.destroy(); - h = rhs.h; - rhs.h = nullptr; - } - return *this; - } - - template static func Create(F f) { co_return f(); } - - template func(F f) : func(Create(f)) {} - - ~func() { - if (h) - h.destroy(); - } - -private: - func(promise_type *promise) - : h(coroutine_handle::from_promise(*promise)) {} - coroutine_handle h; -}; - -std::vector yielded_values = {}; -int yield(int x) { yielded_values.push_back(x); return x + 1; } -float fyield(int x) { yielded_values.push_back(x); return static_cast(x + 2); } - -void Do1(func f) { yield(f()); } -void Do2(func f) { yield(static_cast(f())); } - -int main() { - Do1([] { return yield(43); }); - assert((yielded_values == std::vector{43, 44})); - - yielded_values = {}; - Do2([] { return fyield(44); }); - assert((yielded_values == std::vector{44, 46})); -} diff --git a/test/std/experimental/language.support/support.coroutines/includes.pass.cpp b/test/std/experimental/language.support/support.coroutines/includes.pass.cpp deleted file mode 100644 index b30d8c7ed..000000000 --- a/test/std/experimental/language.support/support.coroutines/includes.pass.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11 - -// - -// Test that includes - -#include - -int main(){ - // std::nothrow is not implicitly defined by the compiler when the include is - // missing, unlike other parts of . Therefore we use std::nothrow to - // test for #include - (void)std::nothrow; - -} diff --git a/test/std/experimental/language.support/support.coroutines/lit.local.cfg b/test/std/experimental/language.support/support.coroutines/lit.local.cfg deleted file mode 100644 index a0b3de8af..000000000 --- a/test/std/experimental/language.support/support.coroutines/lit.local.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# If the compiler doesn't support coroutines mark all of the tests under -# this directory as unsupported. Otherwise add the required `-fcoroutines-ts` -# flag. -if 'fcoroutines-ts' not in config.available_features: - config.unsupported = True -else: - import copy - config.test_format.cxx = copy.deepcopy(config.test_format.cxx) - config.test_format.cxx.compile_flags += ['-fcoroutines-ts'] diff --git a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp index f26914982..c166bb72a 100644 --- a/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp +++ b/test/std/experimental/optional/optional.bad_optional_access/default.pass.cpp @@ -8,12 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 // diff --git a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp index a4af713a3..4630165f0 100644 --- a/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp +++ b/test/std/experimental/optional/optional.bad_optional_access/derive.pass.cpp @@ -8,12 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability_markup=macosx10.12 -// XFAIL: availability_markup=macosx10.11 -// XFAIL: availability_markup=macosx10.10 -// XFAIL: availability_markup=macosx10.9 -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp index 72d779059..c8f07111c 100644 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp +++ b/test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp @@ -8,13 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - // // T& optional::value(); diff --git a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp index b3d6dfda4..98ff16e4d 100644 --- a/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp +++ b/test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp @@ -8,13 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 -// XFAIL: availability=macosx10.12 -// XFAIL: availability=macosx10.11 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.7 - // // constexpr const T& optional::value() const; diff --git a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp index bfd385a1b..e267c6833 100644 --- a/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp +++ b/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.prop.pass.cpp @@ -8,12 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11 - -// GCC returns true for __is_trivially_constructible(void, int) -// See gcc.gnu.org/PR80682 -// NOTE: This has been fixed in trunk and will be backported soon. -// XFAIL: gcc-7, gcc-6, gcc-5, gcc-4 - // #include diff --git a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp similarity index 89% rename from test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp rename to test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp index 31a37229b..4d83296f0 100644 --- a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp +++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: libcpp-has-no-global-filesystem-namespace - #include int main() { diff --git a/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg new file mode 100644 index 000000000..4ea670935 --- /dev/null +++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/lit.local.cfg @@ -0,0 +1,2 @@ +if 'libcpp-has-no-global-filesystem-namespace' not in config.available_features: + config.unsupported = True diff --git a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp similarity index 89% rename from test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp rename to test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp index 248ab4d67..deca9bf5b 100644 --- a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp +++ b/test/std/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: libcpp-has-no-global-filesystem-namespace - #include int main() { diff --git a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp index 66409543f..a92ec872a 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -53,4 +52,5 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp index 96806fbfe..f13ee4470 100644 --- a/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::filebuf f; @@ -51,4 +50,5 @@ int main() assert(f2.sgetc() == L'2'); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp index 949ea50d0..fcc86a13f 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp @@ -15,33 +15,13 @@ // void swap(basic_fstream& rhs); #include -#include #include #include "platform_support.h" -std::pair get_temp_file_names() { - std::pair names; - names.first = get_temp_file_name(); - - // Create the file so the next call to `get_temp_file_name()` doesn't - // return the same file. - std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); - - names.second = get_temp_file_name(); - assert(names.first != names.second); - - std::fclose(fd1); - std::remove(names.first.c_str()); - - return names; -} - int main() { - std::pair temp_files = get_temp_file_names(); - std::string& temp1 = temp_files.first; - std::string& temp2 = temp_files.second; - assert(temp1 != temp2); + std::string temp1 = get_temp_file_name(); + std::string temp2 = get_temp_file_name(); { std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp index b143bd4a5..b5157e90e 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out @@ -47,4 +46,5 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp index 4ff84f26c..0a4f7240d 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp @@ -16,34 +16,13 @@ // void swap(basic_fstream& x, basic_fstream& y); #include -#include #include #include "platform_support.h" - -std::pair get_temp_file_names() { - std::pair names; - names.first = get_temp_file_name(); - - // Create the file so the next call to `get_temp_file_name()` doesn't - // return the same file. - std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); - - names.second = get_temp_file_name(); - assert(names.first != names.second); - - std::fclose(fd1); - std::remove(names.first.c_str()); - - return names; -} - int main() { - std::pair temp_files = get_temp_file_names(); - std::string& temp1 = temp_files.first; - std::string& temp2 = temp_files.second; - assert(temp1 != temp2); + std::string temp1 = get_temp_file_name(); + std::string temp2 = get_temp_file_name(); { std::fstream fs1(temp1.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp index 556cc858a..d2ae30286 100644 --- a/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::fstream fso(temp, std::ios_base::in | std::ios_base::out @@ -45,4 +44,5 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp index 36fa29a4e..9c2fcad33 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs; @@ -37,4 +36,5 @@ int main() fs >> x; assert(x == 3.25); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp index eeb06e0e5..aaac12122 100644 --- a/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ifstream fso("test.dat"); std::ifstream fs = move(fso); @@ -35,4 +34,5 @@ int main() fs >> x; assert(x == 3.25); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp index 95224774c..519b84fb1 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp @@ -15,33 +15,13 @@ // void swap(basic_ofstream& rhs); #include -#include #include #include "platform_support.h" -std::pair get_temp_file_names() { - std::pair names; - names.first = get_temp_file_name(); - - // Create the file so the next call to `get_temp_file_name()` doesn't - // return the same file. - std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); - - names.second = get_temp_file_name(); - assert(names.first != names.second); - - std::fclose(fd1); - std::remove(names.first.c_str()); - - return names; -} - int main() { - std::pair temp_files = get_temp_file_names(); - std::string& temp1 = temp_files.first; - std::string& temp2 = temp_files.second; - assert(temp1 != temp2); + std::string temp1 = get_temp_file_name(); + std::string temp2 = get_temp_file_name(); { std::ofstream fs1(temp1.c_str()); std::ofstream fs2(temp2.c_str()); diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp index 094f55073..0f21eb81d 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -49,4 +48,5 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp index 31f2153eb..d58f5f256 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp @@ -16,33 +16,13 @@ // void swap(basic_ofstream& x, basic_ofstream& y); #include -#include #include #include "platform_support.h" -std::pair get_temp_file_names() { - std::pair names; - names.first = get_temp_file_name(); - - // Create the file so the next call to `get_temp_file_name()` doesn't - // return the same file. - std::FILE *fd1 = std::fopen(names.first.c_str(), "w"); - - names.second = get_temp_file_name(); - assert(names.first != names.second); - - std::fclose(fd1); - std::remove(names.first.c_str()); - - return names; -} - int main() { - std::pair temp_files = get_temp_file_names(); - std::string& temp1 = temp_files.first; - std::string& temp2 = temp_files.second; - assert(temp1 != temp2); + std::string temp1 = get_temp_file_name(); + std::string temp2 = get_temp_file_name(); { std::ofstream fs1(temp1.c_str()); std::ofstream fs2(temp2.c_str()); diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp index fe885cf40..8645358cb 100644 --- a/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp +++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -22,6 +20,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::string temp = get_temp_file_name(); { std::ofstream fso(temp.c_str()); @@ -47,4 +46,5 @@ int main() assert(x == 3.25); } std::remove(temp.c_str()); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp index cf6c8ae68..2032e935b 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -19,6 +17,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -38,9 +37,11 @@ struct test_iostream {base::operator=(std::move(s)); return *this;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -87,4 +88,5 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp index e8fd00c7a..c0592e927 100644 --- a/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/iostreamclass/iostream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -19,6 +17,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -38,9 +37,11 @@ struct test_iostream : base(std::move(s)) {} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; test_iostream is1(&sb); @@ -73,4 +74,5 @@ int main() assert(is.precision() == 6); assert(is.getloc().name() == "C"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp index eda490f8d..52b356664 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 - // // template > diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index c7f16ca7e..0f356e26d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 - // // int_type get(); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp index b3d3c69b4..cf06e343b 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 - // // basic_istream& get(char_type& c); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp index 3a37cffce..3095712b9 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // basic_istream& diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp index ceef0d28f..20e70cfbd 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 - // // basic_istream& read(char_type* s, streamsize n); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp index a0a8e2f1b..01eecb5d8 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/readsome.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // streamsize readsome(char_type* s, streamsize n); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp index e370b4bfb..dc4e0ba0d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // basic_istream& seekg(pos_type pos); diff --git a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp index cac1e3955..818d42c26 100644 --- a/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream.unformatted/seekg_off.pass.cpp @@ -7,13 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // basic_istream& seekg(off_type off, ios_base::seekdir dir); diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp index 18887b75d..2876d76c1 100644 --- a/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream/istream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -19,6 +17,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -38,9 +37,11 @@ struct test_istream {base::operator=(std::move(s)); return *this;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -87,4 +88,5 @@ int main() assert(is2.precision() == 6); assert(is2.getloc().name() == "C"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp index 1b58a9a52..40fe0795d 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.assign/move_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -19,6 +17,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -38,9 +37,11 @@ struct test_ostream {base::operator=(std::move(s)); return *this;} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb1; testbuf sb2; @@ -87,4 +88,5 @@ int main() assert(os2.precision() == 6); assert(os2.getloc().name() == "C"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp index 7d225d495..b3045b323 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -19,6 +17,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct testbuf @@ -38,9 +37,11 @@ struct test_ostream : base(std::move(s)) {} }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; test_ostream os1(&sb); @@ -69,4 +70,5 @@ int main() assert(os.precision() == 6); assert(os.getloc().name() == "C"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp deleted file mode 100644 index 956cd171a..000000000 --- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp +++ /dev/null @@ -1,97 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 > -// class basic_ostream; - -// operator<<(short n); -// operator<<(unsigned short n); -// operator<<(int n); -// operator<<(unsigned int n); -// operator<<(long n); -// operator<<(unsigned long n); -// operator<<(long long n); -// operator<<(unsigned long long n); - -// Testing to make sure that the max length values are correctly inserted when -// using std::showbase - -#include -#include -#include -#include -#include -#include - -template -static void test(std::ios_base::fmtflags fmt, const char *expected) -{ - std::stringstream ss; - ss.setf(fmt, std::ios_base::basefield); - ss << std::showbase << (std::is_signed::value ? std::numeric_limits::min() : std::numeric_limits::max()); - assert(ss.str() == expected); -} - -int main(void) -{ - const std::ios_base::fmtflags o = std::ios_base::oct; - const std::ios_base::fmtflags d = std::ios_base::dec; - const std::ios_base::fmtflags x = std::ios_base::hex; - - test(o, "0100000"); - test(d, "-32768"); - test(x, "0x8000"); - - test(o, "0177777"); - test(d, "65535"); - test(x, "0xffff"); - - test(o, "020000000000"); - test(d, "-2147483648"); - test(x, "0x80000000"); - - test(o, "037777777777"); - test(d, "4294967295"); - test(x, "0xffffffff"); - - const bool long_is_32 = std::integral_constant::value; // avoid compiler warnings - const bool long_is_64 = std::integral_constant::value; // avoid compiler warnings - const bool long_long_is_64 = std::integral_constant::value; // avoid compiler warnings - - if (long_is_32) { - test(o, "020000000000"); - test(d, "-2147483648"); - test(x, "0x80000000"); - - test(o, "037777777777"); - test(d, "4294967295"); - test(x, "0xffffffff"); - } else if (long_is_64) { - test(o, "01000000000000000000000"); - test(d, "-9223372036854775808"); - test(x, "0x8000000000000000"); - - test(o, "01777777777777777777777"); - test(d, "18446744073709551615"); - test(x, "0xffffffffffffffff"); - } - if (long_long_is_64) { - test(o, "01000000000000000000000"); - test(d, "-9223372036854775808"); - test(x, "0x8000000000000000"); - - test(o, "01777777777777777777777"); - test(d, "18446744073709551615"); - test(x, "0xffffffffffffffff"); - } - - return 0; -} diff --git a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp index 54c8a2838..e09c0ed20 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.12 - // // template > diff --git a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp index 83210c087..8be0b51d9 100644 --- a/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp +++ b/test/std/input.output/iostream.format/output.streams/ostream.rvalue/CharT_pointer.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > @@ -21,6 +19,7 @@ #include #include +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template class testbuf @@ -54,9 +53,11 @@ protected: } }; +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf sb; std::ostream(&sb) << "testing..."; @@ -67,4 +68,5 @@ int main() std::wostream(&sb) << L"123"; assert(sb.str() == L"123"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp index 2a428c5d9..e57ad55c9 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.assign/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss; @@ -83,4 +82,5 @@ int main() s1 >> s; assert(s == L"Dddddddddddddddddd"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp index 0a45b796b..adc46ab65 100644 --- a/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::istringstream ss0(" 123 456"); std::istringstream ss(std::move(ss0)); @@ -45,4 +44,5 @@ int main() ss >> i; assert(i == 456); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp index 8801001f4..a52068595 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.assign/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss; @@ -43,4 +42,5 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp index 67bfc50cd..3d9e305e0 100644 --- a/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::ostringstream ss0(" 123 456"); std::ostringstream ss(std::move(ss0)); @@ -41,4 +40,5 @@ int main() ss << i << ' ' << 567; assert(ss.str() == L"234 5676"); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp index 436c76c5b..4ae3aa6e8 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss(std::move(ss0)); @@ -49,4 +48,5 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp index 94de61610..78d682fc4 100644 --- a/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/move2.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES std::vector vecis; vecis.push_back(std::istringstream()); vecis.back().str("hub started at [00 6b 8b 45 69]"); @@ -35,4 +34,5 @@ int main() vecis[n].seekg(0, std::ios_base::beg); assert(vecis[n].str().size() == 31); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp index 3cce695c4..ccaf72d7e 100644 --- a/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp +++ b/test/std/input.output/string.streams/stringstream.cons/stringstream.assign/move.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template , class Allocator = allocator > @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::stringstream ss0(" 123 456 "); std::stringstream ss; @@ -51,4 +50,5 @@ int main() ss << i << ' ' << 123; assert(ss.str() == L"456 1236 "); } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp index e5bd5603b..e395da299 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/advance.pass.cpp @@ -9,16 +9,14 @@ // -// All of these became constexpr in C++17 -// // template -// constexpr void advance(Iter& i, Iter::difference_type n); +// void advance(Iter& i, Iter::difference_type n); // // template -// constexpr void advance(Iter& i, Iter::difference_type n); +// void advance(Iter& i, Iter::difference_type n); // // template -// constexpr void advance(Iter& i, Iter::difference_type n); +// void advance(Iter& i, Iter::difference_type n); #include #include @@ -33,19 +31,8 @@ test(It i, typename std::iterator_traits::difference_type n, It x) assert(i == x); } -#if TEST_STD_VER > 14 -template -constexpr bool -constepxr_test(It i, typename std::iterator_traits::difference_type n, It x) -{ - std::advance(i, n); - return i == x; -} -#endif - int main() { - { const char* s = "1234567890"; test(input_iterator(s), 10, input_iterator(s+10)); test(forward_iterator(s), 10, forward_iterator(s+10)); @@ -55,18 +42,4 @@ int main() test(random_access_iterator(s+5), -5, random_access_iterator(s)); test(s+5, 5, s+10); test(s+5, -5, s); - } -#if TEST_STD_VER > 14 - { - constexpr const char* s = "1234567890"; - static_assert( constepxr_test(input_iterator(s), 10, input_iterator(s+10)), "" ); - static_assert( constepxr_test(forward_iterator(s), 10, forward_iterator(s+10)), "" ); - static_assert( constepxr_test(bidirectional_iterator(s+5), 5, bidirectional_iterator(s+10)), "" ); - static_assert( constepxr_test(bidirectional_iterator(s+5), -5, bidirectional_iterator(s)), "" ); - static_assert( constepxr_test(random_access_iterator(s+5), 5, random_access_iterator(s+10)), "" ); - static_assert( constepxr_test(random_access_iterator(s+5), -5, random_access_iterator(s)), "" ); - static_assert( constepxr_test(s+5, 5, s+10), "" ); - static_assert( constepxr_test(s+5, -5, s), "" ); - } -#endif } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp index 2f16fcb38..7fef63583 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/distance.pass.cpp @@ -29,33 +29,12 @@ test(It first, It last, typename std::iterator_traits::difference_type x) assert(std::distance(first, last) == x); } -#if TEST_STD_VER > 14 -template -constexpr bool -constexpr_test(It first, It last, typename std::iterator_traits::difference_type x) -{ - return std::distance(first, last) == x; -} -#endif - int main() { - { const char* s = "1234567890"; test(input_iterator(s), input_iterator(s+10), 10); test(forward_iterator(s), forward_iterator(s+10), 10); test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10); test(random_access_iterator(s), random_access_iterator(s+10), 10); test(s, s+10, 10); - } -#if TEST_STD_VER > 14 - { - constexpr const char* s = "1234567890"; - static_assert( constexpr_test(input_iterator(s), input_iterator(s+10), 10), ""); - static_assert( constexpr_test(forward_iterator(s), forward_iterator(s+10), 10), ""); - static_assert( constexpr_test(bidirectional_iterator(s), bidirectional_iterator(s+10), 10), ""); - static_assert( constexpr_test(random_access_iterator(s), random_access_iterator(s+10), 10), ""); - static_assert( constexpr_test(s, s+10, 10), ""); - } -#endif } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp index e257b3eaa..0952588b0 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp @@ -33,25 +33,8 @@ test(It i, It x) assert(std::next(i) == x); } -#if TEST_STD_VER > 14 -template -constexpr bool -constexpr_test(It i, typename std::iterator_traits::difference_type n, It x) -{ - return std::next(i, n) == x; -} - -template -constexpr bool -constexpr_test(It i, It x) -{ - return std::next(i) == x; -} -#endif - int main() { - { const char* s = "1234567890"; test(input_iterator(s), 10, input_iterator(s+10)); test(forward_iterator(s), 10, forward_iterator(s+10)); @@ -64,21 +47,4 @@ int main() test(bidirectional_iterator(s), bidirectional_iterator(s+1)); test(random_access_iterator(s), random_access_iterator(s+1)); test(s, s+1); - } -#if TEST_STD_VER > 14 - { - constexpr const char* s = "1234567890"; - static_assert( constexpr_test(input_iterator(s), 10, input_iterator(s+10)), "" ); - static_assert( constexpr_test(forward_iterator(s), 10, forward_iterator(s+10)), "" ); - static_assert( constexpr_test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)), "" ); - static_assert( constexpr_test(random_access_iterator(s), 10, random_access_iterator(s+10)), "" ); - static_assert( constexpr_test(s, 10, s+10), "" ); - - static_assert( constexpr_test(input_iterator(s), input_iterator(s+1)), "" ); - static_assert( constexpr_test(forward_iterator(s), forward_iterator(s+1)), "" ); - static_assert( constexpr_test(bidirectional_iterator(s), bidirectional_iterator(s+1)), "" ); - static_assert( constexpr_test(random_access_iterator(s), random_access_iterator(s+1)), "" ); - static_assert( constexpr_test(s, s+1), "" ); - } -#endif } diff --git a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp index 465cda1c4..0641706c9 100644 --- a/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp +++ b/test/std/iterators/iterator.primitives/iterator.operations/prev.pass.cpp @@ -31,25 +31,8 @@ test(It i, It x) assert(std::prev(i) == x); } -#if TEST_STD_VER > 14 -template -constexpr bool -constexpr_test(It i, typename std::iterator_traits::difference_type n, It x) -{ - return std::prev(i, n) == x; -} - -template -constexpr bool -constexpr_test(It i, It x) -{ - return std::prev(i) == x; -} -#endif - int main() { - { const char* s = "1234567890"; test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)); test(random_access_iterator(s+10), 10, random_access_iterator(s)); @@ -58,18 +41,4 @@ int main() test(bidirectional_iterator(s+1), bidirectional_iterator(s)); test(random_access_iterator(s+1), random_access_iterator(s)); test(s+1, s); - } -#if TEST_STD_VER > 14 - { - constexpr const char* s = "1234567890"; - static_assert( constexpr_test(bidirectional_iterator(s+10), 10, bidirectional_iterator(s)), "" ); - static_assert( constexpr_test(random_access_iterator(s+10), 10, random_access_iterator(s)), "" ); - static_assert( constexpr_test(s+10, 10, s), "" ); - - static_assert( constexpr_test(bidirectional_iterator(s+1), bidirectional_iterator(s)), "" ); - static_assert( constexpr_test(random_access_iterator(s+1), random_access_iterator(s)), "" ); - static_assert( constexpr_test(s+1, s), "" ); - } -#endif - } diff --git a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp index 3046ced75..a680aa3f4 100644 --- a/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/istream.iterator/types.pass.cpp @@ -40,22 +40,12 @@ #include #include -#include "test_macros.h" - int main() { typedef std::istream_iterator I1; // double is trivially destructible -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); @@ -63,17 +53,9 @@ int main() static_assert( std::is_trivially_destructible::value, ""); typedef std::istream_iterator I2; // unsigned is trivially destructible -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp similarity index 52% rename from test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp rename to test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp index 687a819a3..e3bf5e2bd 100644 --- a/test/std/depr/depr.function.objects/depr.adaptors/depr.function.pointer.adaptors/pointer_to_unary_function.cxx1z.fail.cpp +++ b/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator_op_astrk/arrow.pass.cpp @@ -7,19 +7,22 @@ // //===----------------------------------------------------------------------===// -// -// pointer_to_unary_function -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// -#include -#include -#include +// istreambuf_iterator -#include "test_macros.h" +// pointer operator->() const; -double unary_f(int i) {return 0.5 - i;} +#include +#include +#include -int main() +typedef char C; +int main () { - typedef std::pointer_to_unary_function F; + std::istringstream s("filename"); + std::istreambuf_iterator i(s); + + (*i).~C(); // This is well-formed... + i->~C(); // ... so this should be supported! } diff --git a/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp index 8d043e1e6..460da642b 100644 --- a/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp @@ -23,35 +23,17 @@ #include #include -#include "test_macros.h" - int main() { typedef std::ostream_iterator I1; -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); typedef std::ostream_iterator I2; -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp b/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp index cdf748465..a699b2419 100644 --- a/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp +++ b/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp @@ -24,37 +24,19 @@ #include #include -#include "test_macros.h" - int main() { typedef std::ostreambuf_iterator I1; -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#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), ""); typedef std::ostreambuf_iterator I2; -#if TEST_STD_VER <= 14 static_assert((std::is_convertible >::value), ""); -#else - 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), ""); -#endif static_assert((std::is_same::value), ""); static_assert((std::is_same >::value), ""); static_assert((std::is_same::value), ""); diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index 36f815a81..c88e5b06e 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -12,22 +12,10 @@ // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang-7, apple-clang-8 +// XFAIL: clang-3, apple-clang // None of the current GCC compilers support this. -// XFAIL: gcc-5, gcc-6 - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to compile/link. -// XFAIL: LIBCXX-WINDOWS-FIXME +// XFAIL: gcc #include #include diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp index 69f5ac8c9..55c26fa5c 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp @@ -13,20 +13,7 @@ // UNSUPPORTED: sanitizer-new-delete // FIXME change this to XFAIL. -// UNSUPPORTED: no-aligned-allocation && !gcc - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to link. -// XFAIL: LIBCXX-WINDOWS-FIXME +// UNSUPPORTED: no-aligned-allocation // test operator new @@ -42,7 +29,7 @@ constexpr auto OverAligned = alignof(std::max_align_t) * 2; int new_handler_called = 0; -void my_new_handler() +void new_handler() { ++new_handler_called; std::set_new_handler(0); @@ -58,7 +45,7 @@ struct alignas(OverAligned) A void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS - std::set_new_handler(my_new_handler); + std::set_new_handler(new_handler); try { void* vp = operator new[] (std::numeric_limits::max(), diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp index 36453283c..ec5d0a445 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp @@ -13,19 +13,7 @@ // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation && !gcc - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to compile/link. -// XFAIL: LIBCXX-WINDOWS-FIXME +// UNSUPPORTED: no-aligned-allocation // test operator new (nothrow) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp index 228d176a2..03e490e8e 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp @@ -10,19 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - -// XFAIL: no-aligned-allocation && !gcc - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails. -// XFAIL: LIBCXX-WINDOWS-FIXME +// XFAIL: no-aligned-allocation // test operator new nothrow by replacing only operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp index 15bebcbcb..131deb340 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp @@ -10,8 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// NOTE: GCC doesn't provide the -faligned-allocation flag to test for -// XFAIL: no-aligned-allocation && !gcc +// XFAIL: no-aligned-allocation // test operator new replacement diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp index f71cf19cc..5b93540ea 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp @@ -13,12 +13,6 @@ // when sized deallocation is not supported, e.g., prior to C++14. // UNSUPPORTED: sanitizer-new-delete -// XFAIL: availability_markup=macosx10.11 -// XFAIL: availability_markup=macosx10.10 -// XFAIL: availability_markup=macosx10.9 -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 - // NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation. // REQUIRES: fsized-deallocation diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index b0e932c96..a5d4df34a 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -10,23 +10,13 @@ // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 + // Older Clang versions do not support this -// XFAIL: clang-3, apple-clang-7, apple-clang-8 +// XFAIL: clang-3, apple-clang // None of the current GCC compilers support this. -// XFAIL: gcc-5, gcc-6 +// XFAIL: gcc -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to compile/link. -// XFAIL: LIBCXX-WINDOWS-FIXME #include #include diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp index 22ea5e2ff..5ebbc8a1a 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp @@ -9,23 +9,11 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation && !gcc - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to compile/link. -// XFAIL: LIBCXX-WINDOWS-FIXME +// UNSUPPORTED: no-aligned-allocation // test operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp index 2c5c0f80b..6e2eca314 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp @@ -9,23 +9,11 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL -// UNSUPPORTED: no-aligned-allocation && !gcc - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails to compile/link. -// XFAIL: LIBCXX-WINDOWS-FIXME +// UNSUPPORTED: no-aligned-allocation // test operator new (nothrow) diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp index b50f49dc6..9f64c9730 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp @@ -10,20 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - -// NOTE: gcc doesn't provide -faligned-allocation flag to test for -// XFAIL: no-aligned-allocation && !gcc - -// On Windows libc++ doesn't provide its own definitions for new/delete -// but instead depends on the ones in VCRuntime. However VCRuntime does not -// yet provide aligned new/delete definitions so this test fails. -// XFAIL: LIBCXX-WINDOWS-FIXME +// XFAIL: no-aligned-allocation // test operator new nothrow by replacing only operator new diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp index 66bb613ad..df3e4c156 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp @@ -10,8 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// NOTE: GCC doesn't provide a -faligned-allocation flag -// XFAIL: no-aligned-allocation && !gcc +// XFAIL: no-aligned-allocation // test operator new replacement diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp index 40de3a098..61fca5f12 100644 --- a/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp +++ b/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp @@ -13,11 +13,6 @@ // when sized deallocation is not supported, e.g., prior to C++14. // UNSUPPORTED: sanitizer-new-delete -// XFAIL: availability_markup=macosx10.11 -// XFAIL: availability_markup=macosx10.10 -// XFAIL: availability_markup=macosx10.9 -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 // NOTE: Only clang-3.7 and GCC 5.1 and greater support -fsized-deallocation. // REQUIRES: fsized-deallocation diff --git a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp index 88e2253d0..68cd85038 100644 --- a/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp @@ -8,10 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions - -// This test fails due to a stack overflow -// XFAIL: LIBCXX-WINDOWS-FIXME - // // class nested_exception; @@ -47,7 +43,7 @@ class C { public: virtual ~C() {} - C * operator&() const { assert(false); return nullptr; } // should not be called + C * operator&() const { assert(false); } // should not be called }; class D : private std::nested_exception {}; diff --git a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index 6a9f25cd0..a86d8bcbe 100644 --- a/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -107,16 +107,6 @@ int main() assert(i == 7); } } - { - try - { - std::throw_with_nested("String literal"); - assert(false); - } - catch (const char *) - { - } - } #if TEST_STD_VER > 11 { try diff --git a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp index c33d64d06..661f789fe 100644 --- a/test/std/language.support/support.exception/propagation/current_exception.pass.cpp +++ b/test/std/language.support/support.exception/propagation/current_exception.pass.cpp @@ -7,10 +7,6 @@ // //===----------------------------------------------------------------------===// -// This test needs to be rewritten for the Windows exception_ptr semantics -// which copy the exception each time the exception_ptr is copied. -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-no-exceptions // diff --git a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp index 35821d9bd..36feda730 100644 --- a/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp +++ b/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp @@ -38,12 +38,7 @@ int main() } catch (const A& a) { -#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); -#else - // On Windows exception_ptr copies the exception - assert(A::constructed == 2); -#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -52,5 +47,4 @@ int main() } assert(A::constructed == 0); } - assert(A::constructed == 0); } diff --git a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp index 37ffb5be5..565166cbd 100644 --- a/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp +++ b/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp @@ -46,12 +46,7 @@ int main() } catch (const A& a) { -#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); -#else - // On Windows the exception_ptr copies the exception - assert(A::constructed == 2); -#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -60,5 +55,4 @@ int main() } assert(A::constructed == 0); } - assert(A::constructed == 0); } diff --git a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp index e35e7afa3..b92671588 100644 --- a/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp +++ b/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp @@ -8,14 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions -// XFAIL: libcpp-no-exceptions - -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 -// XFAIL: availability=macosx10.9 -// XFAIL: availability=macosx10.10 -// XFAIL: availability=macosx10.11 - // test uncaught_exceptions #include diff --git a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp index f6fd5564f..e51ef7bd9 100644 --- a/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // template class initializer_list; // const E* begin() const; @@ -21,6 +19,8 @@ #include "test_macros.h" +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + struct A { A(std::initializer_list il) @@ -52,9 +52,13 @@ struct B #endif // TEST_STD_VER > 11 +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; +#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp index 2d831c9e1..e09183434 100644 --- a/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // template class initializer_list; // initializer_list(); @@ -22,9 +20,10 @@ struct A {}; int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::initializer_list il; assert(il.size() == 0); - +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #if TEST_STD_VER > 11 constexpr std::initializer_list il2; static_assert(il2.size() == 0, ""); diff --git a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp index 102ed64fe..938025d38 100644 --- a/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp +++ b/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template const E* begin(initializer_list il); @@ -19,6 +17,8 @@ #include "test_macros.h" +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + struct A { A(std::initializer_list il) @@ -49,10 +49,13 @@ struct B }; #endif // TEST_STD_VER > 11 +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; +#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/test/std/language.support/support.initlist/types.pass.cpp b/test/std/language.support/support.initlist/types.pass.cpp index a301ef924..835830055 100644 --- a/test/std/language.support/support.initlist/types.pass.cpp +++ b/test/std/language.support/support.initlist/types.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // template // class initializer_list // { @@ -28,10 +26,12 @@ struct A {}; int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS static_assert((std::is_same::value_type, A>::value), ""); static_assert((std::is_same::reference, const A&>::value), ""); static_assert((std::is_same::const_reference, const A&>::value), ""); static_assert((std::is_same::size_type, std::size_t>::value), ""); static_assert((std::is_same::iterator, const A*>::value), ""); static_assert((std::is_same::const_iterator, const A*>::value), ""); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/language.support/support.types/byte.pass.cpp b/test/std/language.support/support.types/byte.pass.cpp deleted file mode 100644 index 66b2a5531..000000000 --- a/test/std/language.support/support.types/byte.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include -#include - -// XFAIL: c++98, c++03, c++11, c++14 - -// std::byte is not an integer type, nor a character type. -// It is a distinct type for accessing the bits that ultimately make up object storage. - -static_assert( std::is_pod::value, "" ); -static_assert(!std::is_arithmetic::value, "" ); -static_assert(!std::is_integral::value, "" ); - -static_assert(!std::is_same::value, "" ); -static_assert(!std::is_same::value, "" ); -static_assert(!std::is_same::value, "" ); - -// The standard doesn't outright say this, but it's pretty clear that it has to be true. -static_assert(sizeof(std::byte) == 1, "" ); - -int main () {} diff --git a/test/std/language.support/support.types/byteops/and.assign.pass.cpp b/test/std/language.support/support.types/byteops/and.assign.pass.cpp deleted file mode 100644 index ec1c3805a..000000000 --- a/test/std/language.support/support.types/byteops/and.assign.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte& operator &=(byte l, byte r) noexcept; - - -constexpr std::byte test(std::byte b1, std::byte b2) { - std::byte bret = b1; - return bret &= b2; - } - - -int main () { - std::byte b; // not constexpr, just used in noexcept check - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b8{static_cast(8)}; - constexpr std::byte b9{static_cast(9)}; - - static_assert(noexcept(b &= b), "" ); - - static_assert(std::to_integer(test(b1, b8)) == 0, ""); - static_assert(std::to_integer(test(b1, b9)) == 1, ""); - static_assert(std::to_integer(test(b8, b9)) == 8, ""); - - static_assert(std::to_integer(test(b8, b1)) == 0, ""); - static_assert(std::to_integer(test(b9, b1)) == 1, ""); - static_assert(std::to_integer(test(b9, b8)) == 8, ""); -} diff --git a/test/std/language.support/support.types/byteops/and.pass.cpp b/test/std/language.support/support.types/byteops/and.pass.cpp deleted file mode 100644 index 6c5419cfc..000000000 --- a/test/std/language.support/support.types/byteops/and.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte operator&(byte l, byte r) noexcept; - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b8{static_cast(8)}; - constexpr std::byte b9{static_cast(9)}; - - static_assert(noexcept(b1 & b8), "" ); - - static_assert(std::to_integer(b1 & b8) == 0, ""); - static_assert(std::to_integer(b1 & b9) == 1, ""); - static_assert(std::to_integer(b8 & b9) == 8, ""); - - static_assert(std::to_integer(b8 & b1) == 0, ""); - static_assert(std::to_integer(b9 & b1) == 1, ""); - static_assert(std::to_integer(b9 & b8) == 8, ""); -} diff --git a/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp b/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp deleted file mode 100644 index 157626137..000000000 --- a/test/std/language.support/support.types/byteops/enum_direct_init.pass.cpp +++ /dev/null @@ -1,21 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// The following compilers don't like "std::byte b1{1}" -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - -int main () { - constexpr std::byte b{42}; - static_assert(std::to_integer(b) == 42, ""); -} diff --git a/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp deleted file mode 100644 index 8f6822932..000000000 --- a/test/std/language.support/support.types/byteops/lshift.assign.fail.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// The following compilers don't like "std::byte b1{1}" -// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// template -// constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - - -constexpr std::byte test(std::byte b) { - return b <<= 2.0; - } - - -int main () { - constexpr std::byte b1 = test(std::byte{1}); -} diff --git a/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp deleted file mode 100644 index abfeebf2b..000000000 --- a/test/std/language.support/support.types/byteops/lshift.assign.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - - -constexpr std::byte test(std::byte b) { - return b <<= 2; - } - - -int main () { - std::byte b; // not constexpr, just used in noexcept check - constexpr std::byte b2{static_cast(2)}; - constexpr std::byte b3{static_cast(3)}; - - static_assert(noexcept(b <<= 2), "" ); - - static_assert(std::to_integer(test(b2)) == 8, "" ); - static_assert(std::to_integer(test(b3)) == 12, "" ); - -} diff --git a/test/std/language.support/support.types/byteops/lshift.fail.cpp b/test/std/language.support/support.types/byteops/lshift.fail.cpp deleted file mode 100644 index 707258c6d..000000000 --- a/test/std/language.support/support.types/byteops/lshift.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte operator <<(byte b, IntegerType shift) noexcept; -// These functions shall not participate in overload resolution unless -// is_integral_v is true. - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b2 = b1 << 2.0f; -} diff --git a/test/std/language.support/support.types/byteops/lshift.pass.cpp b/test/std/language.support/support.types/byteops/lshift.pass.cpp deleted file mode 100644 index 15ad796cb..000000000 --- a/test/std/language.support/support.types/byteops/lshift.pass.cpp +++ /dev/null @@ -1,30 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte operator <<(byte b, IntegerType shift) noexcept; -// These functions shall not participate in overload resolution unless -// is_integral_v is true. - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b3{static_cast(3)}; - - static_assert(noexcept(b3 << 2), "" ); - - static_assert(std::to_integer(b1 << 1) == 2, ""); - static_assert(std::to_integer(b1 << 2) == 4, ""); - static_assert(std::to_integer(b3 << 4) == 48, ""); - static_assert(std::to_integer(b3 << 6) == 192, ""); -} diff --git a/test/std/language.support/support.types/byteops/not.pass.cpp b/test/std/language.support/support.types/byteops/not.pass.cpp deleted file mode 100644 index 53f1d91fa..000000000 --- a/test/std/language.support/support.types/byteops/not.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte operator~(byte b) noexcept; - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b2{static_cast(2)}; - constexpr std::byte b8{static_cast(8)}; - - static_assert(noexcept(~b1), "" ); - - static_assert(std::to_integer(~b1) == 254, ""); - static_assert(std::to_integer(~b2) == 253, ""); - static_assert(std::to_integer(~b8) == 247, ""); -} diff --git a/test/std/language.support/support.types/byteops/or.assign.pass.cpp b/test/std/language.support/support.types/byteops/or.assign.pass.cpp deleted file mode 100644 index bb4a84ec6..000000000 --- a/test/std/language.support/support.types/byteops/or.assign.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte& operator |=(byte l, byte r) noexcept; - - -constexpr std::byte test(std::byte b1, std::byte b2) { - std::byte bret = b1; - return bret |= b2; - } - - -int main () { - std::byte b; // not constexpr, just used in noexcept check - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b2{static_cast(2)}; - constexpr std::byte b8{static_cast(8)}; - - static_assert(noexcept(b |= b), "" ); - - static_assert(std::to_integer(test(b1, b2)) == 3, ""); - static_assert(std::to_integer(test(b1, b8)) == 9, ""); - static_assert(std::to_integer(test(b2, b8)) == 10, ""); - - static_assert(std::to_integer(test(b2, b1)) == 3, ""); - static_assert(std::to_integer(test(b8, b1)) == 9, ""); - static_assert(std::to_integer(test(b8, b2)) == 10, ""); - -} diff --git a/test/std/language.support/support.types/byteops/or.pass.cpp b/test/std/language.support/support.types/byteops/or.pass.cpp deleted file mode 100644 index e2b734982..000000000 --- a/test/std/language.support/support.types/byteops/or.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte operator|(byte l, byte r) noexcept; - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b2{static_cast(2)}; - constexpr std::byte b8{static_cast(8)}; - - static_assert(noexcept(b1 | b2), "" ); - - static_assert(std::to_integer(b1 | b2) == 3, ""); - static_assert(std::to_integer(b1 | b8) == 9, ""); - static_assert(std::to_integer(b2 | b8) == 10, ""); - - static_assert(std::to_integer(b2 | b1) == 3, ""); - static_assert(std::to_integer(b8 | b1) == 9, ""); - static_assert(std::to_integer(b8 | b2) == 10, ""); -} diff --git a/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp b/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp deleted file mode 100644 index 44992fa98..000000000 --- a/test/std/language.support/support.types/byteops/rshift.assign.fail.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// The following compilers don't like "std::byte b1{1}" -// UNSUPPORTED: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// template -// constexpr byte operator>>(byte& b, IntegerType shift) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - - -constexpr std::byte test(std::byte b) { - return b >>= 2.0; - } - - -int main () { - constexpr std::byte b1 = test(std::byte{1}); -} diff --git a/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp b/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp deleted file mode 100644 index 82c611cfd..000000000 --- a/test/std/language.support/support.types/byteops/rshift.assign.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - - -constexpr std::byte test(std::byte b) { - return b >>= 2; - } - - -int main () { - std::byte b; // not constexpr, just used in noexcept check - constexpr std::byte b16{static_cast(16)}; - constexpr std::byte b192{static_cast(192)}; - - static_assert(noexcept(b >>= 2), "" ); - - static_assert(std::to_integer(test(b16)) == 4, "" ); - static_assert(std::to_integer(test(b192)) == 48, "" ); -} diff --git a/test/std/language.support/support.types/byteops/rshift.fail.cpp b/test/std/language.support/support.types/byteops/rshift.fail.cpp deleted file mode 100644 index 8e142dd90..000000000 --- a/test/std/language.support/support.types/byteops/rshift.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte operator >>(byte b, IntegerType shift) noexcept; -// These functions shall not participate in overload resolution unless -// is_integral_v is true. - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b2 = b1 >> 2.0f; -} diff --git a/test/std/language.support/support.types/byteops/rshift.pass.cpp b/test/std/language.support/support.types/byteops/rshift.pass.cpp deleted file mode 100644 index 22d399130..000000000 --- a/test/std/language.support/support.types/byteops/rshift.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr byte operator <<(byte b, IntegerType shift) noexcept; -// These functions shall not participate in overload resolution unless -// is_integral_v is true. - - -constexpr std::byte test(std::byte b) { - return b <<= 2; - } - - -int main () { - constexpr std::byte b100{static_cast(100)}; - constexpr std::byte b115{static_cast(115)}; - - static_assert(noexcept(b100 << 2), "" ); - - static_assert(std::to_integer(b100 >> 1) == 50, ""); - static_assert(std::to_integer(b100 >> 2) == 25, ""); - static_assert(std::to_integer(b115 >> 3) == 14, ""); - static_assert(std::to_integer(b115 >> 6) == 1, ""); - -} diff --git a/test/std/language.support/support.types/byteops/to_integer.fail.cpp b/test/std/language.support/support.types/byteops/to_integer.fail.cpp deleted file mode 100644 index fb4928956..000000000 --- a/test/std/language.support/support.types/byteops/to_integer.fail.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr IntegerType to_integer(byte b) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - -int main () { - constexpr std::byte b1{static_cast(1)}; - auto f = std::to_integer(b1); -} diff --git a/test/std/language.support/support.types/byteops/to_integer.pass.cpp b/test/std/language.support/support.types/byteops/to_integer.pass.cpp deleted file mode 100644 index 4f3436344..000000000 --- a/test/std/language.support/support.types/byteops/to_integer.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// template -// constexpr IntegerType to_integer(byte b) noexcept; -// This function shall not participate in overload resolution unless -// is_integral_v is true. - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b3{static_cast(3)}; - - static_assert(noexcept(std::to_integer(b1)), "" ); - static_assert(std::is_same(b1))>::value, "" ); - static_assert(std::is_same(b1))>::value, "" ); - static_assert(std::is_same(b1))>::value, "" ); - - static_assert(std::to_integer(b1) == 1, ""); - static_assert(std::to_integer(b3) == 3, ""); -} diff --git a/test/std/language.support/support.types/byteops/xor.assign.pass.cpp b/test/std/language.support/support.types/byteops/xor.assign.pass.cpp deleted file mode 100644 index 6a526da3d..000000000 --- a/test/std/language.support/support.types/byteops/xor.assign.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte& operator ^=(byte l, byte r) noexcept; - - -constexpr std::byte test(std::byte b1, std::byte b2) { - std::byte bret = b1; - return bret ^= b2; - } - - -int main () { - std::byte b; // not constexpr, just used in noexcept check - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b8{static_cast(8)}; - constexpr std::byte b9{static_cast(9)}; - - static_assert(noexcept(b ^= b), "" ); - - static_assert(std::to_integer(test(b1, b8)) == 9, ""); - static_assert(std::to_integer(test(b1, b9)) == 8, ""); - static_assert(std::to_integer(test(b8, b9)) == 1, ""); - - static_assert(std::to_integer(test(b8, b1)) == 9, ""); - static_assert(std::to_integer(test(b9, b1)) == 8, ""); - static_assert(std::to_integer(test(b9, b8)) == 1, ""); -} diff --git a/test/std/language.support/support.types/byteops/xor.pass.cpp b/test/std/language.support/support.types/byteops/xor.pass.cpp deleted file mode 100644 index e8c3b9875..000000000 --- a/test/std/language.support/support.types/byteops/xor.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include -#include - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// constexpr byte operator^(byte l, byte r) noexcept; - -int main () { - constexpr std::byte b1{static_cast(1)}; - constexpr std::byte b8{static_cast(8)}; - constexpr std::byte b9{static_cast(9)}; - - static_assert(noexcept(b1 ^ b8), "" ); - - static_assert(std::to_integer(b1 ^ b8) == 9, ""); - static_assert(std::to_integer(b1 ^ b9) == 8, ""); - static_assert(std::to_integer(b8 ^ b9) == 1, ""); - - static_assert(std::to_integer(b8 ^ b1) == 9, ""); - static_assert(std::to_integer(b9 ^ b1) == 8, ""); - static_assert(std::to_integer(b9 ^ b8) == 1, ""); -} diff --git a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp index 06c171f56..044ba2b97 100644 --- a/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp index a9a872014..4488e9c3f 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp @@ -15,6 +15,9 @@ // charT tolower(charT) const; +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 + #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp index 67fe44931..0c224e342 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp @@ -15,6 +15,9 @@ // const charT* tolower(charT* low, const charT* high) const; +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 + #include #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp index 271ae2c03..0985de500 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp @@ -15,6 +15,9 @@ // charT toupper(charT) const; +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 + #include #include diff --git a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp index 650713570..ba0477549 100644 --- a/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp +++ b/test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp @@ -15,6 +15,9 @@ // const charT* toupper(charT* low, const charT* high) const; +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 + #include #include #include diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp index 7776c67a6..ec563fe4c 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp @@ -7,8 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This test is passing in an uncontrolled manner in some Apple environment. -// UNSUPPORTED: apple-darwin +// XFAIL: apple-darwin // Failure related to GLIBC's use of U00A0 as mon_thousands_sep // and U002E as mon_decimal_point. diff --git a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp index 4d805b0f7..54bfcfb5c 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp @@ -7,8 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This test is passing in an uncontrolled manner in some Apple environment. -// UNSUPPORTED: apple-darwin +// XFAIL: apple-darwin // Failure related to GLIBC's use of U00A0 as mon_thousands_sep // and U002E as mon_decimal_point. diff --git a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp index 323d856a3..32e7249ab 100644 --- a/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp +++ b/test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp index e3367b26f..6d7f506bb 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp @@ -7,10 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR11871 -// XFAIL: with_system_cxx_lib=macosx10.7 -// PR15445 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp index 174312d09..d01f63d59 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// PR11871 -// XFAIL: with_system_cxx_lib=macosx10.7 // @@ -197,16 +194,4 @@ int main() assert(v == -HUGE_VALF); } - { - v = -1; - const char str[] = "2-"; - std::ios_base::iostate err = ios.goodbit; - input_iterator iter = - f.get(input_iterator(str), - input_iterator(str+sizeof(str)), - ios, err, v); - assert(iter.base() == str+1); - assert(err == ios.goodbit); - assert(v == 2); - } } diff --git a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp index cf671b000..b79650b01 100644 --- a/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp +++ b/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp @@ -6,9 +6,6 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// PR11871 -// XFAIL: with_system_cxx_lib=macosx10.7 // @@ -256,16 +253,4 @@ int main() assert(err == ios.failbit); assert(v == -HUGE_VALL); } - { - v = -1; - const char str[] = "2-"; - std::ios_base::iostate err = ios.goodbit; - input_iterator iter = - f.get(input_iterator(str), - input_iterator(str+sizeof(str)), - ios, err, v); - assert(iter.base() == str+1); - assert(err == ios.goodbit); - assert(v == 2); - } } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp index b90c41e59..2eb6978b0 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp @@ -25,329 +25,307 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; +int main() +{ + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xD8)); + assert(n[1] == char(0xC0)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); -template -void TestHelper::test() { - // Nothing to do, the conversion in unsupported -} - -template -void TestHelper::test() { - { - typedef std::codecvt_utf16 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xD8)); - assert(n[1] == char(0xC0)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0x10)); - assert(n[1] == char(0x05)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0x04)); - assert(n[1] == char(0x53)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0x00)); - assert(n[1] == char(0x56)); - assert(n[2] == char(0xDC)); - assert(n[3] == char(0x03)); - } - { - typedef std::codecvt_utf16 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0x04)); - assert(n[1] == char(0x53)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0x00)); - assert(n[1] == char(0x56)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf16 C; - C c; - CharT w = 0x40003; - char n[6] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 6); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0xD8)); - assert(n[3] == char(0xC0)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x10)); - assert(n[3] == char(0x05)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x04)); - assert(n[3] == char(0x53)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xFE)); - assert(n[1] == char(0xFF)); - assert(n[2] == char(0x00)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0xDC)); - assert(n[5] == char(0x03)); - } - - { - typedef std::codecvt_utf16 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[1] == char(0xD8)); - assert(n[0] == char(0xC0)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[1] == char(0x10)); - assert(n[0] == char(0x05)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[1] == char(0x04)); - assert(n[0] == char(0x53)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[1] == char(0x00)); - assert(n[0] == char(0x56)); - assert(n[3] == char(0xDC)); - assert(n[2] == char(0x03)); - } - { - typedef std::codecvt_utf16 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[1] == char(0)); - assert(n[0] == char(0)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[1] == char(0)); - assert(n[0] == char(0)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[1] == char(0x04)); - assert(n[0] == char(0x53)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[1] == char(0x00)); - assert(n[0] == char(0x56)); - assert(n[3] == char(0)); - assert(n[2] == char(0)); - } - { - typedef std::codecvt_utf16 - C; - C c; - CharT w = 0x40003; - char n[6] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 6); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0xD8)); - assert(n[2] == char(0xC0)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x10)); - assert(n[2] == char(0x05)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x04)); - assert(n[2] == char(0x53)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 6, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[1] == char(0xFE)); - assert(n[0] == char(0xFF)); - assert(n[3] == char(0x00)); - assert(n[2] == char(0x56)); - assert(n[5] == char(0xDC)); - assert(n[4] == char(0x03)); - } -} - -int main() { - TestHelper::test(); - TestHelper::test(); + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0x10)); + assert(n[1] == char(0x05)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0x04)); + assert(n[1] == char(0x53)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0x00)); + assert(n[1] == char(0x56)); + assert(n[2] == char(0xDC)); + assert(n[3] == char(0x03)); + } + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0x04)); + assert(n[1] == char(0x53)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0x00)); + assert(n[1] == char(0x56)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[6] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+6); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0xD8)); + assert(n[3] == char(0xC0)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x10)); + assert(n[3] == char(0x05)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x04)); + assert(n[3] == char(0x53)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xFE)); + assert(n[1] == char(0xFF)); + assert(n[2] == char(0x00)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0xDC)); + assert(n[5] == char(0x03)); + } + + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[1] == char(0xD8)); + assert(n[0] == char(0xC0)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[1] == char(0x10)); + assert(n[0] == char(0x05)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[1] == char(0x04)); + assert(n[0] == char(0x53)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[1] == char(0x00)); + assert(n[0] == char(0x56)); + assert(n[3] == char(0xDC)); + assert(n[2] == char(0x03)); + } + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[1] == char(0)); + assert(n[0] == char(0)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[1] == char(0)); + assert(n[0] == char(0)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[1] == char(0x04)); + assert(n[0] == char(0x53)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[1] == char(0x00)); + assert(n[0] == char(0x56)); + assert(n[3] == char(0)); + assert(n[2] == char(0)); + } + { + typedef std::codecvt_utf16 C; + C c; + wchar_t w = 0x40003; + char n[6] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+6); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0xD8)); + assert(n[2] == char(0xC0)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x10)); + assert(n[2] == char(0x05)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x04)); + assert(n[2] == char(0x53)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+6, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[1] == char(0xFE)); + assert(n[0] == char(0xFF)); + assert(n[3] == char(0x00)); + assert(n[2] == char(0x56)); + assert(n[5] == char(0xDC)); + assert(n[4] == char(0x03)); + } } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp index 886fc4416..02cf7cf95 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp @@ -25,302 +25,432 @@ #include #include -template -struct TestHelper; +int main() +{ + { + typedef std::codecvt_utf8 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); -template -struct TestHelper { - static void test(); -}; + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); -template -struct TestHelper { - static void test(); -}; + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); -template -void TestHelper::test() { - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x1005; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + } + { + typedef std::codecvt_utf8 C; + C c; + wchar_t w = 0x40003; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x1005; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + wchar_t w = 0x40003; + char n[7] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x1005; - char n[7] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0)); - } -} - -template -void TestHelper::test() { - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0x85)); - assert(n[3] == char(0x83)); - } - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x40003; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == &w); - assert(np == n); - assert(n[0] == char(0)); - assert(n[1] == char(0)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - assert(n[1] == char(0x93)); - assert(n[2] == char(0)); - assert(n[3] == char(0)); - } - { - typedef std::codecvt_utf8 C; - C c; - CharT w = 0x40003; - char n[7] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); - - w = 0x1005; - r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - - w = 0x453; - r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - - w = 0x56; - r = c.out(m, &w, &w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == &w + 1); - assert(np == n + 4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - assert(n[4] == char(0x93)); - assert(n[5] == char(0x85)); - assert(n[6] == char(0x83)); - } -} - -int main() { - TestHelper::test(); - TestHelper::test(); - TestHelper::test(); + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + } + { + typedef std::codecvt_utf8 C; + C c; + char32_t w = 0x40003; + char n[4] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0x83)); + } + { + typedef std::codecvt_utf8 C; + C c; + char32_t w = 0x40003; + char n[4] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + char32_t w = 0x40003; + char n[7] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); + + w = 0x1005; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0x83)); + } + { + typedef std::codecvt_utf8 C; + C c; + char16_t w = 0x1005; + char n[4] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0x85)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + char16_t w = 0x1005; + char n[4] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == &w); + assert(np == n); + assert(n[0] == char(0)); + assert(n[1] == char(0)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + assert(n[1] == char(0x93)); + assert(n[2] == char(0)); + assert(n[3] == char(0)); + } + { + typedef std::codecvt_utf8 C; + C c; + char16_t w = 0x1005; + char n[7] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); + + w = 0x453; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); + + w = 0x56; + r = c.out(m, &w, &w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == &w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + assert(n[4] == char(0x93)); + assert(n[5] == char(0x85)); + assert(n[6] == char(0)); + } } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp index 392d66f22..0cd941764 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_in.pass.cpp @@ -25,220 +25,348 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; +int main() +{ + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + wchar_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); -template -void TestHelper::test() { - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - CharT* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n + 3, np, w, w + 2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n + 2, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(w[0] == 0x0453); + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + wchar_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - n[0] = char(0x56); - r = c.in(m, n, n + 1, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0}; - char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), - char(0x80), char(0x80), char(0x83)}; - CharT* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n + 7, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 7); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n + 3, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 3); - assert(w[0] == 0x1005); + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n + 2, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(w[0] == 0x0453); + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0}; + char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; + wchar_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); - n[0] = char(0x56); - r = c.in(m, n, n + 1, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(w[0] == 0x0056); - } -} - -template -void TestHelper::test() { - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - CharT* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 4); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n + 3, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n + 2, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n + 1, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0}; - char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; - CharT* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n + 4, np, w, w + 2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n + 3, np, w, w + 2, wp); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n + 2, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n + 1, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(w[0] == 0x0056); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0}; - char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), - char(0x80), char(0x80), char(0x83)}; - CharT* wp = nullptr; - std::mbstate_t m; - const char* np = nullptr; - std::codecvt_base::result r = c.in(m, n, n + 7, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 7); - assert(w[0] == 0xD8C0); - assert(w[1] == 0xDC03); - - n[0] = char(0xE1); - n[1] = char(0x80); - n[2] = char(0x85); - r = c.in(m, n, n + 3, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 3); - assert(w[0] == 0x1005); - - n[0] = char(0xD1); - n[1] = char(0x93); - r = c.in(m, n, n + 2, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(w[0] == 0x0453); - - n[0] = char(0x56); - r = c.in(m, n, n + 1, np, w, w + 2, wp); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(w[0] == 0x0056); - } -} - -int main() { -#ifndef _WIN32 - TestHelper::test(); -#endif - TestHelper::test(); - TestHelper::test(); + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + char32_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + char32_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0}; + char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; + char32_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + char16_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0}; + char n[4] = {char(0xF1), char(0x80), char(0x80), char(0x83)}; + char16_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+4, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0}; + char n[7] = {char(0xEF), char(0xBB), char(0xBF), char(0xF1), char(0x80), char(0x80), char(0x83)}; + char16_t* wp = nullptr; + std::mbstate_t m; + const char* np = nullptr; + std::codecvt_base::result r = c.in(m, n, n+7, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(w[0] == 0xD8C0); + assert(w[1] == 0xDC03); + + n[0] = char(0xE1); + n[1] = char(0x80); + n[2] = char(0x85); + r = c.in(m, n, n+3, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(w[0] == 0x1005); + + n[0] = char(0xD1); + n[1] = char(0x93); + r = c.in(m, n, n+2, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(w[0] == 0x0453); + + n[0] = char(0x56); + r = c.in(m, n, n+1, np, w, w+2, wp); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(w[0] == 0x0056); + } } diff --git a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp index ced2a36a4..29c5342e4 100644 --- a/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp +++ b/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp @@ -25,285 +25,391 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; +int main() +{ + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); -template -void TestHelper::test() { - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + wchar_t w[2] = {0xD8C0, 0xDC03}; + char n[7] = {0}; + const wchar_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[7] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - } -} - -template -void TestHelper::test() { - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 4); - assert(n[0] == char(0xF1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x80)); - assert(n[3] == char(0x83)); - - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 3); - assert(n[0] == char(0xE1)); - assert(n[1] == char(0x80)); - assert(n[2] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[4] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::error); - assert(wp == w); - assert(np == n); - - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 2); - assert(n[0] == char(0xD1)); - assert(n[1] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 4, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 1); - assert(n[0] == char(0x56)); - } - { - typedef std::codecvt_utf8_utf16 C; - C c; - CharT w[2] = {0xD8C0, 0xDC03}; - char n[7] = {0}; - const CharT* wp = nullptr; - std::mbstate_t m; - char* np = nullptr; - std::codecvt_base::result r = c.out(m, w, w + 2, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 2); - assert(np == n + 7); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xF1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x80)); - assert(n[6] == char(0x83)); - - w[0] = 0x1005; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 6); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xE1)); - assert(n[4] == char(0x80)); - assert(n[5] == char(0x85)); - - w[0] = 0x453; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 5); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0xD1)); - assert(n[4] == char(0x93)); - - w[0] = 0x56; - r = c.out(m, w, w + 1, wp, n, n + 7, np); - assert(r == std::codecvt_base::ok); - assert(wp == w + 1); - assert(np == n + 4); - assert(n[0] == char(0xEF)); - assert(n[1] == char(0xBB)); - assert(n[2] == char(0xBF)); - assert(n[3] == char(0x56)); - } -} - -int main() { -#ifndef _WIN32 - TestHelper::test(); -#endif - TestHelper::test(); - TestHelper::test(); + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char32_t w[2] = {0xD8C0, 0xDC03}; + char n[7] = {0}; + const char32_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); + + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + } + + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+4); + assert(n[0] == char(0xF1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x80)); + assert(n[3] == char(0x83)); + + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+3); + assert(n[0] == char(0xE1)); + assert(n[1] == char(0x80)); + assert(n[2] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0xD8C0, 0xDC03}; + char n[4] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::error); + assert(wp == w); + assert(np == n); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+2); + assert(n[0] == char(0xD1)); + assert(n[1] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+4, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+1); + assert(n[0] == char(0x56)); + } + { + typedef std::codecvt_utf8_utf16 C; + C c; + char16_t w[2] = {0xD8C0, 0xDC03}; + char n[7] = {0}; + const char16_t* wp = nullptr; + std::mbstate_t m; + char* np = nullptr; + std::codecvt_base::result r = c.out(m, w, w+2, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+2); + assert(np == n+7); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xF1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x80)); + assert(n[6] == char(0x83)); + + w[0] = 0x1005; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+6); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xE1)); + assert(n[4] == char(0x80)); + assert(n[5] == char(0x85)); + + w[0] = 0x453; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+5); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0xD1)); + assert(n[4] == char(0x93)); + + w[0] = 0x56; + r = c.out(m, w, w+1, wp, n, n+7, np); + assert(r == std::codecvt_base::ok); + assert(wp == w+1); + assert(np == n+4); + assert(n[0] == char(0xEF)); + assert(n[1] == char(0xBB)); + assert(n[2] == char(0xBF)); + assert(n[3] == char(0x56)); + } } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp index 480628f70..06df18575 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/converted.pass.cpp @@ -17,39 +17,9 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - typedef std::codecvt_utf8 Codecvt; - typedef std::wstring_convert Myconv; - Myconv myconv; - assert(myconv.converted() == 0); - std::string bs = myconv.to_bytes(L"\x1005"); - assert(myconv.converted() == 1); - bs = myconv.to_bytes(L"\x1005\x65"); - assert(myconv.converted() == 2); - std::wstring ws = myconv.from_bytes("\xE1\x80\x85"); - assert(myconv.converted() == 3); - } -} - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - typedef std::codecvt_utf8 Codecvt; +int main() +{ + typedef std::codecvt_utf8 Codecvt; typedef std::wstring_convert Myconv; Myconv myconv; assert(myconv.converted() == 0); @@ -59,7 +29,4 @@ void TestHelper::test() { assert(myconv.converted() == 2); std::wstring ws = myconv.from_bytes("\xF1\x80\x80\x83"); assert(myconv.converted() == 4); - } } - -int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp index 2e627b739..8705a5f3b 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/from_bytes.pass.cpp @@ -20,53 +20,20 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - std::wstring_convert > myconv; - std::string bs("\xE1\x80\x85\x00"); - std::wstring ws = myconv.from_bytes('a'); - assert(ws == L"a"); - ws = myconv.from_bytes(bs.c_str()); - assert(ws == L"\x1005"); - ws = myconv.from_bytes(bs); - assert(ws == L"\x1005"); - ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); - assert(ws == L"\x1005"); - ws = myconv.from_bytes(""); - assert(ws.size() == 0); - } +int main() +{ + { + std::wstring_convert > myconv; + std::string bs("\xF1\x80\x80\x83"); + std::wstring ws = myconv.from_bytes('a'); + assert(ws == L"a"); + ws = myconv.from_bytes(bs.c_str()); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(bs); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); + assert(ws == L"\x40003"); + ws = myconv.from_bytes(""); + assert(ws.size() == 0); + } } - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - std::wstring_convert > myconv; - std::string bs("\xF1\x80\x80\x83"); - std::wstring ws = myconv.from_bytes('a'); - assert(ws == L"a"); - ws = myconv.from_bytes(bs.c_str()); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(bs); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(bs.data(), bs.data() + bs.size()); - assert(ws == L"\x40003"); - ws = myconv.from_bytes(""); - assert(ws.size() == 0); - } -} - -int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp b/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp index 0a6cab73b..7253a18a7 100644 --- a/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp +++ b/test/std/localization/locales/locale.convenience/conversions/conversions.string/to_bytes.pass.cpp @@ -20,53 +20,20 @@ #include #include -template -struct TestHelper; -template -struct TestHelper { - static void test(); -}; -template -struct TestHelper { - static void test(); -}; - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - std::wstring_convert > myconv; - std::wstring ws(1, CharT(0x1005)); - std::string bs = myconv.to_bytes(ws[0]); - assert(bs == "\xE1\x80\x85\x00"); - bs = myconv.to_bytes(ws.c_str()); - assert(bs == "\xE1\x80\x85\x00"); - bs = myconv.to_bytes(ws); - assert(bs == "\xE1\x80\x85\x00"); - bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); - assert(bs == "\xE1\x80\x85\x00"); - bs = myconv.to_bytes(L""); - assert(bs.size() == 0); - } +int main() +{ + { + std::wstring_convert > myconv; + std::wstring ws(1, L'\x40003'); + std::string bs = myconv.to_bytes(ws[0]); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws.c_str()); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); + assert(bs == "\xF1\x80\x80\x83"); + bs = myconv.to_bytes(L""); + assert(bs.size() == 0); + } } - -template -void TestHelper::test() { - static_assert((std::is_same::value), ""); - { - std::wstring_convert > myconv; - std::wstring ws(1, CharT(0x40003)); - std::string bs = myconv.to_bytes(ws[0]); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws.c_str()); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(ws.data(), ws.data() + ws.size()); - assert(bs == "\xF1\x80\x80\x83"); - bs = myconv.to_bytes(L""); - assert(bs.size() == 0); - } -} - -int main() { TestHelper::test(); } diff --git a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp index e25fe3893..eb381f9a5 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_char_pointer_cat.pass.cpp @@ -9,10 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete - -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp index 72d47a391..f1afff665 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_locale_cat.pass.cpp @@ -9,10 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete - -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp index 26ddfa600..eb63cd03b 100644 --- a/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp +++ b/test/std/localization/locales/locale/locale.cons/locale_string_cat.pass.cpp @@ -9,10 +9,6 @@ // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 -// UNSUPPORTED: sanitizer-new-delete - -// XFAIL: availability_markup=macosx10.8 -// XFAIL: availability_markup=macosx10.7 // diff --git a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp index 8fc311a5b..0087f1943 100644 --- a/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp +++ b/test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp @@ -9,8 +9,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/numerics/c.math/cmath.pass.cpp b/test/std/numerics/c.math/cmath.pass.cpp index b5f586492..7161bd37e 100644 --- a/test/std/numerics/c.math/cmath.pass.cpp +++ b/test/std/numerics/c.math/cmath.pass.cpp @@ -10,7 +10,6 @@ // #include -#include #include #include @@ -552,13 +551,6 @@ void test_signbit() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::signbit(-1.0) == true); - assert(std::signbit(0u) == false); - assert(std::signbit(std::numeric_limits::max()) == false); - assert(std::signbit(0) == false); - assert(std::signbit(1) == false); - assert(std::signbit(-1) == true); - assert(std::signbit(std::numeric_limits::max()) == false); - assert(std::signbit(std::numeric_limits::min()) == true); } void test_fpclassify() @@ -572,11 +564,6 @@ void test_fpclassify() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::fpclassify(-1.0) == FP_NORMAL); - assert(std::fpclassify(0) == FP_ZERO); - assert(std::fpclassify(1) == FP_NORMAL); - assert(std::fpclassify(-1) == FP_NORMAL); - assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL); - assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL); } void test_isfinite() @@ -590,11 +577,6 @@ void test_isfinite() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isfinite(-1.0) == true); - assert(std::isfinite(0) == true); - assert(std::isfinite(1) == true); - assert(std::isfinite(-1) == true); - assert(std::isfinite(std::numeric_limits::max()) == true); - assert(std::isfinite(std::numeric_limits::min()) == true); } void test_isnormal() @@ -608,11 +590,6 @@ void test_isnormal() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnormal(-1.0) == true); - assert(std::isnormal(0) == false); - assert(std::isnormal(1) == true); - assert(std::isnormal(-1) == true); - assert(std::isnormal(std::numeric_limits::max()) == true); - assert(std::isnormal(std::numeric_limits::min()) == true); } void test_isgreater() @@ -674,11 +651,6 @@ void test_isinf() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isinf(-1.0) == false); - assert(std::isinf(0) == false); - assert(std::isinf(1) == false); - assert(std::isinf(-1) == false); - assert(std::isinf(std::numeric_limits::max()) == false); - assert(std::isinf(std::numeric_limits::min()) == false); } void test_isless() @@ -759,11 +731,6 @@ void test_isnan() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnan(-1.0) == false); - assert(std::isnan(0) == false); - assert(std::isnan(1) == false); - assert(std::isnan(-1) == false); - assert(std::isnan(std::numeric_limits::max()) == false); - assert(std::isnan(std::numeric_limits::min()) == false); } void test_isunordered() diff --git a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp index 8831ca1d6..a2e53629f 100644 --- a/test/std/numerics/complex.number/complex.literals/literals.pass.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals.pass.cpp @@ -14,8 +14,6 @@ #include #include -#include "test_macros.h" - int main() { using namespace std::literals::complex_literals; diff --git a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp index 6cc911d4e..67e0fa131 100644 --- a/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp +++ b/test/std/numerics/complex.number/complex.literals/literals1.fail.cpp @@ -12,8 +12,6 @@ #include #include -#include "test_macros.h" - int main() { std::complex foo = 1.0if; // should fail w/conversion operator not found diff --git a/test/std/numerics/complex.number/complex.members/construct.pass.cpp b/test/std/numerics/complex.number/complex.members/construct.pass.cpp index 25b9ce62c..b4d870fad 100644 --- a/test/std/numerics/complex.number/complex.members/construct.pass.cpp +++ b/test/std/numerics/complex.number/complex.members/construct.pass.cpp @@ -14,8 +14,6 @@ #include #include -#include "test_macros.h" - template void test() @@ -40,7 +38,7 @@ test() assert(c.real() == 10.5); assert(c.imag() == -9.5); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex c; static_assert(c.real() == 0, ""); diff --git a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp index 4d866acb8..24644e307 100644 --- a/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp +++ b/test/std/numerics/complex.number/complex.ops/stream_input.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: with_system_cxx_lib=macosx10.7 - // // template diff --git a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp index ac26e3c9e..e8d07ce28 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp index 3bb01ac46..298aaa3a7 100644 --- a/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_float_implicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp index 97c258024..6ff74a2cd 100644 --- a/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/double_long_double_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp index 3027d4cdc..77ca9d7f2 100644 --- a/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_double_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp index 515e83dfc..4fb11b4ca 100644 --- a/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/float_long_double_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp index 4f24a1c65..dd10c808b 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp index 8cbd7a8a1..aab539407 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_double_implicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp index 7930548f9..a5f5101c4 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_explicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf(cd); diff --git a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp index 22b9fd08a..25b93823f 100644 --- a/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp +++ b/test/std/numerics/complex.number/complex.special/long_double_float_implicit.pass.cpp @@ -18,8 +18,6 @@ #include #include -#include "test_macros.h" - int main() { { @@ -28,7 +26,7 @@ int main() assert(cf.real() == cd.real()); assert(cf.imag() == cd.imag()); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::complex cd(2.5, 3.5); constexpr std::complex cf = cd; diff --git a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp index 5122f44c3..7a671a73e 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.assign/initializer_list_assign.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template class valarray; @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -55,4 +54,5 @@ int main() assert(v2[i][j] == a[i][j]); } } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp index ce385e65c..4dfbe11bd 100644 --- a/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp +++ b/test/std/numerics/numarray/template.valarray/valarray.cons/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template class valarray; @@ -20,6 +18,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef int T; T a[] = {1, 2, 3, 4, 5}; @@ -38,4 +37,5 @@ int main() for (unsigned i = 0; i < N; ++i) assert(v[i] == a[i]); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp index 517a62a00..961b515ef 100644 --- a/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp +++ b/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp @@ -16,10 +16,8 @@ #include #include -#include -#include #include // for rand() -#include +#include constexpr struct { int x; @@ -38,24 +36,21 @@ constexpr struct { template -constexpr bool test0(int in1, int in2, int out) +constexpr bool test0(Input1 in1, Input2 in2, Output out) { - auto value1 = static_cast(in1); - auto value2 = static_cast(in2); - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v, ""); - assert(static_cast(out) == std::gcd(value1, value2)); - return true; + static_assert((std::is_same::value), "" ); + static_assert((std::is_same::value), "" ); + return out == std::gcd(in1, in2) ? true : (std::abort(), false); } template constexpr bool do_test(int = 0) { - using S1 = std::make_signed_t; - using S2 = std::make_signed_t; - using U1 = std::make_unsigned_t; - using U2 = std::make_unsigned_t; + using S1 = typename std::make_signed::type; + using S2 = typename std::make_signed::type; + using U1 = typename std::make_unsigned::type; + using U2 = typename std::make_unsigned::type; bool accumulate = true; for (auto TC : Cases) { { // Test with two signed types @@ -108,15 +103,15 @@ int main() assert(do_test(non_cce)); assert(do_test(non_cce)); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); + static_assert(do_test< int8_t>(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); + assert(do_test< int8_t>(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); static_assert(do_test(), ""); static_assert(do_test(), ""); @@ -138,8 +133,8 @@ int main() // LWG#2837 { - auto res = std::gcd(static_cast(1234), INT32_MIN); - static_assert(std::is_same_v, ""); - assert(res == 2); + auto res = std::gcd((int64_t)1234, (int32_t)-2147483648); + static_assert( std::is_same::type>::value, ""); + assert(res == 2); } } diff --git a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp index 6bd8a4f1e..90d48398f 100644 --- a/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp +++ b/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp @@ -11,14 +11,12 @@ // // template -// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) #include #include -#include -#include #include -#include +#include constexpr struct { int x; @@ -36,24 +34,21 @@ constexpr struct { }; template -constexpr bool test0(int in1, int in2, int out) +constexpr bool test0(Input1 in1, Input2 in2, Output out) { - auto value1 = static_cast(in1); - auto value2 = static_cast(in2); - static_assert(std::is_same_v, ""); - static_assert(std::is_same_v, ""); - assert(static_cast(out) == std::lcm(value1, value2)); - return true; + static_assert((std::is_same::value), "" ); + static_assert((std::is_same::value), "" ); + return out == std::lcm(in1, in2) ? true : (std::abort(), false); } template constexpr bool do_test(int = 0) { - using S1 = std::make_signed_t; - using S2 = std::make_signed_t; - using U1 = std::make_unsigned_t; - using U2 = std::make_unsigned_t; + using S1 = typename std::make_signed::type; + using S2 = typename std::make_signed::type; + using U1 = typename std::make_unsigned::type; + using U2 = typename std::make_unsigned::type; bool accumulate = true; for (auto TC : Cases) { { // Test with two signed types @@ -106,15 +101,15 @@ int main() assert(do_test(non_cce)); assert(do_test(non_cce)); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); - static_assert(do_test(), ""); + static_assert(do_test< int8_t>(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); + static_assert(do_test(), ""); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); - assert(do_test(non_cce)); + assert(do_test< int8_t>(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); + assert(do_test(non_cce)); static_assert(do_test(), ""); static_assert(do_test(), ""); @@ -136,9 +131,9 @@ int main() // LWG#2837 { - auto res1 = std::lcm(static_cast(1234), INT32_MIN); - (void)std::lcm(INT_MIN, 2UL); // this used to trigger UBSAN - static_assert(std::is_same_v, ""); - assert(res1 == 1324997410816LL); + auto res1 = std::lcm((int64_t)1234, (int32_t)-2147483648); + (void) std::lcm(INT_MIN, 2); // this used to trigger UBSAN + static_assert( std::is_same::type>::value, ""); + assert(res1 == 1324997410816LL); } } diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp index 8cc523e2f..f819f48b1 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.disc/values.pass.cpp @@ -26,8 +26,6 @@ #include #include -#include "test_macros.h" - template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp index 6076f934f..187a71edc 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.ibits/values.pass.cpp @@ -24,8 +24,6 @@ #include #include -#include "test_macros.h" - void test1() { diff --git a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp index c592b6df2..be5b4a978 100644 --- a/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp +++ b/test/std/numerics/rand/rand.adapt/rand.adapt.shuf/values.pass.cpp @@ -25,8 +25,6 @@ #include #include -#include "test_macros.h" - template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.device/ctor.pass.cpp b/test/std/numerics/rand/rand.device/ctor.pass.cpp index 5d72e474e..730576844 100644 --- a/test/std/numerics/rand/rand.device/ctor.pass.cpp +++ b/test/std/numerics/rand/rand.device/ctor.pass.cpp @@ -7,14 +7,6 @@ // //===----------------------------------------------------------------------===// -// See bugs.llvm.org/PR20183 -// -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.8 -// XFAIL: with_system_cxx_lib=macosx10.7 - // // class random_device; diff --git a/test/std/numerics/rand/rand.device/eval.pass.cpp b/test/std/numerics/rand/rand.device/eval.pass.cpp index b34e40c75..890f4caa3 100644 --- a/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -7,14 +7,6 @@ // //===----------------------------------------------------------------------===// -// See bugs.llvm.org/PR20183 -// -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.8 -// XFAIL: with_system_cxx_lib=macosx10.7 - // // class random_device; diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp index 031839317..bc4494b98 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/ctor_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; D d = {}; @@ -78,4 +77,5 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp index bd2a8c83d..1071305f4 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_default.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -29,4 +28,5 @@ int main() assert(p.size() == 1); assert(p[0] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp index 1144bfed3..79d8a0b71 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.discrete/param_ctor_init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::discrete_distribution<> D; typedef D::param_type P; @@ -85,4 +84,5 @@ int main() assert(p[1] == 0); assert(p[2] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp index e901afc39..d4f339fe7 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_default.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d; @@ -32,4 +31,5 @@ int main() assert(dn.size() == 1); assert(dn[0] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp index ecc3c8922..5708e4509 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/ctor_init_func.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -29,6 +27,7 @@ double f(double x) int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; D d({}, f); @@ -75,4 +74,5 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp index c037338cd..fa6530979 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.pconst/param_ctor_init_func.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -26,6 +24,7 @@ double f(double x) int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_constant_distribution<> D; typedef D::param_type P; @@ -76,4 +75,5 @@ int main() assert(dn[0] == 0.203125); assert(dn[1] == 0.1484375); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp index 99b0f5f4b..745bd6b97 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_default.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d; @@ -33,4 +32,5 @@ int main() assert(dn[0] == 1); assert(dn[1] == 1); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp index 77371de45..44c76f0cf 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/ctor_init_func.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -29,6 +27,7 @@ double f(double x) int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; D d({}, f); @@ -79,4 +78,5 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp index 518a4f265..cfa416434 100644 --- a/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp +++ b/test/std/numerics/rand/rand.dis/rand.dist.samp/rand.dist.samp.plinear/param_ctor_init_func.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -26,6 +24,7 @@ double f(double x) int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { typedef std::piecewise_linear_distribution<> D; typedef D::param_type P; @@ -80,4 +79,5 @@ int main() assert(dn[1] == 0.125); assert(dn[2] == 0.175); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp index 2080ac5f4..cd496fdbc 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp @@ -25,8 +25,6 @@ #include #include -#include "test_macros.h" - template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp index f7834afd4..3a16d62d7 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.mers/values.pass.cpp @@ -40,8 +40,6 @@ #include #include -#include "test_macros.h" - template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp index 6b8b4eed9..b3f12e723 100644 --- a/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp +++ b/test/std/numerics/rand/rand.eng/rand.eng.sub/values.pass.cpp @@ -28,8 +28,6 @@ #include #include -#include "test_macros.h" - template void where(const _Tp &) {} diff --git a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp index c0921d913..d4ee9c14d 100644 --- a/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp +++ b/test/std/numerics/rand/rand.util/rand.util.seedseq/initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class seed_seq; @@ -21,6 +19,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::seed_seq s= {5, 4, 3, 2, 1}; assert(s.size() == 5); unsigned b[5] = {0}; @@ -30,4 +29,5 @@ int main() assert(b[2] == 3); assert(b[3] == 2); assert(b[4] == 1); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.alg/re.alg.match/awk.pass.cpp b/test/std/re/re.alg/re.alg.match/awk.pass.cpp index 4fc1ea7fe..f86692979 100644 --- a/test/std/re/re.alg/re.alg.match/awk.pass.cpp +++ b/test/std/re/re.alg/re.alg.match/awk.pass.cpp @@ -26,8 +26,7 @@ int main() { -#if 0 - { +/* { std::cmatch m; const char s[] = "a"; assert(std::regex_match(s, m, std::regex("a", std::regex_constants::awk))); @@ -264,7 +263,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -279,7 +278,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -294,7 +293,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -327,7 +326,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -342,7 +341,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -357,7 +356,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -379,7 +378,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -395,7 +394,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -411,7 +410,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); assert(m.length(1) == 4); @@ -435,7 +434,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -520,7 +519,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -543,7 +542,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -573,7 +572,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -589,7 +588,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -605,7 +604,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -617,23 +616,24 @@ int main() assert(m.size() == 0); } std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); - { +*/ { + /* std::cmatch m; const char s[] = "m"; - assert(std::regex_match(s, m, - std::regex("[a[=M=]z]", std::regex_constants::awk))); - assert(m.size() == 1); + assert(std::regex_match(s, m, std::regex("[a[=M=]z]", + std::regex_constants::awk); + assert(m.size() == 1); assert(!m.prefix().matched); assert(m.prefix().first == s); assert(m.prefix().second == m[0].first); assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); - } - { +*/ } +/* { std::cmatch m; const char s[] = "Ch"; assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", @@ -645,7 +645,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -688,7 +688,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == 4); + assert(m.length(0) == 4); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -704,7 +704,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s + std::char_traits::length(s)); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -720,7 +720,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s+1); - assert((size_t)m.length(0) == 1); + assert(m.length(0) == 1); assert(m.position(0) == 0); assert(m.str(0) == L"a"); } @@ -735,7 +735,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s+2); - assert((size_t)m.length(0) == 2); + assert(m.length(0) == 2); assert(m.position(0) == 0); assert(m.str(0) == L"ab"); } @@ -945,7 +945,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -960,7 +960,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -975,7 +975,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1008,7 +1008,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1023,7 +1023,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1038,7 +1038,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1060,7 +1060,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1076,7 +1076,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1092,7 +1092,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); assert(m.length(1) == 4); @@ -1116,7 +1116,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1201,7 +1201,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1224,7 +1224,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1254,7 +1254,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1270,7 +1270,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1286,7 +1286,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1310,7 +1310,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1326,7 +1326,7 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == m[0].second); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } @@ -1385,9 +1385,8 @@ int main() assert(!m.suffix().matched); assert(m.suffix().first == m[0].second); assert(m.suffix().second == s + std::char_traits::length(s)); - assert((size_t)m.length(0) == std::char_traits::length(s)); + assert(m.length(0) == std::char_traits::length(s)); assert(m.position(0) == 0); assert(m.str(0) == s); } -#endif -} +*/} diff --git a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp index 849ec4ae5..6cffc0da9 100644 --- a/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp +++ b/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // class regex_token_iterator @@ -25,6 +23,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::regex phone_numbers("\\d{3}-(\\d{4})"); const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end"; @@ -62,4 +61,5 @@ int main() ++i; assert(i == std::cregex_token_iterator()); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp index fcaee8c3d..39c3a22ef 100644 --- a/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/assign.il.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > class basic_regex; @@ -23,6 +21,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}); assert(r2.flags() == std::regex::ECMAScript); @@ -31,4 +30,5 @@ int main() r2.assign({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex::extended); assert(r2.flags() == std::regex::extended); assert(r2.mark_count() == 2); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.assign/il.pass.cpp b/test/std/re/re.regex/re.regex.assign/il.pass.cpp index a74d9cf6e..022170f2d 100644 --- a/test/std/re/re.regex/re.regex.assign/il.pass.cpp +++ b/test/std/re/re.regex/re.regex.assign/il.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > class basic_regex; @@ -21,8 +19,10 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::regex r2; r2 = {'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}; assert(r2.flags() == std::regex::ECMAScript); assert(r2.mark_count() == 2); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp index 87dcc8569..c1554d6c3 100644 --- a/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp +++ b/test/std/re/re.regex/re.regex.construct/il_flg.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template > class basic_regex; @@ -20,6 +18,7 @@ #include #include "test_macros.h" +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS void test(std::initializer_list il, std::regex_constants::syntax_option_type f, unsigned mc) @@ -29,9 +28,11 @@ test(std::initializer_list il, std::regex_constants::syntax_option_type f, assert(r.mark_count() == mc); } +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::string s1("\\(a\\)"); std::string s2("\\(a[bc]\\)"); std::string s3("\\(a\\([bc]\\)\\)"); @@ -66,4 +67,5 @@ int main() test({'\\', '(', 'a', '[', 'b', 'c', ']', '\\', ')'}, std::regex_constants::egrep, 0); test({'\\', '(', 'a', '\\', '(', '[', 'b', 'c', ']', '\\', ')', '\\', ')'}, std::regex_constants::egrep, 0); test({'(', 'a', '(', '[', 'b', 'c', ']', ')', ')'}, std::regex_constants::egrep, 2); +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/re/re.traits/lookup_classname.pass.cpp b/test/std/re/re.traits/lookup_classname.pass.cpp index b61f772b2..2215b9043 100644 --- a/test/std/re/re.traits/lookup_classname.pass.cpp +++ b/test/std/re/re.traits/lookup_classname.pass.cpp @@ -27,61 +27,39 @@ test(const char_type* A, typename std::regex_traits::char_class_type expected, bool icase = false) { - typedef typename std::regex_traits::char_class_type char_class_type; std::regex_traits t; typedef forward_iterator F; - char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), icase); - assert(result == expected); -} - -template -void -test_w(const char_type* A, - typename std::regex_traits::char_class_type expected, - bool icase = false) -{ - typedef typename std::regex_traits::char_class_type char_class_type; - std::regex_traits t; - typedef forward_iterator F; - char_class_type result = t.lookup_classname(F(A), F(A + t.length(A)), icase); - assert((result & expected) == expected); - LIBCPP_ASSERT((expected | std::regex_traits::__regex_word) == result); - - const bool matches_underscore = t.isctype('_', result); - if (result != expected) - assert(matches_underscore && "expected to match underscore"); - else - assert(!matches_underscore && "should not match underscore"); + assert(t.lookup_classname(F(A), F(A + t.length(A)), icase) == expected); } int main() { // if __regex_word is not distinct from all the classes, bad things happen // See https://bugs.llvm.org/show_bug.cgi?id=26476 for an example. - LIBCPP_ASSERT((std::ctype_base::space & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::print & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::cntrl & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::upper & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::lower & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::alpha & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::digit & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::punct & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::xdigit & std::regex_traits::__regex_word) == 0); - LIBCPP_ASSERT((std::ctype_base::blank & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::space & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::print & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::cntrl & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::upper & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::lower & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::alpha & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::digit & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::punct & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::xdigit & std::regex_traits::__regex_word) == 0); + assert((std::ctype_base::blank & std::regex_traits::__regex_word) == 0); test("d", std::ctype_base::digit); test("D", std::ctype_base::digit); test("d", std::ctype_base::digit, true); test("D", std::ctype_base::digit, true); - test_w("w", std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower); - test_w("W", std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower); - test_w("w", std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower, true); - test_w("W", std::ctype_base::alnum - | std::ctype_base::upper | std::ctype_base::lower, true); + test("w", std::regex_traits::__regex_word | std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower); + test("W", std::regex_traits::__regex_word | std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower); + test("w", std::regex_traits::__regex_word | std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower, true); + test("W", std::regex_traits::__regex_word | std::ctype_base::alnum + | std::ctype_base::upper | std::ctype_base::lower, true); test("s", std::ctype_base::space); test("S", std::ctype_base::space); @@ -162,13 +140,13 @@ int main() test(L"d", std::ctype_base::digit, true); test(L"D", std::ctype_base::digit, true); - test_w(L"w", std::ctype_base::alnum + test(L"w", std::regex_traits::__regex_word | std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower); - test_w(L"W", std::ctype_base::alnum + test(L"W", std::regex_traits::__regex_word | std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower); - test_w(L"w", std::ctype_base::alnum + test(L"w", std::regex_traits::__regex_word | std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower, true); - test_w(L"W", std::ctype_base::alnum + test(L"W", std::regex_traits::__regex_word | std::ctype_base::alnum | std::ctype_base::upper | std::ctype_base::lower, true); test(L"s", std::ctype_base::space); diff --git a/test/std/re/re.traits/translate_nocase.pass.cpp b/test/std/re/re.traits/translate_nocase.pass.cpp index 33d365a9e..bf79629d3 100644 --- a/test/std/re/re.traits/translate_nocase.pass.cpp +++ b/test/std/re/re.traits/translate_nocase.pass.cpp @@ -16,8 +16,8 @@ // REQUIRES: locale.en_US.UTF-8 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // TODO: investigation needed // XFAIL: linux-gnu diff --git a/test/std/strings/basic.string.hash/strings.pass.cpp b/test/std/strings/basic.string.hash/strings.pass.cpp index d74e48575..5fc32c06a 100644 --- a/test/std/strings/basic.string.hash/strings.pass.cpp +++ b/test/std/strings/basic.string.hash/strings.pass.cpp @@ -22,8 +22,6 @@ #include #include -#include "test_macros.h" - template void test() @@ -31,8 +29,6 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); - H h; std::string g1 = "1234567890"; std::string g2 = "1234567891"; diff --git a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp index f36f53e65..59267f245 100644 --- a/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp +++ b/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp @@ -8,12 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-no-exceptions -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.8 -// XFAIL: with_system_cxx_lib=macosx10.7 - // // size_type max_size() const; diff --git a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp index 67ac43494..312e4d27f 100644 --- a/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ b/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -27,17 +27,16 @@ template void -test(SV sv, std::size_t pos, std::size_t n) +test(SV sv, unsigned pos, unsigned n) { typedef typename S::traits_type T; typedef typename S::allocator_type A; - typedef typename S::size_type Size; if (pos <= sv.size()) { - S s2(sv, static_cast(pos), static_cast(n)); + S s2(sv, pos, n); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); - std::size_t rlen = std::min(sv.size() - pos, n); + unsigned rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == A()); @@ -48,7 +47,7 @@ test(SV sv, std::size_t pos, std::size_t n) { try { - S s2(sv, static_cast(pos), static_cast(n)); + S s2(sv, pos, n); assert(false); } catch (std::out_of_range&) @@ -61,16 +60,16 @@ test(SV sv, std::size_t pos, std::size_t n) template void -test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a) +test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::size_type Size; + typedef typename S::allocator_type A; if (pos <= sv.size()) { - S s2(sv, static_cast(pos), static_cast(n), a); + S s2(sv, pos, n, a); LIBCPP_ASSERT(s2.__invariants()); assert(pos <= sv.size()); - std::size_t rlen = std::min(sv.size() - pos, n); + unsigned rlen = std::min(sv.size() - pos, n); assert(s2.size() == rlen); assert(T::compare(s2.data(), sv.data() + pos, rlen) == 0); assert(s2.get_allocator() == a); @@ -81,7 +80,7 @@ test(SV sv, std::size_t pos, std::size_t n, const typename S::allocator_type& a) { try { - S s2(sv, static_cast(pos), static_cast(n), a); + S s2(sv, pos, n, a); assert(false); } catch (std::out_of_range&) diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp index b464291d4..dac8860f9 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -204,20 +204,4 @@ int main() assert(s == "ABCD"); } - { // test with a move iterator that returns char&& - typedef forward_iterator It; - typedef std::move_iterator MoveIt; - const char p[] = "ABCD"; - std::string s; - s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); - assert(s == "ABCD"); - } - { // test with a move iterator that returns char&& - typedef const char* It; - typedef std::move_iterator MoveIt; - const char p[] = "ABCD"; - std::string s; - s.append(MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); - assert(s == "ABCD"); - } } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp index 31add9df2..8de5fc7ba 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter.pass.cpp @@ -24,7 +24,6 @@ test(S s, typename S::difference_type pos, S expected) typename S::const_iterator p = s.begin() + pos; typename S::iterator i = s.erase(p); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp index 858d3754e..e4fe2cdfd 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/iter_iter.pass.cpp @@ -25,7 +25,6 @@ test(S s, typename S::difference_type pos, typename S::difference_type n, S expe typename S::const_iterator last = s.cbegin() + pos + n; typename S::iterator i = s.erase(first, last); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); assert(i - s.begin() == pos); } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp index 8424b5429..64f8e506b 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/pop_back.pass.cpp @@ -23,7 +23,6 @@ test(S s, S expected) { s.pop_back(); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); } diff --git a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp index 2c900bb31..eb6be202a 100644 --- a/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp @@ -29,7 +29,6 @@ test(S s, typename S::size_type pos, typename S::size_type n, S expected) { s.erase(pos, n); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -59,7 +58,6 @@ test(S s, typename S::size_type pos, S expected) { s.erase(pos); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS @@ -85,7 +83,6 @@ test(S s, S expected) { s.erase(); LIBCPP_ASSERT(s.__invariants()); - assert(s[s.size()] == typename S::value_type()); assert(s == expected); } diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp index c5b7cbf9d..2adf846c1 100644 --- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_initializer_list.pass.cpp @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // iterator insert(const_iterator p, initializer_list il); +#if _LIBCPP_DEBUG >= 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) +#endif #include #include @@ -21,12 +22,14 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123456"); std::string::iterator i = s.insert(s.begin() + 3, {'a', 'b', 'c'}); assert(i - s.begin() == 3); assert(s == "123abc456"); } +#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("123456"); @@ -34,4 +37,14 @@ int main() assert(i - s.begin() == 3); assert(s == "123abc456"); } +#endif +#if _LIBCPP_DEBUG >= 1 + { + std::string s; + std::string s2; + s.insert(s2.begin(), {'a', 'b', 'c'}); + assert(false); + } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp index 2c8b6e4a1..e5ce8e51e 100644 --- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp @@ -188,35 +188,10 @@ int main() { // test assigning a different type typedef std::string S; - const uint8_t p[] = "ABCD"; + const uint8_t p[] = "ABCD"; - S s; - s.insert(s.begin(), p, p + 4); - assert(s == "ABCD"); + S s; + s.insert(s.begin(), p, p + 4); + assert(s == "ABCD"); } - - { // test with a move iterator that returns char&& - typedef input_iterator It; - typedef std::move_iterator MoveIt; - const char p[] = "ABCD"; - std::string s; - s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); - assert(s == "ABCD"); - } - { // test with a move iterator that returns char&& - typedef forward_iterator It; - typedef std::move_iterator MoveIt; - const char p[] = "ABCD"; - std::string s; - s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); - assert(s == "ABCD"); - } - { // test with a move iterator that returns char&& - typedef const char* It; - typedef std::move_iterator MoveIt; - const char p[] = "ABCD"; - std::string s; - s.insert(s.begin(), MoveIt(It(std::begin(p))), MoveIt(It(std::end(p) - 1))); - assert(s == "ABCD"); - } } diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp index 2a705ebf4..b60a58c55 100644 --- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_initializer_list.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // basic_string& replace(const_iterator i1, const_iterator i2, initializer_list il); @@ -20,15 +18,19 @@ int main() { +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS { std::string s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } +#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("123def456"); s.replace(s.cbegin() + 3, s.cbegin() + 6, {'a', 'b', 'c'}); assert(s == "123abc456"); } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp index 5dbfe9d4d..48d185480 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_delim_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc* def* ghij"), s, '*'); @@ -34,6 +33,7 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } +#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("initial text"); @@ -46,4 +46,6 @@ int main() getline(std::wistringstream(L" abc* def* ghij"), s, L'*'); assert(s == L" abc"); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp index 0c1fa8203..18c22f915 100644 --- a/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string.io/get_line_rv.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // // template @@ -24,6 +22,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::string s("initial text"); getline(std::istringstream(" abc\n def\n ghij"), s); @@ -34,6 +33,7 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } +#if TEST_STD_VER >= 11 { typedef std::basic_string, min_allocator> S; S s("initial text"); @@ -46,4 +46,6 @@ int main() getline(std::wistringstream(L" abc\n def\n ghij"), s); assert(s == L" abc"); } +#endif +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp index 7bf7da890..9a8213e23 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/char_string.pass.cpp @@ -21,50 +21,60 @@ #include #include -#include "test_macros.h" #include "min_allocator.h" template -void test0(typename S::value_type lhs, const S& rhs, const S& x) { - assert(lhs + rhs == x); +void +test0(typename S::value_type lhs, const S& rhs, const S& x) +{ + assert(lhs + rhs == x); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template -void test1(typename S::value_type lhs, S&& rhs, const S& x) { - assert(lhs + move(rhs) == x); +void +test1(typename S::value_type lhs, S&& rhs, const S& x) +{ + assert(lhs + move(rhs) == x); } -#endif -int main() { - { +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ + { typedef std::string S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); - } + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1('a', S(""), S("a")); + test1('a', S("12345"), S("a12345")); + test1('a', S("1234567890"), S("a1234567890")); + test1('a', S("12345678901234567890"), S("a12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #if TEST_STD_VER >= 11 - { - typedef std::string S; - test1('a', S(""), S("a")); - test1('a', S("12345"), S("a12345")); - test1('a', S("1234567890"), S("a1234567890")); - test1('a', S("12345678901234567890"), S("a12345678901234567890")); - } - { - typedef std::basic_string, - min_allocator > - S; + { + typedef std::basic_string, min_allocator> S; test0('a', S(""), S("a")); test0('a', S("12345"), S("a12345")); test0('a', S("1234567890"), S("a1234567890")); test0('a', S("12345678901234567890"), S("a12345678901234567890")); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1('a', S(""), S("a")); test1('a', S("12345"), S("a12345")); test1('a', S("1234567890"), S("a1234567890")); test1('a', S("12345678901234567890"), S("a12345678901234567890")); - } + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp index 090707fd8..88fa678ec 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/pointer_string.pass.cpp @@ -21,23 +21,29 @@ #include #include -#include "test_macros.h" #include "min_allocator.h" template -void test0(const typename S::value_type* lhs, const S& rhs, const S& x) { - assert(lhs + rhs == x); +void +test0(const typename S::value_type* lhs, const S& rhs, const S& x) +{ + assert(lhs + rhs == x); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template -void test1(const typename S::value_type* lhs, S&& rhs, const S& x) { - assert(lhs + move(rhs) == x); +void +test1(const typename S::value_type* lhs, S&& rhs, const S& x) +{ + assert(lhs + move(rhs) == x); } -#endif -int main() { - { +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ + { typedef std::string S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); @@ -50,43 +56,36 @@ int main() { test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), - S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } + test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1("", S(""), S("")); + test1("", S("12345"), S("12345")); + test1("", S("1234567890"), S("1234567890")); + test1("", S("12345678901234567890"), S("12345678901234567890")); + test1("abcde", S(""), S("abcde")); + test1("abcde", S("12345"), S("abcde12345")); + test1("abcde", S("1234567890"), S("abcde1234567890")); + test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); + test1("abcdefghij", S(""), S("abcdefghij")); + test1("abcdefghij", S("12345"), S("abcdefghij12345")); + test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); + test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); + test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); + test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #if TEST_STD_VER >= 11 - { - typedef std::string S; - test1("", S(""), S("")); - test1("", S("12345"), S("12345")); - test1("", S("1234567890"), S("1234567890")); - test1("", S("12345678901234567890"), S("12345678901234567890")); - test1("abcde", S(""), S("abcde")); - test1("abcde", S("12345"), S("abcde12345")); - test1("abcde", S("1234567890"), S("abcde1234567890")); - test1("abcde", S("12345678901234567890"), S("abcde12345678901234567890")); - test1("abcdefghij", S(""), S("abcdefghij")); - test1("abcdefghij", S("12345"), S("abcdefghij12345")); - test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); - test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } - { - typedef std::basic_string, - min_allocator > - S; + { + typedef std::basic_string, min_allocator> S; test0("", S(""), S("")); test0("", S("12345"), S("12345")); test0("", S("1234567890"), S("1234567890")); @@ -98,14 +97,13 @@ int main() { test0("abcdefghij", S(""), S("abcdefghij")); test0("abcdefghij", S("12345"), S("abcdefghij12345")); test0("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test0("abcdefghij", S("12345678901234567890"), - S("abcdefghij12345678901234567890")); + test0("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); test0("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test0("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test0("abcdefghijklmnopqrst", S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test0("abcdefghijklmnopqrst", S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); + test0("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1("", S(""), S("")); test1("", S("12345"), S("12345")); @@ -118,14 +116,13 @@ int main() { test1("abcdefghij", S(""), S("abcdefghij")); test1("abcdefghij", S("12345"), S("abcdefghij12345")); test1("abcdefghij", S("1234567890"), S("abcdefghij1234567890")); - test1("abcdefghij", S("12345678901234567890"), - S("abcdefghij12345678901234567890")); + test1("abcdefghij", S("12345678901234567890"), S("abcdefghij12345678901234567890")); test1("abcdefghijklmnopqrst", S(""), S("abcdefghijklmnopqrst")); test1("abcdefghijklmnopqrst", S("12345"), S("abcdefghijklmnopqrst12345")); - test1("abcdefghijklmnopqrst", S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test1("abcdefghijklmnopqrst", S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } + test1("abcdefghijklmnopqrst", S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1("abcdefghijklmnopqrst", S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp index 9bc3a4d41..b4c2c9704 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_char.pass.cpp @@ -21,50 +21,60 @@ #include #include -#include "test_macros.h" #include "min_allocator.h" template -void test0(const S& lhs, typename S::value_type rhs, const S& x) { - assert(lhs + rhs == x); +void +test0(const S& lhs, typename S::value_type rhs, const S& x) +{ + assert(lhs + rhs == x); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template -void test1(S&& lhs, typename S::value_type rhs, const S& x) { - assert(move(lhs) + rhs == x); +void +test1(S&& lhs, typename S::value_type rhs, const S& x) +{ + assert(move(lhs) + rhs == x); } -#endif -int main() { - { +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ + { typedef std::string S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - } + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), '1', S("1")); + test1(S("abcde"), '1', S("abcde1")); + test1(S("abcdefghij"), '1', S("abcdefghij1")); + test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #if TEST_STD_VER >= 11 - { - typedef std::string S; - test1(S(""), '1', S("1")); - test1(S("abcde"), '1', S("abcde1")); - test1(S("abcdefghij"), '1', S("abcdefghij1")); - test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - } - { - typedef std::basic_string, - min_allocator > - S; + { + typedef std::basic_string, min_allocator> S; test0(S(""), '1', S("1")); test0(S("abcde"), '1', S("abcde1")); test0(S("abcdefghij"), '1', S("abcdefghij1")); test0(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test1(S(""), '1', S("1")); test1(S("abcde"), '1', S("abcde1")); test1(S("abcdefghij"), '1', S("abcdefghij1")); test1(S("abcdefghijklmnopqrst"), '1', S("abcdefghijklmnopqrst1")); - } + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp index a9aa92f37..3b669e7d9 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_pointer.pass.cpp @@ -21,23 +21,29 @@ #include #include -#include "test_macros.h" #include "min_allocator.h" template -void test0(const S& lhs, const typename S::value_type* rhs, const S& x) { - assert(lhs + rhs == x); +void +test0(const S& lhs, const typename S::value_type* rhs, const S& x) +{ + assert(lhs + rhs == x); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + template -void test1(S&& lhs, const typename S::value_type* rhs, const S& x) { - assert(move(lhs) + rhs == x); +void +test1(S&& lhs, const typename S::value_type* rhs, const S& x) +{ + assert(move(lhs) + rhs == x); } -#endif -int main() { - { +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ + { typedef std::string S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); @@ -50,42 +56,36 @@ int main() { test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", - S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", - S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", - S("abcdefghijklmnopqrst12345678901234567890")); - } + test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), "", S("")); + test1(S(""), "12345", S("12345")); + test1(S(""), "1234567890", S("1234567890")); + test1(S(""), "12345678901234567890", S("12345678901234567890")); + test1(S("abcde"), "", S("abcde")); + test1(S("abcde"), "12345", S("abcde12345")); + test1(S("abcde"), "1234567890", S("abcde1234567890")); + test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); + test1(S("abcdefghij"), "", S("abcdefghij")); + test1(S("abcdefghij"), "12345", S("abcdefghij12345")); + test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); + test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #if TEST_STD_VER >= 11 - { - typedef std::string S; - test1(S(""), "", S("")); - test1(S(""), "12345", S("12345")); - test1(S(""), "1234567890", S("1234567890")); - test1(S(""), "12345678901234567890", S("12345678901234567890")); - test1(S("abcde"), "", S("abcde")); - test1(S("abcde"), "12345", S("abcde12345")); - test1(S("abcde"), "1234567890", S("abcde1234567890")); - test1(S("abcde"), "12345678901234567890", S("abcde12345678901234567890")); - test1(S("abcdefghij"), "", S("abcdefghij")); - test1(S("abcdefghij"), "12345", S("abcdefghij12345")); - test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", - S("abcdefghij12345678901234567890")); - test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", - S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", - S("abcdefghijklmnopqrst12345678901234567890")); - } - { - typedef std::basic_string, - min_allocator > - S; + { + typedef std::basic_string, min_allocator> S; test0(S(""), "", S("")); test0(S(""), "12345", S("12345")); test0(S(""), "1234567890", S("1234567890")); @@ -97,14 +97,13 @@ int main() { test0(S("abcdefghij"), "", S("abcdefghij")); test0(S("abcdefghij"), "12345", S("abcdefghij12345")); test0(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test0(S("abcdefghij"), "12345678901234567890", - S("abcdefghij12345678901234567890")); + test0(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); test0(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test0(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), "1234567890", - S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), "12345678901234567890", - S("abcdefghijklmnopqrst12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES test1(S(""), "", S("")); test1(S(""), "12345", S("12345")); @@ -117,14 +116,13 @@ int main() { test1(S("abcdefghij"), "", S("abcdefghij")); test1(S("abcdefghij"), "12345", S("abcdefghij12345")); test1(S("abcdefghij"), "1234567890", S("abcdefghij1234567890")); - test1(S("abcdefghij"), "12345678901234567890", - S("abcdefghij12345678901234567890")); + test1(S("abcdefghij"), "12345678901234567890", S("abcdefghij12345678901234567890")); test1(S("abcdefghijklmnopqrst"), "", S("abcdefghijklmnopqrst")); test1(S("abcdefghijklmnopqrst"), "12345", S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), "1234567890", - S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), "12345678901234567890", - S("abcdefghijklmnopqrst12345678901234567890")); - } + test1(S("abcdefghijklmnopqrst"), "1234567890", S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), "12345678901234567890", S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #endif } diff --git a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp index fbef64627..1977b6f51 100644 --- a/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp +++ b/test/std/strings/basic.string/string.nonmembers/string_op+/string_string.pass.cpp @@ -33,217 +33,190 @@ #include #include -#include "test_macros.h" #include "min_allocator.h" template -void test0(const S& lhs, const S& rhs, const S& x) { - assert(lhs + rhs == x); +void +test0(const S& lhs, const S& rhs, const S& x) +{ + assert(lhs + rhs == x); } +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +void +test1(S&& lhs, const S& rhs, const S& x) +{ + assert(move(lhs) + rhs == x); +} + +template +void +test2(const S& lhs, S&& rhs, const S& x) +{ + assert(lhs + move(rhs) == x); +} + +template +void +test3(S&& lhs, S&& rhs, const S& x) +{ + assert(move(lhs) + move(rhs) == x); +} + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ + { + typedef std::string S; + test0(S(""), S(""), S("")); + test0(S(""), S("12345"), S("12345")); + test0(S(""), S("1234567890"), S("1234567890")); + test0(S(""), S("12345678901234567890"), S("12345678901234567890")); + test0(S("abcde"), S(""), S("abcde")); + test0(S("abcde"), S("12345"), S("abcde12345")); + test0(S("abcde"), S("1234567890"), S("abcde1234567890")); + test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcdefghij"), S(""), S("abcdefghij")); + test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + + test1(S(""), S(""), S("")); + test1(S(""), S("12345"), S("12345")); + test1(S(""), S("1234567890"), S("1234567890")); + test1(S(""), S("12345678901234567890"), S("12345678901234567890")); + test1(S("abcde"), S(""), S("abcde")); + test1(S("abcde"), S("12345"), S("abcde12345")); + test1(S("abcde"), S("1234567890"), S("abcde1234567890")); + test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcdefghij"), S(""), S("abcdefghij")); + test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test2(S(""), S(""), S("")); + test2(S(""), S("12345"), S("12345")); + test2(S(""), S("1234567890"), S("1234567890")); + test2(S(""), S("12345678901234567890"), S("12345678901234567890")); + test2(S("abcde"), S(""), S("abcde")); + test2(S("abcde"), S("12345"), S("abcde12345")); + test2(S("abcde"), S("1234567890"), S("abcde1234567890")); + test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcdefghij"), S(""), S("abcdefghij")); + test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test3(S(""), S(""), S("")); + test3(S(""), S("12345"), S("12345")); + test3(S(""), S("1234567890"), S("1234567890")); + test3(S(""), S("12345678901234567890"), S("12345678901234567890")); + test3(S("abcde"), S(""), S("abcde")); + test3(S("abcde"), S("12345"), S("abcde12345")); + test3(S("abcde"), S("1234567890"), S("abcde1234567890")); + test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcdefghij"), S(""), S("abcdefghij")); + test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #if TEST_STD_VER >= 11 -template -void test1(S&& lhs, const S& rhs, const S& x) { - assert(move(lhs) + rhs == x); -} + { + typedef std::basic_string, min_allocator> S; + test0(S(""), S(""), S("")); + test0(S(""), S("12345"), S("12345")); + test0(S(""), S("1234567890"), S("1234567890")); + test0(S(""), S("12345678901234567890"), S("12345678901234567890")); + test0(S("abcde"), S(""), S("abcde")); + test0(S("abcde"), S("12345"), S("abcde12345")); + test0(S("abcde"), S("1234567890"), S("abcde1234567890")); + test0(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test0(S("abcdefghij"), S(""), S("abcdefghij")); + test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test0(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test0(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test0(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); -template -void test2(const S& lhs, S&& rhs, const S& x) { - assert(lhs + move(rhs) == x); -} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -template -void test3(S&& lhs, S&& rhs, const S& x) { - assert(move(lhs) + move(rhs) == x); -} + test1(S(""), S(""), S("")); + test1(S(""), S("12345"), S("12345")); + test1(S(""), S("1234567890"), S("1234567890")); + test1(S(""), S("12345678901234567890"), S("12345678901234567890")); + test1(S("abcde"), S(""), S("abcde")); + test1(S("abcde"), S("12345"), S("abcde12345")); + test1(S("abcde"), S("1234567890"), S("abcde1234567890")); + test1(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test1(S("abcdefghij"), S(""), S("abcdefghij")); + test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test1(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test1(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test1(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + test2(S(""), S(""), S("")); + test2(S(""), S("12345"), S("12345")); + test2(S(""), S("1234567890"), S("1234567890")); + test2(S(""), S("12345678901234567890"), S("12345678901234567890")); + test2(S("abcde"), S(""), S("abcde")); + test2(S("abcde"), S("12345"), S("abcde12345")); + test2(S("abcde"), S("1234567890"), S("abcde1234567890")); + test2(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test2(S("abcdefghij"), S(""), S("abcdefghij")); + test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test2(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test2(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test2(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + + test3(S(""), S(""), S("")); + test3(S(""), S("12345"), S("12345")); + test3(S(""), S("1234567890"), S("1234567890")); + test3(S(""), S("12345678901234567890"), S("12345678901234567890")); + test3(S("abcde"), S(""), S("abcde")); + test3(S("abcde"), S("12345"), S("abcde12345")); + test3(S("abcde"), S("1234567890"), S("abcde1234567890")); + test3(S("abcde"), S("12345678901234567890"), S("abcde12345678901234567890")); + test3(S("abcdefghij"), S(""), S("abcdefghij")); + test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); + test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); + test3(S("abcdefghij"), S("12345678901234567890"), S("abcdefghij12345678901234567890")); + test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); + test3(S("abcdefghijklmnopqrst"), S("12345"), S("abcdefghijklmnopqrst12345")); + test3(S("abcdefghijklmnopqrst"), S("1234567890"), S("abcdefghijklmnopqrst1234567890")); + test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), S("abcdefghijklmnopqrst12345678901234567890")); + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + } #endif - -int main() { - { - typedef std::string S; - test0(S(""), S(""), S("")); - test0(S(""), S("12345"), S("12345")); - test0(S(""), S("1234567890"), S("1234567890")); - test0(S(""), S("12345678901234567890"), S("12345678901234567890")); - test0(S("abcde"), S(""), S("abcde")); - test0(S("abcde"), S("12345"), S("abcde12345")); - test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test0(S("abcdefghij"), S(""), S("abcdefghij")); - test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } -#if TEST_STD_VER >= 11 - { - typedef std::string S; - test1(S(""), S(""), S("")); - test1(S(""), S("12345"), S("12345")); - test1(S(""), S("1234567890"), S("1234567890")); - test1(S(""), S("12345678901234567890"), S("12345678901234567890")); - test1(S("abcde"), S(""), S("abcde")); - test1(S("abcde"), S("12345"), S("abcde12345")); - test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test1(S("abcdefghij"), S(""), S("abcdefghij")); - test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - - test2(S(""), S(""), S("")); - test2(S(""), S("12345"), S("12345")); - test2(S(""), S("1234567890"), S("1234567890")); - test2(S(""), S("12345678901234567890"), S("12345678901234567890")); - test2(S("abcde"), S(""), S("abcde")); - test2(S("abcde"), S("12345"), S("abcde12345")); - test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test2(S("abcdefghij"), S(""), S("abcdefghij")); - test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - - test3(S(""), S(""), S("")); - test3(S(""), S("12345"), S("12345")); - test3(S(""), S("1234567890"), S("1234567890")); - test3(S(""), S("12345678901234567890"), S("12345678901234567890")); - test3(S("abcde"), S(""), S("abcde")); - test3(S("abcde"), S("12345"), S("abcde12345")); - test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test3(S("abcdefghij"), S(""), S("abcdefghij")); - test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } - { - typedef std::basic_string, - min_allocator > - S; - test0(S(""), S(""), S("")); - test0(S(""), S("12345"), S("12345")); - test0(S(""), S("1234567890"), S("1234567890")); - test0(S(""), S("12345678901234567890"), S("12345678901234567890")); - test0(S("abcde"), S(""), S("abcde")); - test0(S("abcde"), S("12345"), S("abcde12345")); - test0(S("abcde"), S("1234567890"), S("abcde1234567890")); - test0(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test0(S("abcdefghij"), S(""), S("abcdefghij")); - test0(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test0(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test0(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test0(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test0(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test0(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test0(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - - test1(S(""), S(""), S("")); - test1(S(""), S("12345"), S("12345")); - test1(S(""), S("1234567890"), S("1234567890")); - test1(S(""), S("12345678901234567890"), S("12345678901234567890")); - test1(S("abcde"), S(""), S("abcde")); - test1(S("abcde"), S("12345"), S("abcde12345")); - test1(S("abcde"), S("1234567890"), S("abcde1234567890")); - test1(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test1(S("abcdefghij"), S(""), S("abcdefghij")); - test1(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test1(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test1(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test1(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test1(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test1(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test1(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - - test2(S(""), S(""), S("")); - test2(S(""), S("12345"), S("12345")); - test2(S(""), S("1234567890"), S("1234567890")); - test2(S(""), S("12345678901234567890"), S("12345678901234567890")); - test2(S("abcde"), S(""), S("abcde")); - test2(S("abcde"), S("12345"), S("abcde12345")); - test2(S("abcde"), S("1234567890"), S("abcde1234567890")); - test2(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test2(S("abcdefghij"), S(""), S("abcdefghij")); - test2(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test2(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test2(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test2(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test2(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test2(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test2(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - - test3(S(""), S(""), S("")); - test3(S(""), S("12345"), S("12345")); - test3(S(""), S("1234567890"), S("1234567890")); - test3(S(""), S("12345678901234567890"), S("12345678901234567890")); - test3(S("abcde"), S(""), S("abcde")); - test3(S("abcde"), S("12345"), S("abcde12345")); - test3(S("abcde"), S("1234567890"), S("abcde1234567890")); - test3(S("abcde"), S("12345678901234567890"), - S("abcde12345678901234567890")); - test3(S("abcdefghij"), S(""), S("abcdefghij")); - test3(S("abcdefghij"), S("12345"), S("abcdefghij12345")); - test3(S("abcdefghij"), S("1234567890"), S("abcdefghij1234567890")); - test3(S("abcdefghij"), S("12345678901234567890"), - S("abcdefghij12345678901234567890")); - test3(S("abcdefghijklmnopqrst"), S(""), S("abcdefghijklmnopqrst")); - test3(S("abcdefghijklmnopqrst"), S("12345"), - S("abcdefghijklmnopqrst12345")); - test3(S("abcdefghijklmnopqrst"), S("1234567890"), - S("abcdefghijklmnopqrst1234567890")); - test3(S("abcdefghijklmnopqrst"), S("12345678901234567890"), - S("abcdefghijklmnopqrst12345678901234567890")); - } -#endif // TEST_STD_VER >= 11 } diff --git a/test/std/strings/string.conversions/stof.pass.cpp b/test/std/strings/string.conversions/stof.pass.cpp index a5e587236..1e17e1d3a 100644 --- a/test/std/strings/string.conversions/stof.pass.cpp +++ b/test/std/strings/string.conversions/stof.pass.cpp @@ -7,9 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR14919 was fixed in r172447, out_of_range wasn't thrown before. -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/strings/string.conversions/stol.pass.cpp b/test/std/strings/string.conversions/stol.pass.cpp index 5e16735dc..457cf0a76 100644 --- a/test/std/strings/string.conversions/stol.pass.cpp +++ b/test/std/strings/string.conversions/stol.pass.cpp @@ -7,9 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR14919 was fixed in r172447, out_of_range wasn't thrown before. -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/strings/string.conversions/stoll.pass.cpp b/test/std/strings/string.conversions/stoll.pass.cpp index c33f9ee5e..ca8412aeb 100644 --- a/test/std/strings/string.conversions/stoll.pass.cpp +++ b/test/std/strings/string.conversions/stoll.pass.cpp @@ -7,9 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR14919 was fixed in r172447, out_of_range wasn't thrown before. -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/strings/string.conversions/stoul.pass.cpp b/test/std/strings/string.conversions/stoul.pass.cpp index 523c49a29..1acdf1164 100644 --- a/test/std/strings/string.conversions/stoul.pass.cpp +++ b/test/std/strings/string.conversions/stoul.pass.cpp @@ -7,9 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR14919 was fixed in r172447, out_of_range wasn't thrown before. -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/strings/string.conversions/stoull.pass.cpp b/test/std/strings/string.conversions/stoull.pass.cpp index 549c8da9a..e63679eed 100644 --- a/test/std/strings/string.conversions/stoull.pass.cpp +++ b/test/std/strings/string.conversions/stoull.pass.cpp @@ -7,9 +7,8 @@ // //===----------------------------------------------------------------------===// // -// PR14919 was fixed in r172447, out_of_range wasn't thrown before. -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/libcxx/selftest/test.arc.fail.mm b/test/std/strings/string.view/nothing_to_do.pass.cpp similarity index 80% rename from test/libcxx/selftest/test.arc.fail.mm rename to test/std/strings/string.view/nothing_to_do.pass.cpp index a185eab13..353dd98f4 100644 --- a/test/libcxx/selftest/test.arc.fail.mm +++ b/test/std/strings/string.view/nothing_to_do.pass.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -8,6 +7,6 @@ // //===----------------------------------------------------------------------===// -#if __has_feature(objc_arc) -#error This test should not compile. -#endif +#include + +int main () {} diff --git a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp index 53c3d261d..d07664825 100644 --- a/test/std/strings/string.view/string.view.hash/string_view.pass.cpp +++ b/test/std/strings/string.view/string.view.hash/string_view.pass.cpp @@ -23,8 +23,6 @@ #include #include -#include "test_macros.h" - using std::string_view; template @@ -38,7 +36,6 @@ test() typedef typename SV::value_type char_type; typedef std::basic_string String; typedef std::hash SH; - ASSERT_NOEXCEPT(H()(SV())); char_type g1 [ 10 ]; char_type g2 [ 10 ]; diff --git a/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp b/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp new file mode 100644 index 000000000..c1137e80a --- /dev/null +++ b/test/std/strings/string.view/string.view.modifiers/clear.pass.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + +// + +// void clear() noexcept + +#include +#include + +#include "test_macros.h" + +template +void test ( const CharT *s, size_t len ) { + typedef std::basic_string_view SV; + { + SV sv1 ( s ); + assert ( sv1.size() == len ); + assert ( sv1.data() == s ); + + sv1.clear (); + assert ( sv1.data() == nullptr ); + assert ( sv1.size() == 0 ); + assert ( sv1 == SV()); + } +} + +#if TEST_STD_VER > 11 +constexpr size_t test_ce ( size_t n ) { + typedef std::basic_string_view SV; + SV sv1{ "ABCDEFGHIJKL", n }; + sv1.clear(); + return sv1.size(); +} +#endif + +int main () { + test ( "ABCDE", 5 ); + test ( "a", 1 ); + test ( "", 0 ); + + test ( L"ABCDE", 5 ); + test ( L"a", 1 ); + test ( L"", 0 ); + +#if TEST_STD_VER >= 11 + test ( u"ABCDE", 5 ); + test ( u"a", 1 ); + test ( u"", 0 ); + + test ( U"ABCDE", 5 ); + test ( U"a", 1 ); + test ( U"", 0 ); +#endif + +#if TEST_STD_VER > 11 + static_assert ( test_ce (5) == 0, "" ); +#endif + +} diff --git a/test/std/strings/string.view/traits_mismatch.fail.cpp b/test/std/strings/string.view/traits_mismatch.fail.cpp deleted file mode 100644 index 6cd15e6a6..000000000 --- a/test/std/strings/string.view/traits_mismatch.fail.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// -// The string_views's value type must be the same as the traits's char_type - -#include - -int main() -{ - std::basic_string_view> s; -} diff --git a/test/std/thread/futures/futures.future_error/what.pass.cpp b/test/std/thread/futures/futures.future_error/what.pass.cpp index 957d530ab..a44f8af7d 100644 --- a/test/std/thread/futures/futures.future_error/what.pass.cpp +++ b/test/std/thread/futures/futures.future_error/what.pass.cpp @@ -12,11 +12,9 @@ // 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_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin13 // diff --git a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp index 7cac21d48..39784876b 100644 --- a/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp +++ b/test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp @@ -69,7 +69,7 @@ int main() p(3, 'a'); assert(f.get() == 105.0); assert(A::n_copies > 0); - assert(A::n_moves >= 0); + assert(A::n_moves > 0); } assert(test_alloc_base::alloc_count == 0); A::n_copies = 0; diff --git a/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp b/test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp similarity index 100% rename from test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp rename to test/std/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp index a0071cd65..245c48088 100644 --- a/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp @@ -188,7 +188,7 @@ int main() } } #endif -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS { L0 l0; L0 l1; @@ -518,5 +518,5 @@ int main() } } #endif // TEST_HAS_NO_EXCEPTIONS -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_VARIADICS } diff --git a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp index 4ad7a3ac2..fb563cbe0 100644 --- a/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp @@ -126,7 +126,7 @@ int main() } } #endif -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS { L0 l0; L0 l1; @@ -522,5 +522,5 @@ int main() assert(!l2.locked()); assert(!l3.locked()); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_VARIADICS } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp index 97f9d07c1..a15405fcd 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp @@ -15,16 +15,11 @@ // explicit lock_guard(mutex_type& m); -// template lock_guard(lock_guard<_Mutex>) -// -> lock_guard<_Mutex>; // C++17 - #include #include #include #include -#include "test_macros.h" - std::mutex m; typedef std::chrono::system_clock Clock; @@ -52,9 +47,4 @@ int main() std::this_thread::sleep_for(ms(250)); m.unlock(); t.join(); - -#ifdef __cpp_deduction_guides - std::lock_guard lg(m); - static_assert((std::is_same>::value), "" ); -#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp similarity index 71% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp index 78165383a..81fc0d368 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_adopt_lock.pass.cpp @@ -8,17 +8,18 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template class scoped_lock; +// template class lock_guard; -// scoped_lock(Mutex&..., adopt_lock_t); +// lock_guard(Mutex&..., adopt_lock_t); +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include -#include "test_macros.h" struct TestMutex { bool locked = false; @@ -35,22 +36,12 @@ struct TestMutex { int main() { { - using LG = std::scoped_lock<>; + using LG = std::lock_guard<>; LG lg(std::adopt_lock); } - { - TestMutex m1; - using LG = std::scoped_lock; - m1.lock(); - { - LG lg(m1, std::adopt_lock); - assert(m1.locked); - } - assert(!m1.locked); - } { TestMutex m1, m2; - using LG = std::scoped_lock; + using LG = std::lock_guard; m1.lock(); m2.lock(); { LG lg(m1, m2, std::adopt_lock); @@ -60,7 +51,7 @@ int main() } { TestMutex m1, m2, m3; - using LG = std::scoped_lock; + using LG = std::lock_guard; m1.lock(); m2.lock(); m3.lock(); { LG lg(m1, m2, m3, std::adopt_lock); diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp similarity index 66% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp index a05472935..1b4c9d4bf 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/assign.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_assign.fail.cpp @@ -8,16 +8,17 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template class scoped_lock; +// template class lock_guard; -// scoped_lock& operator=(scoped_lock const&) = delete; +// lock_guard& operator=(lock_guard const&) = delete; +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include -#include "test_macros.h" int main() { @@ -25,24 +26,18 @@ int main() M m0, m1, m2; M om0, om1, om2; { - using LG = std::scoped_lock<>; + using LG = std::lock_guard<>; LG lg1, lg2; lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} } { - using LG = std::scoped_lock; - LG lg1(m0); - LG lg2(om0); - lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} - } - { - using LG = std::scoped_lock; + using LG = std::lock_guard; LG lg1(m0, m1); LG lg2(om0, om1); lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} } { - using LG = std::scoped_lock; + using LG = std::lock_guard; LG lg1(m0, m1, m2); LG lg2(om0, om1, om2); lg1 = lg2; // expected-error{{overload resolution selected deleted operator '='}} diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp similarity index 65% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp index 5075a4268..c7fd0e94b 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/copy.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_copy.fail.cpp @@ -8,38 +8,34 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template class scoped_lock; +// template class lock_guard; -// scoped_lock(scoped_lock const&) = delete; +// lock_guard(lock_guard const&) = delete; +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include -#include "test_macros.h" int main() { using M = std::mutex; M m0, m1, m2; { - using LG = std::scoped_lock<>; + using LG = std::lock_guard<>; const LG Orig; LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } { - using LG = std::scoped_lock; - const LG Orig(m0); - LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} - } - { - using LG = std::scoped_lock; + using LG = std::lock_guard; const LG Orig(m0, m1); LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } { - using LG = std::scoped_lock; + using LG = std::lock_guard; const LG Orig(m0, m1, m2); LG Copy(Orig); // expected-error{{call to deleted constructor of 'LG'}} } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp similarity index 69% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp index 7bb467326..1eef7e268 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.fail.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.fail.cpp @@ -8,16 +8,17 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template class scoped_lock; +// template class lock_guard; -// explicit scoped_lock(Mutex&...); +// explicit lock_guard(Mutex&...); +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include -#include "test_macros.h" template void test_conversion(LG) {} @@ -28,25 +29,19 @@ int main() M m0, m1, m2; M n0, n1, n2; { - using LG = std::scoped_lock<>; + using LG = std::lock_guard<>; LG lg = {}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({}); // expected-error{{no matching function for call}} ((void)lg); } { - using LG = std::scoped_lock; - LG lg = {m0}; // expected-error{{chosen constructor is explicit in copy-initialization}} - test_conversion({n0}); // expected-error{{no matching function for call}} - ((void)lg); - } - { - using LG = std::scoped_lock; + using LG = std::lock_guard; LG lg = {m0, m1}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({n0, n1}); // expected-error{{no matching function for call}} ((void)lg); } { - using LG = std::scoped_lock; + using LG = std::lock_guard; LG lg = {m0, m1, m2}; // expected-error{{chosen constructor is explicit in copy-initialization}} test_conversion({n0, n1, n2}); // expected-error{{no matching function for call}} } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp similarity index 61% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp index cdf3ceeb6..8d83ddf98 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex.pass.cpp @@ -8,16 +8,19 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template class scoped_lock; +// template class lock_guard; -// explicit scoped_lock(mutex_type& m); +// explicit lock_guard(mutex_type& m); +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include + #include "test_macros.h" struct TestMutex { @@ -65,20 +68,11 @@ struct TestMutexThrows { int main() { { - using LG = std::scoped_lock<>; + using LG = std::lock_guard<>; LG lg; } { - using LG = std::scoped_lock; - TestMutex m1; - { - LG lg(m1); - assert(m1.locked); - } - assert(!m1.locked); - } - { - using LG = std::scoped_lock; + using LG = std::lock_guard; TestMutex m1, m2; { LG lg(m1, m2); @@ -87,7 +81,7 @@ int main() assert(!m1.locked && !m2.locked); } { - using LG = std::scoped_lock; + using LG = std::lock_guard; TestMutex m1, m2, m3; { LG lg(m1, m2, m3); @@ -98,18 +92,7 @@ int main() #if !defined(TEST_HAS_NO_EXCEPTIONS) { using MT = TestMutexThrows; - using LG = std::scoped_lock; - MT m1; - m1.throws_on_lock = true; - try { - LG lg(m1); - assert(false); - } catch (int) {} - assert(!m1.locked); - } - { - using MT = TestMutexThrows; - using LG = std::scoped_lock; + using LG = std::lock_guard; MT m1, m2; m1.throws_on_lock = true; try { @@ -120,7 +103,7 @@ int main() } { using MT = TestMutexThrows; - using LG = std::scoped_lock; + using LG = std::lock_guard; MT m1, m2, m3; m2.throws_on_lock = true; try { @@ -130,26 +113,4 @@ int main() assert(!m1.locked && !m2.locked && !m3.locked); } #endif - -#ifdef __cpp_deduction_guides - { - TestMutex m1, m2, m3; - { - std::scoped_lock sl{}; - static_assert((std::is_same>::value), "" ); - } - { - std::scoped_lock sl{m1}; - static_assert((std::is_same>::value), "" ); - } - { - std::scoped_lock sl{m1, m2}; - static_assert((std::is_same>::value), "" ); - } - { - std::scoped_lock sl{m1, m2, m3}; - static_assert((std::is_same>::value), "" ); - } - } -#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp new file mode 100644 index 000000000..0ad16e285 --- /dev/null +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_mutex_cxx03.pass.cpp @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// UNSUPPORTED: libcpp-has-no-threads +// + +// template class lock_guard; + +// Test that the variadic lock guard implementation compiles in all standard +// dialects, including C++03, even though it is forward declared using +// variadic templates. + +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#include "mutex.pass.cpp" // Use the existing non-variadic test diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp similarity index 75% rename from test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp rename to test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp index 6af3c6c95..600399d97 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/types.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/variadic_types.pass.cpp @@ -8,21 +8,22 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads -// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: c++98, c++03 // -// template -// class scoped_lock +// template +// class lock_guard // { // public: -// typedef Mutex mutex_type; // only if sizeof...(Mutex) == 1 +// typedef Mutex mutex_type; // ... // }; +// MODULES_DEFINES: _LIBCPP_ABI_VARIADIC_LOCK_GUARD +#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD #include #include -#include "test_macros.h" struct NAT {}; @@ -40,39 +41,39 @@ constexpr bool has_mutex_type() { int main() { { - using T = std::scoped_lock<>; + using T = std::lock_guard<>; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(std::is_same::value, ""); } { using M1 = std::recursive_mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(std::is_same::value, ""); } { using M1 = std::mutex; using M2 = std::recursive_mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; using M2 = std::recursive_mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(!has_mutex_type(), ""); } { using M1 = std::mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(!has_mutex_type(), ""); } { using M1 = std::recursive_mutex; - using T = std::scoped_lock; + using T = std::lock_guard; static_assert(!has_mutex_type(), ""); } } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg deleted file mode 100644 index fd3dc778c..000000000 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if 'availability' in config.available_features: - config.unsupported = True diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp index ac338064d..f9a537085 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp @@ -18,9 +18,6 @@ // explicit shared_lock(mutex_type& m); -// template shared_lock(shared_lock<_Mutex>) -// -> shared_lock<_Mutex>; // C++17 - #include #include #include @@ -95,9 +92,4 @@ int main() t.join(); q.join(); } - -#ifdef __cpp_deduction_guides - std::shared_lock sl(m); - static_assert((std::is_same>::value), "" ); -#endif } diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp index ca8bc6982..1f7217a83 100644 --- a/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp +++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp @@ -15,16 +15,11 @@ // explicit unique_lock(mutex_type& m); -// template unique_lock(unique_lock<_Mutex>) -// -> unique_lock<_Mutex>; // C++17 - #include #include #include #include -#include "test_macros.h" - std::mutex m; typedef std::chrono::system_clock Clock; @@ -52,9 +47,4 @@ int main() std::this_thread::sleep_for(ms(250)); m.unlock(); t.join(); - -#ifdef __cpp_deduction_guides - std::unique_lock ul(m); - static_assert((std::is_same>::value), "" ); -#endif } diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp index 48c3a73a0..4de42fbd0 100644 --- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp +++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp @@ -16,10 +16,8 @@ // mutex(); #include -#include int main() { - static_assert(std::is_nothrow_default_constructible::value, ""); std::mutex m; } diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg deleted file mode 100644 index fd3dc778c..000000000 --- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if 'availability' in config.available_features: - config.unsupported = True diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg deleted file mode 100644 index fd3dc778c..000000000 --- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/lit.local.cfg +++ /dev/null @@ -1,2 +0,0 @@ -if 'availability' in config.available_features: - config.unsupported = True diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp index dfd2f10b7..138b65719 100644 --- a/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp +++ b/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp @@ -66,7 +66,7 @@ void f3() #endif } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS struct init1 { @@ -101,7 +101,7 @@ void f2() std::call_once(flg2, init2(), 4, 5); } -#endif // TEST_STD_VER >= 11 +#endif // _LIBCPP_HAS_NO_VARIADICS std::once_flag flg41; std::once_flag flg42; @@ -135,7 +135,7 @@ void f42() std::call_once(flg41, init41); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS class MoveOnly { @@ -174,6 +174,7 @@ public: void operator()(int&) {} }; +#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension struct RefQual { @@ -184,8 +185,8 @@ struct RefQual void operator()() & { ++lv_called; } void operator()() && { ++rv_called; } }; - -#endif // TEST_STD_VER >= 11 +#endif +#endif int main() { @@ -217,7 +218,7 @@ int main() assert(init41_called == 1); assert(init42_called == 1); } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_VARIADICS // check functors with 1 arg { std::thread t0(f1); @@ -244,6 +245,7 @@ int main() int i = 0; std::call_once(f, NonCopyable(), i); } +#if TEST_STD_VER >= 11 // reference qualifiers on functions are a C++11 extension { std::once_flag f1, f2; @@ -253,5 +255,6 @@ int main() std::call_once(f2, std::move(rq)); assert(rq.rv_called == 1); } -#endif // TEST_STD_VER >= 11 +#endif +#endif // _LIBCPP_HAS_NO_VARIADICS } diff --git a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp index 21011ed17..6995f0648 100644 --- a/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp +++ b/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp @@ -14,14 +14,13 @@ // constexpr once_flag() noexcept; #include -#include "test_macros.h" int main() { { std::once_flag f; } -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR { constexpr std::once_flag f; } diff --git a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp index 4f1491dec..f7d4deb8f 100644 --- a/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp @@ -23,8 +23,6 @@ #include #include -#include "test_macros.h" - int main() { std::thread::id id1; @@ -32,7 +30,6 @@ int main() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(id2)); H h; assert(h(id1) != h(id2)); } diff --git a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp similarity index 80% rename from test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp rename to test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp index b46c2cdec..27e1d2a1d 100644 --- a/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp +++ b/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp @@ -9,18 +9,6 @@ // // UNSUPPORTED: libcpp-has-no-threads -// This test uses the POSIX header which Windows doesn't provide -// UNSUPPORTED: windows - -// This test depends on signal behaviour until r210210, so some system libs -// don't pass. -// -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.8 -// XFAIL: with_system_cxx_lib=macosx10.7 - // // template diff --git a/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp b/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp deleted file mode 100644 index 3406fff70..000000000 --- a/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// - -// template -// void sleep_for(const chrono::duration& rel_time); - -// The std::this_thread::sleep_for test requires POSIX specific headers and -// is therefore non-standard. For this reason the test lives under the 'libcxx' -// subdirectory. - -int main() -{ -} diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp index 2aa19c618..0aef2af85 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.cnstr/allocs.pass.cpp @@ -107,11 +107,5 @@ int main() assert((a.inner_allocator() == std::scoped_allocator_adaptor, A3>(A2(5), A3(6)))); } -// Test for LWG2782 - { - static_assert(!std::is_convertible, A2>::value, ""); - static_assert(!std::is_convertible< - std::scoped_allocator_adaptor>, - std::scoped_allocator_adaptor>>::value, ""); - } + } diff --git a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp index 82d63ecad..4e73d8064 100644 --- a/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp +++ b/test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_pair.pass.cpp @@ -39,7 +39,6 @@ void test_no_inner_alloc() using SA = std::scoped_allocator_adaptor; static_assert(std::uses_allocator >::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); - assert(ptr); Alloc CA(P); SA A(CA); A.construct(ptr); @@ -62,7 +61,6 @@ void test_no_inner_alloc() using SA = std::scoped_allocator_adaptor; static_assert(std::uses_allocator >::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); - assert(ptr); Alloc CA(P); SA A(CA); A.construct(ptr); @@ -79,6 +77,7 @@ void test_no_inner_alloc() void test_with_inner_alloc() { + using VoidAlloc1 = CountingAllocator; using VoidAlloc2 = CountingAllocator; AllocController POuter; @@ -94,7 +93,6 @@ void test_with_inner_alloc() static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); - assert(ptr); Outer O(POuter); Inner I(PInner); SA A(O, I); @@ -121,7 +119,6 @@ void test_with_inner_alloc() static_assert(!std::uses_allocator::value, ""); static_assert(std::uses_allocator::value, ""); Pair * ptr = (Pair*)std::malloc(sizeof(Pair)); - assert(ptr); Outer O(POuter); Inner I(PInner); SA A(O, I); diff --git a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp index 37618f7aa..eba9bc6d5 100644 --- a/test/std/utilities/any/any.class/any.assign/copy.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/copy.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any& operator=(any const &); diff --git a/test/std/utilities/any/any.class/any.assign/move.pass.cpp b/test/std/utilities/any/any.class/any.assign/move.pass.cpp index 418f200be..2063e4f1e 100644 --- a/test/std/utilities/any/any.class/any.assign/move.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/move.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any& operator=(any &&); diff --git a/test/std/utilities/any/any.class/any.assign/value.pass.cpp b/test/std/utilities/any/any.class/any.assign/value.pass.cpp index ddedb886c..6af481714 100644 --- a/test/std/utilities/any/any.class/any.assign/value.pass.cpp +++ b/test/std/utilities/any/any.class/any.assign/value.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template diff --git a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp index aceb9e6cf..021c9e452 100644 --- a/test/std/utilities/any/any.class/any.cons/copy.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/copy.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any(any const &); diff --git a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp index d01a88da5..4cf5d914f 100644 --- a/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template any(in_place_type_t, Args&&...); diff --git a/test/std/utilities/any/any.class/any.cons/move.pass.cpp b/test/std/utilities/any/any.class/any.cons/move.pass.cpp index 09e9288e0..fb7dda886 100644 --- a/test/std/utilities/any/any.class/any.cons/move.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/move.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any(any &&) noexcept; diff --git a/test/std/utilities/any/any.class/any.cons/value.pass.cpp b/test/std/utilities/any/any.class/any.cons/value.pass.cpp index d18de0664..a164fbeb5 100644 --- a/test/std/utilities/any/any.class/any.cons/value.pass.cpp +++ b/test/std/utilities/any/any.class/any.cons/value.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template any(Value &&) @@ -158,4 +151,4 @@ int main() { test_copy_value_throws(); test_move_value_throws(); test_sfinae_constraints(); -} +} \ No newline at end of file diff --git a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp index 789a861ee..65d94fd1e 100644 --- a/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -9,18 +9,11 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // -// template T& emplace(Args&&...); +// template emplace(Args&&...); // template -// T& emplace(initializer_list, Args&&...); +// void emplace(initializer_list, Args&&...); #include #include @@ -49,9 +42,7 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace(); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + a.emplace(); assert(Tracked::count == 0); assert(Type::count == 1); @@ -65,9 +56,7 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace(101); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + a.emplace(101); assert(Tracked::count == 0); assert(Type::count == 1); @@ -81,9 +70,7 @@ void test_emplace_type() { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace(-1, 42, -1); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + a.emplace(-1, 42, -1); assert(Tracked::count == 0); assert(Type::count == 1); @@ -102,20 +89,14 @@ void test_emplace_type_tracked() { { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace(); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); - + a.emplace(); assert(Tracked::count == 0); assertArgsMatch(a); } { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace(-1, 42, -1); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); - + a.emplace(-1, 42, -1); assert(Tracked::count == 0); assertArgsMatch(a); } @@ -123,10 +104,7 @@ void test_emplace_type_tracked() { { any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace({-1, 42, -1}); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); - + a.emplace({-1, 42, -1}); assert(Tracked::count == 0); assertArgsMatch>(a); } @@ -134,10 +112,7 @@ void test_emplace_type_tracked() { int x = 42; any a(std::in_place_type); assert(Tracked::count == 1); - auto &v = a.emplace({-1, 42, -1}, x); - static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); - + a.emplace({-1, 42, -1}, x); assert(Tracked::count == 0); assertArgsMatch, int&>(a); } @@ -166,8 +141,7 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - auto &v = a.emplace(101); - static_assert( std::is_same_v, "" ); + a.emplace(101); assert(false); } catch (int const&) { } @@ -177,8 +151,7 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - auto &v = a.emplace({1, 2, 3}, 101); - static_assert( std::is_same_v, "" ); + a.emplace({1, 2, 3}, 101); assert(false); } catch (int const&) { } @@ -189,8 +162,7 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - auto &v = a.emplace(101); - static_assert( std::is_same_v, "" ); + a.emplace(101); assert(false); } catch (int const&) { } @@ -200,8 +172,7 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - auto &v = a.emplace({1, 2, 3}, 101); - static_assert( std::is_same_v, "" ); + a.emplace({1, 2, 3}, 101); assert(false); } catch (int const&) { } diff --git a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp index 2e781d954..45bc70f7a 100644 --- a/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/reset.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any::reset() noexcept diff --git a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp index f56a25656..6fc100943 100644 --- a/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp +++ b/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // any::swap(any &) noexcept diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp index a5fa93218..1a5a85482 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp index ed04a91ca..af081ecce 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template diff --git a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp index bbc135051..99cc02997 100644 --- a/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp +++ b/test/std/utilities/any/any.nonmembers/any.cast/reference_types.fail.cpp @@ -25,30 +25,13 @@ using std::any_cast; int main() { any a(1); - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a); // expected-note {{requested here}} - + any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} any const& a2 = a; - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-note {{requested here}} - - // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} - any_cast(&a2); // expected-note {{requested here}} + any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} + any_cast(&a2); // expected-error@any:* 1 {{static_assert failed "_ValueType may not be a reference."}} } diff --git a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp index 5a4a3c3c1..59c06be6a 100644 --- a/test/std/utilities/any/any.nonmembers/make_any.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/make_any.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template any make_any(Args&&...); diff --git a/test/std/utilities/any/any.nonmembers/swap.pass.cpp b/test/std/utilities/any/any.nonmembers/swap.pass.cpp index c723b6e08..1b3785bb1 100644 --- a/test/std/utilities/any/any.nonmembers/swap.pass.cpp +++ b/test/std/utilities/any/any.nonmembers/swap.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // void swap(any &, any &) noexcept diff --git a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index aa8eb3916..2b19211be 100644 --- a/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -416,7 +416,7 @@ void throws_in_constructor_test() ThrowsOnCopy() = default; bool operator()() const { assert(false); -#if defined(TEST_COMPILER_C1XX) +#if defined(_LIBCPP_MSVC) __assume(0); #else __builtin_unreachable(); diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp index 7516b2e3a..9d5681a3d 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp @@ -11,8 +11,7 @@ // class function -// function(const function& f); -// function(const function&& f); +// function(const function& f); #include #include diff --git a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp index 7a4678ad1..53476a274 100644 --- a/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp +++ b/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.targ/target.pass.cpp @@ -63,7 +63,6 @@ int main() assert(A::count == 1); assert(f.target()); assert(f.target() == 0); - assert(f.target() == nullptr); } assert(A::count == 0); { @@ -71,7 +70,6 @@ int main() assert(A::count == 0); assert(f.target()); assert(f.target() == 0); - assert(f.target() == nullptr); } assert(A::count == 0); { @@ -79,7 +77,6 @@ int main() assert(A::count == 1); assert(f.target()); assert(f.target() == 0); - assert(f.target() == nullptr); } assert(A::count == 0); { @@ -87,7 +84,6 @@ int main() assert(A::count == 0); assert(f.target()); assert(f.target() == 0); - assert(f.target() == nullptr); } assert(A::count == 0); } diff --git a/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp b/test/std/utilities/function.objects/refwrap/binary.pass.cpp similarity index 100% rename from test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp rename to test/std/utilities/function.objects/refwrap/binary.pass.cpp diff --git a/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp b/test/std/utilities/function.objects/refwrap/unary.pass.cpp similarity index 100% rename from test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp rename to test/std/utilities/function.objects/refwrap/unary.pass.cpp diff --git a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp index a7ddd9a49..09ea034b7 100644 --- a/test/std/utilities/function.objects/unord.hash/enum.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/enum.pass.cpp @@ -36,7 +36,6 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); typedef typename std::underlying_type::type under_type; H h1; diff --git a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp index e67aa016c..643e2d8c5 100644 --- a/test/std/utilities/function.objects/unord.hash/floating.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/floating.pass.cpp @@ -24,8 +24,6 @@ #include #include -#include "test_macros.h" - template void test() @@ -33,7 +31,6 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); H h; std::size_t t0 = h(0.); diff --git a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp index ce87f5918..08a2a8c71 100644 --- a/test/std/utilities/function.objects/unord.hash/integral.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/integral.pass.cpp @@ -31,7 +31,6 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); H h; for (int i = 0; i <= 5; ++i) @@ -65,42 +64,42 @@ int main() test(); test(); -// LWG #2119 +// LWG #2119 test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); - test(); - test(); - test(); - test(); + test(); + test(); + test(); + test(); test(); test(); diff --git a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp index 36280a38e..a48394495 100644 --- a/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp +++ b/test/std/utilities/function.objects/unord.hash/pointer.pass.cpp @@ -23,8 +23,6 @@ #include #include -#include "test_macros.h" - template void test() @@ -32,7 +30,6 @@ test() typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); H h; typedef typename std::remove_pointer::type type; @@ -41,20 +38,7 @@ test() assert(h(&i) != h(&j)); } -// can't hash nullptr_t until c++17 -void test_nullptr() -{ -#if TEST_STD_VER > 14 - typedef std::nullptr_t T; - typedef std::hash H; - static_assert((std::is_same::value), "" ); - static_assert((std::is_same::value), "" ); - ASSERT_NOEXCEPT(H()(T())); -#endif -} - int main() { test(); - test_nullptr(); } diff --git a/test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/nothing_to_do.pass.cpp rename to test/std/utilities/memory/unique.ptr/nothing_to_do.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array1.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array2.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array3.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.array4.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.create/make_unique.single.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/nothing_to_do.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/incomplete.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/void.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/convert_ctor.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/incomplete.fail.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.general/nothing_to_do.pass.cpp diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp new file mode 100644 index 000000000..ed94c1a1e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.fail.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include + +#include "test_macros.h" + +int main() +{ + std::unique_ptr s, s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}} +#else + s2 = s; // expected-error {{'operator=' is a private member of 'std::__1::unique_ptr}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp new file mode 100644 index 000000000..a29c52764 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move01.pass.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +// test move assignment. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s1(new A[3]); + A* p = s1.get(); + assert(A::count == 3); + std::unique_ptr s2(new A[2]); + assert(A::count == 5); + s2 = std::move(s1); + assert(A::count == 3); + assert(s2.get() == p); + assert(s1.get() == 0); + } + assert(A::count == 0); + { + std::unique_ptr > s1(new A[4], Deleter(5)); + A* p = s1.get(); + assert(A::count == 4); + std::unique_ptr > s2(new A[5]); + assert(A::count == 9); + s2 = std::move(s1); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(A::count == 4); + assert(s2.get_deleter().state() == 5); + assert(s1.get_deleter().state() == 0); + } + assert(A::count == 0); + { + CDeleter d1(5); + std::unique_ptr&> s1(new A[6], d1); + A* p = s1.get(); + assert(A::count == 6); + CDeleter d2(6); + std::unique_ptr&> s2(new A[3], d2); + assert(A::count == 9); + s2 = std::move(s1); + assert(A::count == 6); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(d1.state() == 5); + assert(d2.state() == 5); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp new file mode 100644 index 000000000..6e13873c2 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move02.fail.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include +#include +#include + +// Can't copy from const lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + const std::unique_ptr s(new A[3]); + std::unique_ptr s2; + s2 = s; + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp new file mode 100644 index 000000000..3712a2796 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move03.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include +#include +#include + +// Can't copy from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete p;} +}; + +int main() +{ + { + std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp new file mode 100644 index 000000000..4e85e5b0f --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move04.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include +#include + +// test move ctor. Can't copy from const lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete p;} +}; + +int main() +{ + { + const std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp new file mode 100644 index 000000000..9461958a4 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert01.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include +#include +#include + +// Can't assign from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp new file mode 100644 index 000000000..78caaa4f4 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert02.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + boost::unique_ptr > s(new B); + A* p = s.get(); + boost::unique_ptr > s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp new file mode 100644 index 000000000..b9693b86e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert03.fail.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + Deleter db(5); + boost::unique_ptr&> s(new B, db); + A* p = s.get(); + Deleter da(6); + boost::unique_ptr&> s2(new A, da); + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp new file mode 100644 index 000000000..970beb5a1 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert04.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include +#include +#include + +// Can't assign from const lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const boost::unique_ptr s(new B); + A* p = s.get(); + boost::unique_ptr s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp new file mode 100644 index 000000000..897673147 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert05.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from const lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const boost::unique_ptr > s(new B); + A* p = s.get(); + boost::unique_ptr > s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp new file mode 100644 index 000000000..1081cd195 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert06.fail.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from const lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + Deleter db(5); + const boost::unique_ptr&> s(new B, db); + A* p = s.get(); + Deleter da(6); + boost::unique_ptr&> s2(new A, da); + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp new file mode 100644 index 000000000..65ee26941 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert07.fail.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + boost::unique_ptr s(new B); + A* p = s.get(); + boost::unique_ptr s2(new A); + assert(A::count == 2); + s2 = boost::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp new file mode 100644 index 000000000..310be99f8 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert08.fail.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + boost::unique_ptr > s(new B); + A* p = s.get(); + boost::unique_ptr > s2(new A); + assert(A::count == 2); + s2 = (boost::move(s)); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp new file mode 100644 index 000000000..eb48e9c94 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/move_convert09.fail.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// test converting move assignment with reference deleters + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + Deleter db(5); + boost::unique_ptr&> s(new B, db); + A* p = s.get(); + Deleter da(6); + boost::unique_ptr&> s2(new A, da); + s2 = boost::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.runtime.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp similarity index 53% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.runtime.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp index 0d067b9ab..e2d7956cd 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.runtime.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_asgn.pass.cpp @@ -11,20 +11,31 @@ // unique_ptr -// test reset +// Test unique_ptr move assignment #include #include -#include "unique_ptr_test_helper.h" +// test assignment from null -int main() { - { - std::unique_ptr p; - p.reset(static_cast(nullptr)); // expected-error {{no matching member function for call to 'reset'}} - } - { - std::unique_ptr p; - p.reset(static_cast(nullptr)); // expected-error {{no matching member function for call to 'reset'}} - } +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s2(new A); + assert(A::count == 1); + s2 = 0; + assert(A::count == 0); + assert(s2.get() == 0); + } + assert(A::count == 0); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp new file mode 100644 index 000000000..50389978e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/null_ctor.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// The deleter is not called if get() == 0 + +#include +#include + +#include "test_macros.h" + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(0) {} + + int state() const {return state_;} + + void operator()(void*) {++state_;} +}; + +int main() +{ + Deleter d; + assert(d.state() == 0); + { + std::unique_ptr p(nullptr, d); + assert(p.get() == 0); + assert(&p.get_deleter() == &d); + } +#if defined(_LIBCPP_VERSION) + { + // The standard only requires the constructor accept nullptr, but libc++ + // also supports the literal 0. + std::unique_ptr p(0, d); + assert(p.get() == 0); + assert(&p.get_deleter() == &d); + } +#endif + assert(d.state() == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp new file mode 100644 index 000000000..30ecdded3 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/nullptr_asgn.pass.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include +#include + +// test assignment from null + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s2(new A[3]); + assert(A::count == 3); + s2 = nullptr; + assert(A::count == 0); + assert(s2.get() == 0); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp new file mode 100644 index 000000000..e7ad6ad7e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/pointer_type.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr::pointer type + +#include +#include + +struct Deleter +{ + struct pointer {}; +}; + +int main() +{ + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), ""); + } + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), ""); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp new file mode 100644 index 000000000..b6bcad9a9 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.fail.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +// default unique_ptr ctor should require default Deleter ctor + + +#include + +class Deleter +{ + // expected-error@memory:* {{base class 'Deleter' has private default constructor}} + // expected-note@memory:* + {{in instantiation of member function}} + Deleter() {} // expected-note {{implicitly declared private here}} + +public: + + Deleter(Deleter&) {} + Deleter& operator=(Deleter&) { return *this; } + + void operator()(void*) const {} +}; + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp new file mode 100644 index 000000000..0cc54382b --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default01.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +// default unique_ptr ctor should only require default Deleter ctor + +#include +#include + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(void*) {} +}; + +int main() +{ + { + std::unique_ptr p; + assert(p.get() == 0); + } + { + std::unique_ptr p; + assert(p.get() == 0); + assert(p.get_deleter().state() == 5); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.cpp new file mode 100644 index 000000000..82b84948f --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.fail.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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +// default unique_ptr ctor should require non-reference Deleter ctor + +#include + +class Deleter +{ +public: + + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp new file mode 100644 index 000000000..3ded41c41 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default02.pass.cpp @@ -0,0 +1,87 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test default unique_ptr ctor + +// default unique_ptr ctor shouldn't require complete type + +#include +#include + +struct A; + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p); +}; + +void check(int i); + +template > +struct B +{ + std::unique_ptr a_; + B(); + ~B(); + + A* get() const {return a_.get();} + D& get_deleter() {return a_.get_deleter();} +}; + +int main() +{ + { + B<> s; + assert(s.get() == 0); + } + check(0); + { + B s; + assert(s.get() == 0); + assert(s.get_deleter().state() == 5); + } + check(0); +} + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +void Deleter::operator()(A* p) {delete p;} + +void check(int i) +{ + assert(A::count == i); +} + +template +B::B() {} + +template +B::~B() {} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp new file mode 100644 index 000000000..74d24fd48 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/default03.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +// default unique_ptr ctor should require non-pointer Deleter + +#include + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp new file mode 100644 index 000000000..bc49a0e5c --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.fail.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include + +// test move ctor. Can't copy from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s(new A[3]); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp new file mode 100644 index 000000000..8a1f2ce97 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +// test move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s(new A[3]); + A* p = s.get(); + std::unique_ptr s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 3); + } + assert(A::count == 0); + { + std::unique_ptr > s(new A[3], Deleter(5)); + A* p = s.get(); + std::unique_ptr > s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 3); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + { + NCDeleter d; + std::unique_ptr&> s(new A[3], d); + A* p = s.get(); + std::unique_ptr&> s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 3); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp new file mode 100644 index 000000000..8e44c78bf --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.fail.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +// test move ctor. Can't copy from const lvalue + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + const std::unique_ptr s(new A[3]); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp new file mode 100644 index 000000000..f758b083f --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp @@ -0,0 +1,72 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +// test move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + + +std::unique_ptr +source1() +{ + return std::unique_ptr(new A[3]); +} + +void sink1(std::unique_ptr) +{ +} + +std::unique_ptr > +source2() +{ + return std::unique_ptr >(new A[3]); +} + +void sink2(std::unique_ptr >) +{ +} + +std::unique_ptr&> +source3() +{ + static NCDeleter d; + return std::unique_ptr&>(new A[3], d); +} + +void sink3(std::unique_ptr&>) +{ +} + +int main() +{ + sink1(source1()); + sink2(source2()); + sink3(source3()); + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp new file mode 100644 index 000000000..c952cf2d4 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move03.fail.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +// test move ctor. Can't copy from lvalue + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + std::unique_ptr s(new A[3]); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp new file mode 100644 index 000000000..0d091ff34 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move04.fail.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +// test move ctor. Can't copy from const lvalue + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + const std::unique_ptr s(new A[3]); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp new file mode 100644 index 000000000..d175fbf93 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert01.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp new file mode 100644 index 000000000..1d3dd853f --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert02.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp new file mode 100644 index 000000000..36ad75d83 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert03.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp new file mode 100644 index 000000000..3a19bde92 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert04.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// implicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp new file mode 100644 index 000000000..225376688 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert05.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Implicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp new file mode 100644 index 000000000..fba895137 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert06.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp new file mode 100644 index 000000000..24c646988 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert07.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp new file mode 100644 index 000000000..2c8f28154 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert08.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp new file mode 100644 index 000000000..e4cbef5c0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert09.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + const std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp new file mode 100644 index 000000000..73423d1b3 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert10.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// implicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp new file mode 100644 index 000000000..a7d853ddb --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert11.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Implicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp new file mode 100644 index 000000000..fdb088250 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert12.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + const std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp new file mode 100644 index 000000000..d9ef8e96f --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert13.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2(std::move(s)); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp new file mode 100644 index 000000000..431c8bf3c --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert14.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2(std::move(s)); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp new file mode 100644 index 000000000..9325d07d0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert15.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2(std::move(s)); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp new file mode 100644 index 000000000..b090e593e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert16.fail.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// implicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp new file mode 100644 index 000000000..6e214f137 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert17.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Implicit version + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp new file mode 100644 index 000000000..d1c0e8a78 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move_convert18.fail.cpp @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp new file mode 100644 index 000000000..9a8c17547 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/nullptr.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// unique_ptr(nullptr_t); + +#include +#include + +// default unique_ptr ctor should only require default Deleter ctor +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(void*) {} +}; + +int main() +{ + { + std::unique_ptr p(nullptr); + assert(p.get() == 0); + } + { + std::unique_ptr p(nullptr); + assert(p.get() == 0); + assert(p.get_deleter().state() == 5); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp new file mode 100644 index 000000000..4c3161150 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.fail.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +// unique_ptr(pointer) ctor should require default Deleter ctor + +#include + +class Deleter +{ + + Deleter() {} + +public: + + Deleter(Deleter&) {} + Deleter& operator=(Deleter&) {} + + void operator()(void*) const {} +}; + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp new file mode 100644 index 000000000..dab42f277 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer01.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +// unique_ptr(pointer) ctor should only require default Deleter ctor + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + A* p = new A[3]; + assert(A::count == 3); + std::unique_ptr s(p); + assert(s.get() == p); + } + assert(A::count == 0); + { + A* p = new A[3]; + assert(A::count == 3); + std::unique_ptr s(p); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp new file mode 100644 index 000000000..af7f27f73 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include + +// unique_ptr(pointer) ctor should require non-reference Deleter ctor +class Deleter +{ +public: + + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp new file mode 100644 index 000000000..1afb1c32c --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer02.pass.cpp @@ -0,0 +1,95 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +// unique_ptr(pointer) ctor shouldn't require complete type + +#include +#include + +struct A; + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p); +}; + +void check(int i); + +template > +struct B +{ + std::unique_ptr a_; + explicit B(A*); + ~B(); + + A* get() const {return a_.get();} + D& get_deleter() {return a_.get_deleter();} +}; + +A* get(); + +int main() +{ + { + A* p = get(); + check(3); + B<> s(p); + assert(s.get() == p); + } + check(0); + { + A* p = get(); + check(3); + B s(p); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + } + check(0); +} + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +A* get() {return new A[3];} + +void Deleter::operator()(A* p) {delete [] p;} + +void check(int i) +{ + assert(A::count == i); +} + +template +B::B(A* a) : a_(a) {} + +template +B::~B() {} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp new file mode 100644 index 000000000..31f7ce367 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer03.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +// unique_ptr(pointer) ctor should require non-pointer Deleter + +#include + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp new file mode 100644 index 000000000..591144f7a --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer04.fail.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +// unique_ptr(pointer) ctor should not work with derived pointers + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + B* p = new B[3]; + std::unique_ptr s(p); + } + { + B* p = new B[3]; + std::unique_ptr s(p); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp new file mode 100644 index 000000000..480dc0889 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter01.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, deleter()) only requires MoveConstructible deleter + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + A* p = new A[3]; + assert(A::count == 3); + std::unique_ptr > s(p, Deleter()); + assert(s.get() == p); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + + { // LWG#2520 says that nullptr is a valid input as well as null +#ifdef _LIBCPP_VERSION + std::unique_ptr > s1(NULL, Deleter()); +#endif + std::unique_ptr > s2(nullptr, Deleter()); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp new file mode 100644 index 000000000..a92fdbc1d --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter02.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, d) requires CopyConstructible deleter + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + A* p = new A[3]; + assert(A::count == 3); + Deleter d; + std::unique_ptr s(p, d); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + d.set_state(6); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); + { + Deleter d; + std::unique_ptr s(nullptr, d); + assert(s.get() == nullptr); + assert(s.get_deleter().state() == 5); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp new file mode 100644 index 000000000..dd2740173 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter03.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, d) does not requires CopyConstructible deleter + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + + Deleter(const Deleter&); + Deleter& operator=(const Deleter&); +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + { + A* p = new A[3]; + assert(A::count == 3); + Deleter d; + std::unique_ptr s(p, d); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + d.set_state(6); + assert(s.get_deleter().state() == 6); + } + assert(A::count == 0); + { + Deleter d; + std::unique_ptr s(nullptr, d); + assert(s.get() == nullptr); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp new file mode 100644 index 000000000..9d3f94098 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// XFAIL: c++98, c++03 + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, D()) should not compile + +#include + +class Deleter +{ +public: + Deleter() {} + void operator()(int* p) const {delete [] p;} +}; + +int main() +{ + int* p = nullptr; + std::unique_ptr s(p, Deleter()); // expected-error@memory:* {{static_assert failed "rvalue deleter bound to reference"}} +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp new file mode 100644 index 000000000..02f44d357 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter04.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, d) does not requires CopyConstructible deleter + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + + Deleter(const Deleter&); + Deleter& operator=(const Deleter&); +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(A* p) const {delete [] p;} +}; + +int main() +{ + { + A* p = new A[3]; + assert(A::count == 3); + Deleter d; + std::unique_ptr s(p, d); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); + { + Deleter d; + std::unique_ptr s(nullptr, d); + assert(s.get() == nullptr); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp new file mode 100644 index 000000000..0e03a7da0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/pointer_deleter05.fail.cpp @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer, deleter) ctor + +// unique_ptr(pointer, deleter) should not work with derived pointers + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +class Deleter +{ + int state_; + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete [] p;} +}; + +int main() +{ + B* p = new B[3]; + std::unique_ptr s(p, Deleter()); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp new file mode 100644 index 000000000..d79a4e396 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/release.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test release + +#include +#include + +int main() +{ + std::unique_ptr p(new int[3]); + int* i = p.get(); + int* j = p.release(); + assert(p.get() == 0); + assert(i == j); + delete [] j; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp new file mode 100644 index 000000000..195d877bb --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset1.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test reset + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr p(new A[3]); + assert(A::count == 3); + A* i = p.get(); + assert(i != nullptr); + p.reset(); + assert(A::count == 0); + assert(p.get() == 0); + } + assert(A::count == 0); + { + std::unique_ptr p(new A[4]); + assert(A::count == 4); + A* i = p.get(); + assert(i != nullptr); + p.reset(new A[5]); + assert(A::count == 5); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp new file mode 100644 index 000000000..bca6cb247 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/reset2.fail.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test reset + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr p(new A); + assert(A::count == 1); + assert(B::count == 0); + A* i = p.get(); + p.reset(new B); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); + { + std::unique_ptr p(new B); + assert(A::count == 1); + assert(B::count == 1); + A* i = p.get(); + p.reset(new B); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp new file mode 100644 index 000000000..5e98475c7 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.modifiers/swap.pass.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test swap + +#include +#include + +#include "deleter_types.h" + +struct A +{ + int state_; + static int count; + A() : state_(0) {++count;} + explicit A(int i) : state_(i) {++count;} + A(const A& a) : state_(a.state_) {++count;} + A& operator=(const A& a) {state_ = a.state_; return *this;} + ~A() {--count;} + + friend bool operator==(const A& x, const A& y) + {return x.state_ == y.state_;} +}; + +int A::count = 0; + +int main() +{ + { + A* p1 = new A[3]; + std::unique_ptr > s1(p1, Deleter(1)); + A* p2 = new A[3]; + std::unique_ptr > s2(p2, Deleter(2)); + assert(s1.get() == p1); + assert(s1.get_deleter().state() == 1); + assert(s2.get() == p2); + assert(s2.get_deleter().state() == 2); + s1.swap(s2); + assert(s1.get() == p2); + assert(s1.get_deleter().state() == 2); + assert(s2.get() == p1); + assert(s2.get_deleter().state() == 1); + assert(A::count == 6); + } + assert(A::count == 0); +} diff --git a/test/std/language.support/support.initlist/include_cxx03.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp similarity index 72% rename from test/std/language.support/support.initlist/include_cxx03.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp index 8710ddcdd..46ba1395b 100644 --- a/test/std/language.support/support.initlist/include_cxx03.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/dereference.fail.cpp @@ -7,12 +7,17 @@ // //===----------------------------------------------------------------------===// -// +// -// Test that the file can be included in C++03 +// unique_ptr -#include +// test op*() + +#include +#include int main() { + std::unique_ptr p(new int(3)); + assert(*p == 3); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp similarity index 57% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp index b05fb71cd..9ec9b9527 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.runtime.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/explicit_bool.pass.cpp @@ -16,9 +16,24 @@ #include #include -int main() { - std::unique_ptr p(new int(3)); - const std::unique_ptr& cp = p; - (void)(*p); // expected-error {{indirection requires pointer operand ('std::unique_ptr' invalid)}} - (void)(*cp); // expected-error {{indirection requires pointer operand ('const std::unique_ptr' invalid)}} +int main() +{ + { + std::unique_ptr p(new int [3]); + if (p) + ; + else + assert(false); + if (!p) + assert(false); + } + { + std::unique_ptr p; + if (!p) + ; + else + assert(false); + if (p) + assert(false); + } } diff --git a/test/std/strings/basic.string/traits_mismatch.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp similarity index 69% rename from test/std/strings/basic.string/traits_mismatch.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp index 1d54238ae..2ae0659ad 100644 --- a/test/std/strings/basic.string/traits_mismatch.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get.pass.cpp @@ -7,12 +7,18 @@ // //===----------------------------------------------------------------------===// -// -// The strings's value type must be the same as the traits's char_type +// -#include +// unique_ptr + +// test get + +#include +#include int main() { - std::basic_string> s; + int* p = new int[3]; + std::unique_ptr s(p); + assert(s.get() == p); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp new file mode 100644 index 000000000..449674071 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/get_deleter.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test get_deleter() + +#include +#include + +struct Deleter +{ + void operator()(void*) {} + + int test() {return 5;} + int test() const {return 6;} +}; + +int main() +{ + { + std::unique_ptr p; + assert(p.get_deleter().test() == 5); + } + { + const std::unique_ptr p; + assert(p.get_deleter().test() == 6); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp new file mode 100644 index 000000000..519eae688 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/index.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test op[](size_t) + +#include +#include + +class A +{ + int state_; + static int next_; +public: + A() : state_(++next_) {} + int get() const {return state_;} + + friend bool operator==(const A& x, int y) + {return x.state_ == y;} + + A& operator=(int i) {state_ = i; return *this;} +}; + +int A::next_ = 0; + +int main() +{ + std::unique_ptr p(new A[3]); + assert(p[0] == 1); + assert(p[1] == 2); + assert(p[2] == 3); + p[0] = 3; + p[1] = 2; + p[2] = 1; + assert(p[0] == 3); + assert(p[1] == 2); + assert(p[2] == 1); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.cpp new file mode 100644 index 000000000..1c90ba76a --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.observers/op_arrow.fail.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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test op->() + +#include +#include + +struct A +{ + int i_; + + A() : i_(7) {} +}; + +int main() +{ + std::unique_ptr p(new A); + assert(p->i_ == 7); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp new file mode 100644 index 000000000..380f2e100 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr::pointer type + +#include +#include + +#include "test_macros.h" + +struct Deleter +{ + struct pointer {}; +}; + +struct D2 { +private: + typedef void pointer; +}; + +struct D3 { + static long pointer; +}; + +int main() +{ + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), ""); + } + { + typedef std::unique_ptr P; + static_assert((std::is_same::value), ""); + } +#if TEST_STD_VER >= 11 + { + typedef std::unique_ptr P; + static_assert(std::is_same::value, ""); + } + { + typedef std::unique_ptr P; + static_assert(std::is_same::value, ""); + } +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp new file mode 100644 index 000000000..87cfb72ad --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include + +#include "test_macros.h" + +// Can't copy from lvalue +int main() +{ + std::unique_ptr s, s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}} +#else + s2 = s; // expected-error {{'operator=' is a private member}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp new file mode 100644 index 000000000..67f4da2be --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move01.pass.cpp @@ -0,0 +1,75 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +// test move assignment. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s1(new A); + A* p = s1.get(); + std::unique_ptr s2(new A); + assert(A::count == 2); + s2 = std::move(s1); + assert(A::count == 1); + assert(s2.get() == p); + assert(s1.get() == 0); + } + assert(A::count == 0); + { + std::unique_ptr > s1(new A, Deleter(5)); + A* p = s1.get(); + std::unique_ptr > s2(new A); + assert(A::count == 2); + s2 = std::move(s1); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(A::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s1.get_deleter().state() == 0); + } + assert(A::count == 0); + { + CDeleter d1(5); + std::unique_ptr&> s1(new A, d1); + A* p = s1.get(); + CDeleter d2(6); + std::unique_ptr&> s2(new A, d2); + s2 = std::move(s1); + assert(s2.get() == p); + assert(s1.get() == 0); + assert(A::count == 1); + assert(d1.state() == 5); + assert(d2.state() == 5); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp new file mode 100644 index 000000000..9cea12b12 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move02.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include + +#include "test_macros.h" + +// Can't copy from const lvalue + +int main() +{ + const std::unique_ptr s(new int); + std::unique_ptr s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}} +#else + // NOTE: The error says "constructor" because the assignment operator takes + // 's' by value and attempts to copy construct it. + s2 = s; // expected-error {{no matching constructor for initialization}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp new file mode 100644 index 000000000..05a057f9b --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move03.fail.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include + +#include "test_macros.h" + +struct Deleter { + void operator()(int* p) {delete p;} +}; + +// Can't copy from lvalue +int main() +{ + std::unique_ptr s, s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}} +#else + s2 = s; // expected-error {{'operator=' is a private member}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp new file mode 100644 index 000000000..24703ec98 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move04.fail.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move assignment + +#include + +#include "test_macros.h" + +struct Deleter { + void operator()(int* p) {delete p;} +}; + +// Can't copy from a const lvalue +int main() +{ + const std::unique_ptr s(new int); + std::unique_ptr s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{cannot be assigned because its copy assignment operator is implicitly deleted}} +#else + // NOTE: The error says "constructor" because the assignment operator takes + // 's' by value and attempts to copy construct it. + s2 = s; // expected-error {{no matching constructor for initialization}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp new file mode 100644 index 000000000..7876760fe --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert.pass.cpp @@ -0,0 +1,89 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + + +template +void testAssign(APtr& aptr, BPtr& bptr) { + A* p = bptr.get(); + assert(A::count == 2); + aptr = std::move(bptr); + assert(aptr.get() == p); + assert(bptr.get() == 0); + assert(A::count == 1); + assert(B::count == 1); +} + +template +void checkDeleter(LHS& lhs, RHS& rhs, int LHSState, int RHSState) { + assert(lhs.get_deleter().state() == LHSState); + assert(rhs.get_deleter().state() == RHSState); +} + +int main() +{ + { + std::unique_ptr bptr(new B); + std::unique_ptr aptr(new A); + testAssign(aptr, bptr); + } + assert(A::count == 0); + assert(B::count == 0); + { + Deleter del(42); + std::unique_ptr > bptr(new B, std::move(del)); + std::unique_ptr > aptr(new A); + testAssign(aptr, bptr); + checkDeleter(aptr, bptr, 42, 0); + } + assert(A::count == 0); + assert(B::count == 0); + { + CDeleter adel(6); + CDeleter bdel(42); + std::unique_ptr&> bptr(new B, bdel); + std::unique_ptr&> aptr(new A, adel); + testAssign(aptr, bptr); + checkDeleter(aptr, bptr, 42, 42); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp new file mode 100644 index 000000000..816a598d9 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert01.fail.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include + +#include "test_macros.h" + +struct A +{ + A() {} + virtual ~A() {} +}; + +struct B : public A +{ +}; + +// Can't assign from lvalue +int main() +{ + std::unique_ptr s; + std::unique_ptr s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{no viable overloaded '='}} +#else + // NOTE: The move-semantic emulation creates an ambiguous overload set + // so that assignment from an lvalue does not compile + s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp new file mode 100644 index 000000000..6e69d5152 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert02.fail.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include + +#include "test_macros.h" +#include "deleter_types.h" + +struct A +{ + A() {} + virtual ~A() {} +}; + +struct B : public A +{ +}; + +// Can't assign from lvalue +int main() +{ + std::unique_ptr > s; + std::unique_ptr > s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{no viable overloaded '='}} +#else + // NOTE: The move-semantic emulation creates an ambiguous overload set + // so that assignment from an lvalue does not compile + s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp new file mode 100644 index 000000000..1d89f99c7 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert03.fail.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from lvalue + +#include + +#include "test_macros.h" +#include "deleter_types.h" + +struct A +{ + A() {} + virtual ~A() {} +}; + +struct B : public A +{ +}; + +// Can't assign from lvalue +int main() +{ + Deleter db; + std::unique_ptr& > s(new B, db); + Deleter da; + std::unique_ptr &> s2(new A, da); +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{no viable overloaded '='}} +#else + // NOTE: The move-semantic emulation creates an ambiguous overload set + // so that assignment from an lvalue does not compile + s2 = s; // expected-error {{use of overloaded operator '=' is ambiguous}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp new file mode 100644 index 000000000..f7de69cb7 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert04.fail.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +#include + +#include "test_macros.h" +#include "deleter_types.h" + +struct A +{ + A() {} + virtual ~A() {} +}; + +struct B : public A +{ +}; + +// Can't assign from lvalue +int main() +{ + const std::unique_ptr s(new B); + std::unique_ptr s2; +#if TEST_STD_VER >= 11 + s2 = s; // expected-error {{no viable overloaded '='}} +#else + // NOTE: The error says "constructor" because the assignment operator takes + // 's' by value and attempts to copy construct it. + s2 = s; // expected-error {{no matching constructor for initialization}} +#endif +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp new file mode 100644 index 000000000..55ebe5119 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert05.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from const lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2; + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp new file mode 100644 index 000000000..657b011b3 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert06.fail.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Can't assign from const lvalue + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + Deleter db(5); + const std::unique_ptr&> s(new B, db); + A* p = s.get(); + Deleter da(6); + std::unique_ptr&> s2(new A, da); + s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp new file mode 100644 index 000000000..412648420 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/move_convert13.fail.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move assignment + +// Do not convert from an array unique_ptr + +#include +#include +#include + +struct A +{ +}; + +struct Deleter +{ + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr s; + std::unique_ptr s2; + s2 = std::move(s); // expected-error {{no viable overloaded '='}} +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp similarity index 57% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp index 165d48a1c..e2d7956cd 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/null.pass.cpp @@ -16,24 +16,26 @@ #include #include -#include "unique_ptr_test_helper.h" - // test assignment from null -template -void test_basic() { - typedef typename std::conditional::type VT; - const int expect_alive = IsArray ? 5 : 1; - { - std::unique_ptr s2(newValue(expect_alive)); - assert(A::count == expect_alive); - s2 = NULL; + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s2(new A); + assert(A::count == 1); + s2 = 0; assert(A::count == 0); assert(s2.get() == 0); - } - assert(A::count == 0); -} - -int main() { - test_basic(); - test_basic(); + } + assert(A::count == 0); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp similarity index 59% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp index e1e2e32e2..fb1584951 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.asgn/nullptr.pass.cpp @@ -16,25 +16,26 @@ #include #include -#include "unique_ptr_test_helper.h" - // test assignment from null -template -void test_basic() { - typedef typename std::conditional::type VT; - const int expect_alive = IsArray ? 5 : 1; - { - std::unique_ptr s2(newValue(expect_alive)); - assert(A::count == expect_alive); +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s2(new A); + assert(A::count == 1); s2 = nullptr; assert(A::count == 0); assert(s2.get() == 0); - } - assert(A::count == 0); -} - -int main() { - test_basic(); - test_basic(); + } + assert(A::count == 0); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp similarity index 50% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp index 7d5e9bca6..f878ce405 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/auto_pointer.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer.pass.cpp @@ -23,47 +23,30 @@ #include "test_macros.h" -struct A { - static int count; - A() { ++count; } - A(const A&) { ++count; } - virtual ~A() { --count; } +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} }; int A::count = 0; -struct B : public A { - static int count; - B() { ++count; } - B(const B&) { ++count; } - virtual ~B() { --count; } +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} }; int B::count = 0; -struct C {}; - -struct Deleter { - void operator()(void*) {} -}; - -void test_sfinae() { - { - // the auto_ptr constructor should be disable with a non-default deleter. - using AP = std::auto_ptr; - using U = std::unique_ptr; - static_assert(!std::is_constructible::value, ""); - } - { - // the auto_ptr constructor should be disabled when the pointer types are incompatible. - using AP = std::auto_ptr; - using U = std::unique_ptr; - static_assert(!std::is_constructible::value, ""); - } -} - -int main() { - { +int main() +{ + { B* p = new B; std::auto_ptr ap(p); std::unique_ptr up(std::move(ap)); @@ -71,10 +54,10 @@ int main() { assert(ap.get() == 0); assert(A::count == 1); assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); - { + } + assert(A::count == 0); + assert(B::count == 0); + { B* p = new B; std::auto_ptr ap(p); std::unique_ptr up; @@ -83,15 +66,15 @@ int main() { assert(ap.get() == 0); assert(A::count == 1); assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); + } + assert(A::count == 0); + assert(B::count == 0); #if TEST_STD_VER >= 11 - { - static_assert(std::is_nothrow_constructible, - std::auto_ptr&&>::value, - ""); - } + { + static_assert(std::is_nothrow_constructible< + std::unique_ptr, + std::auto_ptr&& + >::value, ""); + } #endif - test_sfinae(); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp new file mode 100644 index 000000000..1f317c782 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer01.fail.cpp @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include +#include + +// template explicit unique_ptr(auto_ptr&); + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B +// : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + B* p = new B; + std::auto_ptr ap(p); + std::unique_ptr up(ap); + assert(up.get() == p); + assert(ap.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); + { + B* p = new B; + std::auto_ptr ap(p); + std::unique_ptr up; + up = ap; + assert(up.get() == p); + assert(ap.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp new file mode 100644 index 000000000..2dd5ea300 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/auto_pointer02.fail.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include +#include + +// template explicit unique_ptr(auto_ptr&); + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +struct Deleter +{ + template + void operator()(T*) {} +}; + +int main() +{ + { + B* p = new B; + std::auto_ptr ap(p); + std::unique_ptr up(ap); + assert(up.get() == p); + assert(ap.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp new file mode 100644 index 000000000..569daae7d --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default.pass.cpp @@ -0,0 +1,86 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +//============================================================================= +// TESTING std::unique_ptr::unique_ptr() +// +// Concerns: +// 1 The default constructor works for any default constructible deleter types. +// 2 The stored type 'T' is allowed to be incomplete. +// +// Plan +// 1 Default construct unique_ptr's with various deleter types (C-1) +// 2 Default construct a unique_ptr with an incomplete element_type and +// various deleter types (C-1,2) + +#include +#include + +#include "deleter_types.h" + +struct IncompleteT; + +void checkNumIncompleteTypeAlive(int i); + +template > +struct StoresIncomplete { + std::unique_ptr m_ptr; + StoresIncomplete() {} + ~StoresIncomplete(); + + IncompleteT* get() const { return m_ptr.get(); } + Del& get_deleter() { return m_ptr.get_deleter(); } +}; + +int main() +{ + { + std::unique_ptr p; + assert(p.get() == 0); + } + { + std::unique_ptr > p; + assert(p.get() == 0); + assert(p.get_deleter().state() == 0); + p.get_deleter().set_state(5); + assert(p.get_deleter().state() == 5); + } + { + StoresIncomplete<> s; + assert(s.get() == 0); + checkNumIncompleteTypeAlive(0); + } + checkNumIncompleteTypeAlive(0); + { + StoresIncomplete< Deleter > s; + assert(s.get() == 0); + assert(s.get_deleter().state() == 0); + checkNumIncompleteTypeAlive(0); + } + checkNumIncompleteTypeAlive(0); +} + +struct IncompleteT { + static int count; + IncompleteT() { ++count; } + ~IncompleteT() {--count; } +}; + +int IncompleteT::count = 0; + +void checkNumIncompleteTypeAlive(int i) { + assert(IncompleteT::count == i); +} + +template +StoresIncomplete::~StoresIncomplete() { } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp new file mode 100644 index 000000000..2ffe1be19 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default01.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +#include + +// default unique_ptr ctor should require default Deleter ctor +class Deleter +{ + + Deleter() {} + +public: + + Deleter(Deleter&) {} + Deleter& operator=(Deleter&) {} + + void operator()(void*) const {} +}; + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp new file mode 100644 index 000000000..690750143 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default02.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +#include + +// default unique_ptr ctor should require non-reference Deleter ctor +class Deleter +{ +public: + + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp new file mode 100644 index 000000000..78f6e73a1 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/default03.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr default ctor + +#include + +// default unique_ptr ctor should require non-pointer Deleter + +int main() +{ + std::unique_ptr p; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp new file mode 100644 index 000000000..f49702a3d --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move.pass.cpp @@ -0,0 +1,140 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include +#include + +#include "deleter_types.h" + +//============================================================================= +// TESTING unique_ptr(unique_ptr&&) +// +// Concerns +// 1 The moved from pointer is empty and the new pointer stores the old value. +// 2 The only requirement on the deleter is that it is MoveConstructible +// or a reference. +// 3 The constructor works for explicitly moved values (ie std::move(x)) +// 4 The constructor works for true temporaries (ie a return value) +// +// Plan +// 1 Explicitly construct unique_ptr for various deleter types 'D'. +// check that the value and deleter have been properly moved. (C-1,2,3) +// +// 2 Use the expression 'sink(source())' to move construct a unique_ptr +// from a temporary. 'source' should return the unique_ptr by value and +// 'sink' should accept the unique_ptr by value. (C-1,2,4) + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +template +void sinkFunction(Expect) +{ +} + +typedef std::unique_ptr APtrSource1; +typedef std::unique_ptr > APtrSource2; +typedef std::unique_ptr& > APtrSource3; + +APtrSource1 source1() { + return APtrSource1 (new A); +} + +void sink1(APtrSource1 p) { + assert(p.get() != nullptr); +} + +APtrSource2 source2() { + return APtrSource2(new A, Deleter(5)); +} + +void sink2(APtrSource2 p) { + assert(p.get() != nullptr); + assert(p.get_deleter().state() == 5); +} + +APtrSource3 source3() { + static NCDeleter d(5); + return APtrSource3(new A, d); +} + +void sink3(APtrSource3 p) { + assert(p.get() != nullptr); + assert(p.get_deleter().state() == 5); + assert(&p.get_deleter() == &source3().get_deleter()); +} + +int main() +{ + { + typedef std::unique_ptr APtr; + APtr s(new A); + A* p = s.get(); + APtr s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); + { + typedef Deleter MoveDel; + typedef std::unique_ptr APtr; + MoveDel d(5); + APtr s(new A, std::move(d)); + assert(d.state() == 0); + assert(s.get_deleter().state() == 5); + A* p = s.get(); + APtr s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + { + typedef NCDeleter NonCopyDel; + typedef std::unique_ptr APtr; + + NonCopyDel d; + APtr s(new A, d); + A* p = s.get(); + APtr s2 = std::move(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + { + sink1(source1()); + assert(A::count == 0); + sink2(source2()); + assert(A::count == 0); + sink3(source3()); + assert(A::count == 0); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp new file mode 100644 index 000000000..68ad589b1 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move01.fail.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include + +// test move ctor. Can't copy from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp new file mode 100644 index 000000000..897b889d6 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move02.fail.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include + +// test move ctor. Can't copy from const lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + const std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp new file mode 100644 index 000000000..7fb1a0a74 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move03.fail.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include + +// test move ctor. Can't copy from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete p;} +}; + +int main() +{ + { + std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp new file mode 100644 index 000000000..671e343fd --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move04.fail.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr move ctor + +#include +#include + +// test move ctor. Can't copy from const lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +class Deleter +{ + int state_; + +public: + + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(A* p) {delete p;} +}; + +int main() +{ + { + const std::unique_ptr s(new A); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp new file mode 100644 index 000000000..ada010929 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert.pass.cpp @@ -0,0 +1,171 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// + +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// NOTE: unique_ptr does not provide converting constructors in c++03 +// XFAIL: c++98, c++03 + + + +#include +#include +#include +#include + +#include "deleter_types.h" + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + + +template +void checkReferenceDeleter(LHS& lhs, RHS& rhs) { + typedef typename LHS::deleter_type NewDel; + static_assert(std::is_reference::value, ""); + rhs.get_deleter().set_state(42); + assert(rhs.get_deleter().state() == 42); + assert(lhs.get_deleter().state() == 42); + lhs.get_deleter().set_state(99); + assert(lhs.get_deleter().state() == 99); + assert(rhs.get_deleter().state() == 99); +} + +template +void checkDeleter(LHS& lhs, RHS& rhs, int LHSVal, int RHSVal) { + assert(lhs.get_deleter().state() == LHSVal); + assert(rhs.get_deleter().state() == RHSVal); +} + +template +void checkCtor(LHS& lhs, RHS& rhs, A* RHSVal) { + assert(lhs.get() == RHSVal); + assert(rhs.get() == nullptr); + assert(A::count == 1); + assert(B::count == 1); +} + +void checkNoneAlive() { + assert(A::count == 0); + assert(B::count == 0); +} + +int main() +{ + { + typedef std::unique_ptr APtr; + typedef std::unique_ptr BPtr; + { // explicit + BPtr b(new B); + A* p = b.get(); + APtr a(std::move(b)); + checkCtor(a, b, p); + } + checkNoneAlive(); + { // implicit + BPtr b(new B); + A* p = b.get(); + APtr a = std::move(b); + checkCtor(a, b, p); + } + checkNoneAlive(); + } + { // test with moveable deleters + typedef std::unique_ptr > APtr; + typedef std::unique_ptr > BPtr; + { + Deleter del(5); + BPtr b(new B, std::move(del)); + A* p = b.get(); + APtr a(std::move(b)); + checkCtor(a, b, p); + checkDeleter(a, b, 5, 0); + } + checkNoneAlive(); + { + Deleter del(5); + BPtr b(new B, std::move(del)); + A* p = b.get(); + APtr a = std::move(b); + checkCtor(a, b, p); + checkDeleter(a, b, 5, 0); + } + checkNoneAlive(); + + } + { // test with reference deleters + typedef std::unique_ptr& > APtr; + typedef std::unique_ptr& > BPtr; + NCDeleter del(5); + { + BPtr b(new B, del); + A* p = b.get(); + APtr a(std::move(b)); + checkCtor(a, b, p); + checkReferenceDeleter(a, b); + } + checkNoneAlive(); + { + BPtr b(new B, del); + A* p = b.get(); + APtr a = std::move(b); + checkCtor(a, b, p); + checkReferenceDeleter(a, b); + } + checkNoneAlive(); + } + { + typedef std::unique_ptr > APtr; + typedef std::unique_ptr& > BPtr; + CDeleter del(5); + { + BPtr b(new B, del); + A* p = b.get(); + APtr a(std::move(b)); + checkCtor(a, b, p); + checkDeleter(a, b, 5, 5); + } + checkNoneAlive(); + { + BPtr b(new B, del); + A* p = b.get(); + APtr a = std::move(b); + checkCtor(a, b, p); + checkDeleter(a, b, 5, 5); + } + checkNoneAlive(); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp new file mode 100644 index 000000000..ed1fe8c2b --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert01.fail.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// Can't construct from lvalue + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp new file mode 100644 index 000000000..3d1cb6fd0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert02.fail.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +#include +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr > s(new B); + A* p = s.get(); + std::unique_ptr > s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + assert(s2.get_deleter().state() == 5); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp new file mode 100644 index 000000000..740919979 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert03.fail.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp new file mode 100644 index 000000000..981ea706e --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert04.fail.cpp @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// implicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp new file mode 100644 index 000000000..76462dc04 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert05.fail.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +#include "deleter_types.h" + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Implicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + std::unique_ptr > s(new B); + std::unique_ptr > s2 = s; +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp new file mode 100644 index 000000000..5b9b12e0d --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert06.fail.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp new file mode 100644 index 000000000..bef022cfc --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert07.fail.cpp @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp new file mode 100644 index 000000000..016eadcb2 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert08.fail.cpp @@ -0,0 +1,86 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class Deleter +{ + int state_; + Deleter(const Deleter&); + Deleter& operator=(const Deleter&); + +public: + Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;} + Deleter& operator=(Deleter&& r) + { + state_ = r.state_; + r.state_ = 0; + return *this; + } + + Deleter() : state_(5) {} + + template + Deleter(Deleter&& d, + typename std::enable_if::value>::type* = 0) + : state_(d.state()) {d.set_state(0);} + +private: + template + Deleter(const Deleter& d, + typename std::enable_if::value>::type* = 0); + +public: + int state() const {return state_;} + void set_state(int i) {state_ = i;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + const std::unique_ptr > s; + std::unique_ptr > s2(s); // expected-error {{no matching constructor}} +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp new file mode 100644 index 000000000..a475c1754 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert09.fail.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + const std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2(s); + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp new file mode 100644 index 000000000..f0da5efb6 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert10.fail.cpp @@ -0,0 +1,58 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// implicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { + const std::unique_ptr s(new B); + A* p = s.get(); + std::unique_ptr s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp new file mode 100644 index 000000000..1b8bb736d --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert11.fail.cpp @@ -0,0 +1,86 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Implicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class Deleter +{ + int state_; + + Deleter(const Deleter&); + Deleter& operator=(const Deleter&); +public: + Deleter(Deleter&& r) : state_(r.state_) {r.state_ = 0;} + Deleter& operator=(Deleter&& r) + { + state_ = r.state_; + r.state_ = 0; + return *this; + } + + Deleter() : state_(5) {} + + template + Deleter(Deleter&& d, + typename std::enable_if::value>::type* = 0) + : state_(d.state()) {d.set_state(0);} + +private: + template + Deleter(const Deleter& d, + typename std::enable_if::value>::type* = 0); + +public: + int state() const {return state_;} + void set_state(int i) {state_ = i;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + const std::unique_ptr > s; + std::unique_ptr > s2 = s; // expected-error {{no viable conversion}} +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp new file mode 100644 index 000000000..095bec656 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert12.fail.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr converting move ctor + +#include +#include +#include + +// test converting move ctor. Should only require a MoveConstructible deleter, or if +// deleter is a reference, not even that. +// Explicit version + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +template +class CDeleter +{ + int state_; + + CDeleter(CDeleter&); + CDeleter& operator=(CDeleter&); +public: + + CDeleter() : state_(5) {} + + int state() const {return state_;} + void set_state(int s) {state_ = s;} + + void operator()(T* p) {delete p;} +}; + +int main() +{ + { + CDeleter d; + const std::unique_ptr&> s(new B, d); + A* p = s.get(); + std::unique_ptr&> s2 = s; + assert(s2.get() == p); + assert(s.get() == 0); + assert(A::count == 1); + assert(B::count == 1); + d.set_state(6); + assert(s2.get_deleter().state() == d.state()); + assert(s.get_deleter().state() == d.state()); + } + assert(A::count == 0); + assert(B::count == 0); +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.single.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp similarity index 57% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.single.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp index 529749da6..a4bd2cba1 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.single.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/move_convert13.fail.cpp @@ -11,14 +11,25 @@ // unique_ptr -// test op[](size_t) +// Test unique_ptr converting move ctor + +// Do not convert from an array unique_ptr #include +#include #include -int main() { - std::unique_ptr p(new int[3]); - std::unique_ptr const& cp = p; - p[0]; // expected-error {{type 'std::unique_ptr' does not provide a subscript operator}} - cp[1]; // expected-error {{type 'const std::unique_ptr' does not provide a subscript operator}} +struct A +{ +}; + +struct Deleter +{ + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr s; + std::unique_ptr s2(std::move(s)); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp new file mode 100644 index 000000000..67a48a3e7 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/nullptr.pass.cpp @@ -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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// unique_ptr(nullptr_t); + +#include +#include + +// default unique_ptr ctor should only require default Deleter ctor +class Deleter +{ + int state_; + + Deleter(Deleter&); + Deleter& operator=(Deleter&); + +public: + Deleter() : state_(5) {} + + int state() const {return state_;} + + void operator()(void*) {} +}; + +int main() +{ + { + std::unique_ptr p(nullptr); + assert(p.get() == 0); + } + { + std::unique_ptr p(nullptr); + assert(p.get() == 0); + assert(p.get_deleter().state() == 5); + } +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp new file mode 100644 index 000000000..da502b0b2 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer.pass.cpp @@ -0,0 +1,163 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +//============================================================================= +// TESTING std::unique_ptr::unique_ptr() +// +// Concerns: +// 1 The pointer constructor works for any default constructible deleter types. +// 2 The pointer constructor accepts pointers to derived types. +// 2 The stored type 'T' is allowed to be incomplete. +// +// Plan +// 1 Construct unique_ptr's with a pointer to 'T' and various deleter +// types (C-1) +// 2 Construct unique_ptr's with a pointer to 'D' and various deleter +// types where 'D' is derived from 'T'. (C-1,2) +// 3 Construct a unique_ptr with a pointer to 'T' and various deleter +// types where 'T' is an incomplete type (C-1,3) + +// Test unique_ptr(pointer) ctor + +#include +#include + +#include "deleter_types.h" + +// unique_ptr(pointer) ctor should only require default Deleter ctor + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + + +struct IncompleteT; + +IncompleteT* getIncomplete(); +void checkNumIncompleteTypeAlive(int i); + +template > +struct StoresIncomplete { + std::unique_ptr m_ptr; + StoresIncomplete() {} + explicit StoresIncomplete(IncompleteT* ptr) : m_ptr(ptr) {} + ~StoresIncomplete(); + + IncompleteT* get() const { return m_ptr.get(); } + Del& get_deleter() { return m_ptr.get_deleter(); } +}; + +void test_pointer() +{ + { + A* p = new A; + assert(A::count == 1); + std::unique_ptr s(p); + assert(s.get() == p); + } + assert(A::count == 0); + { + A* p = new A; + assert(A::count == 1); + std::unique_ptr > s(p); + assert(s.get() == p); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); +} + +void test_derived() +{ + { + B* p = new B; + assert(A::count == 1); + assert(B::count == 1); + std::unique_ptr s(p); + assert(s.get() == p); + } + assert(A::count == 0); + assert(B::count == 0); + { + B* p = new B; + assert(A::count == 1); + assert(B::count == 1); + std::unique_ptr > s(p); + assert(s.get() == p); + assert(s.get_deleter().state() == 0); + } + assert(A::count == 0); + assert(B::count == 0); +} + +void test_incomplete() +{ + { + IncompleteT* p = getIncomplete(); + checkNumIncompleteTypeAlive(1); + StoresIncomplete<> s(p); + assert(s.get() == p); + } + checkNumIncompleteTypeAlive(0); + { + IncompleteT* p = getIncomplete(); + checkNumIncompleteTypeAlive(1); + StoresIncomplete< NCDeleter > s(p); + assert(s.get() == p); + assert(s.get_deleter().state() == 0); + } + checkNumIncompleteTypeAlive(0); +} + +struct IncompleteT { + static int count; + IncompleteT() { ++count; } + ~IncompleteT() {--count; } +}; + +int IncompleteT::count = 0; + +IncompleteT* getIncomplete() { + return new IncompleteT; +} + +void checkNumIncompleteTypeAlive(int i) { + assert(IncompleteT::count == i); +} + +template +StoresIncomplete::~StoresIncomplete() { } + +int main() +{ + test_pointer(); + test_derived(); + test_incomplete(); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp new file mode 100644 index 000000000..1af04b2c0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer01.fail.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include + +// unique_ptr(pointer) ctor should require default Deleter ctor +class Deleter +{ + + Deleter() {} + +public: + + Deleter(Deleter&) {} + Deleter& operator=(Deleter&) {} + + void operator()(void*) const {} +}; + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp new file mode 100644 index 000000000..9b7dd8c70 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer02.fail.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include + +// unique_ptr(pointer) ctor should require non-reference Deleter ctor +class Deleter +{ +public: + + void operator()(void*) {} +}; + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp new file mode 100644 index 000000000..a917d87ee --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer03.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// Test unique_ptr(pointer) ctor + +#include + +// unique_ptr(pointer) ctor should require non-pointer Deleter + +int main() +{ + std::unique_ptr p(new int); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp new file mode 100644 index 000000000..929468119 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter.pass.cpp @@ -0,0 +1,123 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +//============================================================================= +// TESTING unique_ptr(pointer, deleter) +// +// Concerns: +// 1 unique_ptr(pointer, deleter&&) only requires a MoveConstructible deleter. +// 2 unique_ptr(pointer, deleter&) requires a CopyConstructible deleter. +// 3 unique_ptr(pointer, deleter) does not require a CopyConstructible deleter. +// 4 unique_ptr(pointer, deleter) does not require a CopyConstructible deleter. +// 5 unique_ptr(pointer, deleter) should work for derived pointers. +// 6 unique_ptr(pointer, deleter) should work with function pointers. +// 7 unique_ptr should work. + + +#include +#include + +#include "deleter_types.h" + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; + +int A::count = 0; + + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +bool my_free_called = false; + +void my_free(void*) { + my_free_called = true; +} + +int main() +{ + { // MoveConstructible deleter (C-1) + A* p = new A; + assert(A::count == 1); + std::unique_ptr > s(p, Deleter(5)); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); + { // CopyConstructible deleter (C-2) + A* p = new A; + assert(A::count == 1); + CopyDeleter d(5); + std::unique_ptr > s(p, d); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + d.set_state(6); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); + { // Reference deleter (C-3) + A* p = new A; + assert(A::count == 1); + NCDeleter d(5); + std::unique_ptr&> s(p, d); + assert(s.get() == p); + assert(&s.get_deleter() == &d); + assert(s.get_deleter().state() == 5); + d.set_state(6); + assert(s.get_deleter().state() == 6); + } + assert(A::count == 0); + { // Const Reference deleter (C-4) + A* p = new A; + assert(A::count == 1); + NCConstDeleter d(5); + std::unique_ptr const&> s(p, d); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + assert(&s.get_deleter() == &d); + } + assert(A::count == 0); + { // Derived pointers (C-5) + B* p = new B; + assert(A::count == 1); + assert(B::count == 1); + std::unique_ptr > s(p, Deleter(5)); + assert(s.get() == p); + assert(s.get_deleter().state() == 5); + } + assert(A::count == 0); + assert(B::count == 0); + { // Void and function pointers (C-6,7) + { + int i = 0; + std::unique_ptr s(&i, my_free); + assert(s.get() == &i); + assert(s.get_deleter() == my_free); + assert(!my_free_called); + } + assert(my_free_called); + } +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp similarity index 70% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp index b4cd3f36a..ad64b5e4e 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.fail.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.ctor/pointer_deleter04.fail.cpp @@ -20,10 +20,11 @@ #include struct Deleter { - void operator()(int* p) const { delete p; } + void operator()(int* p) const {delete p;} }; -int main() { - // expected-error@+1 {{call to deleted constructor of 'std::unique_ptr}} - std::unique_ptr s((int*)nullptr, Deleter()); +int main() +{ + // expected-error@memory:* {{static_assert failed "rvalue deleter bound to reference"}} + std::unique_ptr s((int*)nullptr, Deleter()); // expected-note {{requested here}} } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor/null.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp similarity index 54% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor/null.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp index fa10ade51..064f38c5f 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.dtor/null.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.dtor/null.pass.cpp @@ -16,33 +16,29 @@ #include #include -class Deleter { - int state_; +class Deleter +{ + int state_; - Deleter(Deleter&); - Deleter& operator=(Deleter&); + Deleter(Deleter&); + Deleter& operator=(Deleter&); public: - Deleter() : state_(0) {} + Deleter() : state_(0) {} - int state() const { return state_; } + int state() const {return state_;} - void operator()(void*) { ++state_; } + void operator()(void*) {++state_;} }; -template -void test_basic() { - Deleter d; - assert(d.state() == 0); - { - std::unique_ptr p(nullptr, d); - assert(p.get() == nullptr); +int main() +{ + Deleter d; + assert(d.state() == 0); + { + std::unique_ptr p(0, d); + assert(p.get() == 0); assert(&p.get_deleter() == &d); - } - assert(d.state() == 0); -} - -int main() { - test_basic(); - test_basic(); + } + assert(d.state() == 0); } diff --git a/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp similarity index 62% rename from test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp index 229ce10dd..dadd4ecbe 100644 --- a/test/libcxx/experimental/language.support/support.coroutines/version.sh.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/release.pass.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -8,18 +7,21 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03, c++11 -// REQUIRES: fcoroutines-ts +// -// RUN: %build -fcoroutines-ts -// RUN: %run +// unique_ptr -#include +// test release -#ifndef _LIBCPP_VERSION -#error _LIBCPP_VERSION must be defined -#endif +#include +#include int main() { + std::unique_ptr p(new int(3)); + int* i = p.get(); + int* j = p.release(); + assert(p.get() == 0); + assert(i == j); + delete j; } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp new file mode 100644 index 000000000..2cf7f8b77 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset1.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test reset + +#include +#include + +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + ~A() {--count;} +}; + +int A::count = 0; + +int main() +{ + { + std::unique_ptr p(new A); + assert(A::count == 1); + A* i = p.get(); + assert(i != nullptr); + p.reset(); + assert(A::count == 0); + assert(p.get() == 0); + } + assert(A::count == 0); + { + std::unique_ptr p(new A); + assert(A::count == 1); + A* i = p.get(); + assert(i != nullptr); + p.reset(new A); + assert(A::count == 1); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp similarity index 67% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp index 8f2a69913..2de7787b2 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset2.pass.cpp @@ -16,10 +16,30 @@ #include #include -#include "unique_ptr_test_helper.h" +struct A +{ + static int count; + A() {++count;} + A(const A&) {++count;} + virtual ~A() {--count;} +}; -int main() { - { +int A::count = 0; + +struct B + : public A +{ + static int count; + B() {++count;} + B(const B&) {++count;} + virtual ~B() {--count;} +}; + +int B::count = 0; + +int main() +{ + { std::unique_ptr p(new A); assert(A::count == 1); assert(B::count == 0); @@ -28,10 +48,10 @@ int main() { p.reset(new B); assert(A::count == 1); assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); - { + } + assert(A::count == 0); + assert(B::count == 0); + { std::unique_ptr p(new B); assert(A::count == 1); assert(B::count == 1); @@ -40,7 +60,7 @@ int main() { p.reset(new B); assert(A::count == 1); assert(B::count == 1); - } - assert(A::count == 0); - assert(B::count == 0); + } + assert(A::count == 0); + assert(B::count == 0); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset_self.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.cpp similarity index 76% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset_self.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.cpp index f838661c5..58b05efa2 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset_self.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/reset_self.pass.cpp @@ -15,11 +15,15 @@ #include -struct A { - std::unique_ptr ptr_; +struct A +{ + std::unique_ptr ptr_; - A() : ptr_(this) {} - void reset() { ptr_.reset(); } + A() : ptr_(this) {} + void reset() {ptr_.reset();} }; -int main() { (new A)->reset(); } +int main() +{ + (new A)->reset(); +} diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp new file mode 100644 index 000000000..68a320458 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.modifiers/swap.pass.cpp @@ -0,0 +1,59 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test swap + +#include +#include + +#include "deleter_types.h" + +struct A +{ + int state_; + static int count; + explicit A(int i) : state_(i) {++count;} + A(const A& a) : state_(a.state_) {++count;} + A& operator=(const A& a) {state_ = a.state_; return *this;} + ~A() {--count;} + + friend bool operator==(const A& x, const A& y) + {return x.state_ == y.state_;} +}; + +int A::count = 0; + +int main() +{ + { + A* p1 = new A(1); + std::unique_ptr > s1(p1, Deleter(1)); + A* p2 = new A(2); + std::unique_ptr > s2(p2, Deleter(2)); + assert(s1.get() == p1); + assert(*s1 == A(1)); + assert(s1.get_deleter().state() == 1); + assert(s2.get() == p2); + assert(*s2 == A(2)); + assert(s2.get_deleter().state() == 2); + s1.swap(s2); + assert(s1.get() == p2); + assert(*s1 == A(2)); + assert(s1.get_deleter().state() == 2); + assert(s2.get() == p1); + assert(*s2 == A(1)); + assert(s2.get_deleter().state() == 1); + assert(A::count == 2); + } + assert(A::count == 0); +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp similarity index 85% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp index b2d3da48d..9d0cfcaaf 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/dereference.single.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/dereference.pass.cpp @@ -16,7 +16,8 @@ #include #include -int main() { - std::unique_ptr p(new int(3)); - assert(*p == 3); +int main() +{ + std::unique_ptr p(new int(3)); + assert(*p == 3); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp new file mode 100644 index 000000000..d5c7445b0 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/explicit_bool.pass.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test op*() + +#include +#include + +int main() +{ + { + std::unique_ptr p(new int(3)); + if (p) + ; + else + assert(false); + if (!p) + assert(false); + } + { + std::unique_ptr p; + if (!p) + ; + else + assert(false); + if (p) + assert(false); + } +} diff --git a/test/libcxx/selftest/test.pass.mm b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp similarity index 70% rename from test/libcxx/selftest/test.pass.mm rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp index b4289556e..24fa6beb4 100644 --- a/test/libcxx/selftest/test.pass.mm +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get.pass.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure @@ -8,10 +7,18 @@ // //===----------------------------------------------------------------------===// -#if __has_feature(objc_arc) -#error "arc should *not* be enabled" -#endif +// + +// unique_ptr + +// test get + +#include +#include int main() { + int* p = new int; + std::unique_ptr s(p); + assert(s.get() == p); } diff --git a/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp new file mode 100644 index 000000000..5ed8a22b1 --- /dev/null +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/get_deleter.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// unique_ptr + +// test get_deleter() + +#include +#include + +struct Deleter +{ + void operator()(void*) {} + + int test() {return 5;} + int test() const {return 6;} +}; + +int main() +{ + { + std::unique_ptr p; + assert(p.get_deleter().test() == 5); + } + { + const std::unique_ptr p; + assert(p.get_deleter().test() == 6); + } +} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp similarity index 50% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp index b47c35afb..21e829cbc 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/index.fail.cpp @@ -16,33 +16,32 @@ #include #include -class A { - int state_; - static int next_; - +class A +{ + int state_; + static int next_; public: - A() : state_(++next_) {} - int get() const { return state_; } + A() : state_(++next_) {} + int get() const {return state_;} - friend bool operator==(const A& x, int y) { return x.state_ == y; } + friend bool operator==(const A& x, int y) + {return x.state_ == y;} - A& operator=(int i) { - state_ = i; - return *this; - } + A& operator=(int i) {state_ = i; return *this;} }; int A::next_ = 0; -int main() { - std::unique_ptr p(new A[3]); - assert(p[0] == 1); - assert(p[1] == 2); - assert(p[2] == 3); - p[0] = 3; - p[1] = 2; - p[2] = 1; - assert(p[0] == 3); - assert(p[1] == 2); - assert(p[2] == 1); +int main() +{ + std::unique_ptr p(new A[3]); + assert(p[0] == 1); + assert(p[1] == 2); + assert(p[2] == 3); + p[0] = 3; + p[1] = 2; + p[2] = 1; + assert(p[0] == 3); + assert(p[1] == 2); + assert(p[2] == 1); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.single.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp similarity index 79% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.single.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp index 8bed9dda2..47de8f66e 100644 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_arrow.single.pass.cpp +++ b/test/std/utilities/memory/unique.ptr/unique.ptr.single/unique.ptr.single.observers/op_arrow.pass.cpp @@ -16,13 +16,15 @@ #include #include -struct A { - int i_; +struct A +{ + int i_; - A() : i_(7) {} + A() : i_(7) {} }; -int main() { - std::unique_ptr p(new A); - assert(p->i_ == 7); +int main() +{ + std::unique_ptr p(new A); + assert(p->i_ == 7); } diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/eq.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.special/eq.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.special/eq.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/rel.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.special/rel.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.special/rel.pass.cpp diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp b/test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp similarity index 100% rename from test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp rename to test/std/utilities/memory/unique.ptr/unique.ptr.special/swap.pass.cpp diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp index eb0d0a955..5a0d9259c 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp @@ -49,10 +49,6 @@ struct Bar : public Foo { }; -struct PrivateBase : private std::enable_shared_from_this { -}; - - int main() { { // https://bugs.llvm.org/show_bug.cgi?id=18843 @@ -78,12 +74,6 @@ int main() assert(p == q); assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership } - { - typedef std::shared_ptr APtr; - typedef std::weak_ptr WeakAPtr; - APtr a1 = std::make_shared(); - assert(a1.use_count() == 1); - } // Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired. // http://cplusplus.github.io/LWG/lwg-active.html#2529. // Test two different ways: diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp index 78b04d861..879ea405c 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.hash/hash_unique_ptr.pass.cpp @@ -50,7 +50,7 @@ namespace std { template struct hash<::min_pointer>> { - size_t operator()(::min_pointer> p) const TEST_NOEXCEPT_FALSE { + size_t operator()(::min_pointer> p) const { if (!p) return 0; return std::hash{}(std::addressof(*p)); } @@ -71,11 +71,6 @@ int main() assert(h == std::hash()(ptr)); } #if TEST_STD_VER >= 11 - { - std::unique_ptr> pThrowingHash; - std::hash>> fThrowingHash; - ASSERT_NOT_NOEXCEPT(fThrowingHash(pThrowingHash)); - } { test_enabled_with_deleter>(); test_enabled_with_deleter>(); diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp index 4b56a8fb6..3bad537e3 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp index 065a7e90a..5cc1234ad 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp index 2351e9741..a89c0dbd2 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp index e36c8a5a9..821cea686 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp index f1fe28cc1..66be756d5 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp index 45cbc5099..493ba7fcc 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp index b51c6cf08..4820d0542 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp index 9f3617a2c..ef8dc8221 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp index 5ae26809f..a13a7d57a 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp index ecba90b71..6dfe3166c 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp @@ -11,8 +11,8 @@ // // This test uses new symbols that were not defined in the libc++ shipped on // darwin11 and darwin12: -// XFAIL: availability=macosx10.7 -// XFAIL: availability=macosx10.8 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11 +// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12 // diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp index 3ad3232a9..73e87f314 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp @@ -86,7 +86,6 @@ int main() // Without rvalue references, ptr got copied into // the shared_ptr destructor and the copy was // destroyed during unwinding. - (void) raw_ptr; // silence 'unused variable' warning assert(A::count == 0); assert(B::count == 0); #endif diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp index 17289197d..877577c9c 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp @@ -80,7 +80,6 @@ int main() assert(B::count == 1); assert(ptr.get() == raw_ptr); #else - (void) raw_ptr; // silence 'unused variable' warning assert(A::count == 0); assert(B::count == 0); assert(ptr.get() == 0); diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp index f8f73f771..2a7ac9979 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp @@ -45,25 +45,6 @@ struct Foo virtual ~Foo() = default; }; -#ifdef _LIBCPP_VERSION -struct Result {}; -static Result theFunction() { return Result(); } -static int resultDeletorCount; -static void resultDeletor(Result (*pf)()) { - assert(pf == theFunction); - ++resultDeletorCount; -} - -void test_pointer_to_function() { - { // https://bugs.llvm.org/show_bug.cgi?id=27566 - std::shared_ptr x(&theFunction, &resultDeletor); - std::shared_ptr y(theFunction, resultDeletor); - } - assert(resultDeletorCount == 2); -} -#else // _LIBCPP_VERSION -void test_pointer_to_function() {} -#endif // _LIBCPP_VERSION int main() { @@ -85,8 +66,6 @@ int main() assert(p2.get()); } - test_pointer_to_function(); - #if TEST_STD_VER >= 11 nc = globalMemCounter.outstanding_new; { diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp index 9f6f1bc75..3acd2f8c6 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_shared_ptr.pass.cpp @@ -11,11 +11,10 @@ // shared_ptr -// template bool owner_before(shared_ptr const& b) const noexcept; +// template bool owner_before(shared_ptr const& b) const; #include #include -#include "test_macros.h" int main() { @@ -26,5 +25,4 @@ int main() assert(!p2.owner_before(p1)); assert(p1.owner_before(p3) || p3.owner_before(p1)); assert(p3.owner_before(p1) == p3.owner_before(p2)); - ASSERT_NOEXCEPT(p1.owner_before(p2)); } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp index 560293bbe..33447ba7d 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.obs/owner_before_weak_ptr.pass.cpp @@ -11,11 +11,10 @@ // shared_ptr -// template bool owner_before(weak_ptr const& b) const noexcept; +// template bool owner_before(weak_ptr const& b) const; #include #include -#include "test_macros.h" int main() { @@ -29,5 +28,4 @@ int main() assert(!p2.owner_before(w1)); assert(p1.owner_before(w3) || p3.owner_before(w1)); assert(p3.owner_before(w1) == p3.owner_before(w2)); - ASSERT_NOEXCEPT(p1.owner_before(w2)); } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp index 501844a1d..142eba2d9 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.ownerless/owner_less.pass.cpp @@ -16,9 +16,9 @@ // : binary_function, shared_ptr, bool> // { // typedef bool result_type; -// bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; -// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; -// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +// bool operator()(shared_ptr const&, shared_ptr const&) const; +// bool operator()(shared_ptr const&, weak_ptr const&) const; +// bool operator()(weak_ptr const&, shared_ptr const&) const; // }; // // template @@ -26,22 +26,22 @@ // : binary_function, weak_ptr, bool> // { // typedef bool result_type; -// bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; -// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; -// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +// bool operator()(weak_ptr const&, weak_ptr const&) const; +// bool operator()(shared_ptr const&, weak_ptr const&) const; +// bool operator()(weak_ptr const&, shared_ptr const&) const; // }; // // Added in C++17 // template<> struct owner_less // { // template -// bool operator()(shared_ptr const&, shared_ptr const&) const noexcept; +// bool operator()(shared_ptr const&, shared_ptr const&) const; // template -// bool operator()(shared_ptr const&, weak_ptr const&) const noexcept; +// bool operator()(shared_ptr const&, weak_ptr const&) const; // template -// bool operator()(weak_ptr const&, shared_ptr const&) const noexcept; +// bool operator()(weak_ptr const&, shared_ptr const&) const; // template -// bool operator()(weak_ptr const&, weak_ptr const&) const noexcept; +// bool operator()(weak_ptr const&, weak_ptr const&) const; // // typedef unspecified is_transparent; // }; @@ -74,14 +74,11 @@ int main() assert(!cs(p2, p1)); assert(cs(p1 ,p3) || cs(p3, p1)); assert(cs(p3, p1) == cs(p3, p2)); - ASSERT_NOEXCEPT(cs(p1, p1)); assert(!cs(p1, w2)); assert(!cs(p2, w1)); assert(cs(p1, w3) || cs(p3, w1)); assert(cs(p3, w1) == cs(p3, w2)); - ASSERT_NOEXCEPT(cs(p1, w1)); - ASSERT_NOEXCEPT(cs(w1, p1)); } { typedef std::owner_less > CS; @@ -95,14 +92,11 @@ int main() assert(!cs(w2, w1)); assert(cs(w1, w3) || cs(w3, w1)); assert(cs(w3, w1) == cs(w3, w2)); - ASSERT_NOEXCEPT(cs(w1, w1)); assert(!cs(w1, p2)); assert(!cs(w2, p1)); assert(cs(w1, p3) || cs(w3, p1)); assert(cs(w3, p1) == cs(w3, p2)); - ASSERT_NOEXCEPT(cs(w1, p1)); - ASSERT_NOEXCEPT(cs(p1, w1)); } #if TEST_STD_VER > 14 { @@ -117,10 +111,6 @@ int main() cmp(sp1, sp3); cmp(wp1, sp1); cmp(wp1, wp1); - ASSERT_NOEXCEPT(cmp(sp1, sp1)); - ASSERT_NOEXCEPT(cmp(sp1, wp1)); - ASSERT_NOEXCEPT(cmp(wp1, sp1)); - ASSERT_NOEXCEPT(cmp(wp1, wp1)); } { // test heterogeneous lookups diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp index 458f8a11e..4aa49cfe8 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_shared_ptr.pass.cpp @@ -11,11 +11,10 @@ // weak_ptr -// template bool owner_before(const shared_ptr& b) const noexcept; +// template bool owner_before(const shared_ptr& b); #include #include -#include "test_macros.h" int main() { @@ -29,6 +28,4 @@ int main() assert(!w2.owner_before(p1)); assert(w1.owner_before(p3) || w3.owner_before(p1)); assert(w3.owner_before(p1) == w3.owner_before(p2)); -// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted - LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(p2)); } diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp index 5cd171a53..9fe2b6e39 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.weak/util.smartptr.weak.obs/owner_before_weak_ptr.pass.cpp @@ -11,11 +11,10 @@ // weak_ptr -// template bool owner_before(const weak_ptr& b) const noexcept; +// template bool owner_before(const weak_ptr& b); #include #include -#include "test_macros.h" int main() { @@ -29,6 +28,4 @@ int main() assert(!w2.owner_before(w1)); assert(w1.owner_before(w3) || w3.owner_before(w1)); assert(w3.owner_before(w1) == w3.owner_before(w2)); -// change to 'ASSERT_NOEXCEPT' when LWG2942 is adopted - LIBCPP_ASSERT_NOEXCEPT(w1.owner_before(w2)); } diff --git a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp index bf8aa0453..51a837e4e 100644 --- a/test/std/utilities/meta/meta.help/integral_constant.pass.cpp +++ b/test/std/utilities/meta/meta.help/integral_constant.pass.cpp @@ -22,11 +22,11 @@ int main() static_assert(_5::value == 5, ""); static_assert((std::is_same<_5::value_type, int>::value), ""); static_assert((std::is_same<_5::type, _5>::value), ""); -#if TEST_STD_VER >= 11 +#ifndef _LIBCPP_HAS_NO_CONSTEXPR static_assert((_5() == 5), ""); -#endif +#else assert(_5() == 5); - +#endif #if TEST_STD_VER > 11 static_assert ( _5{}() == 5, "" ); diff --git a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp index 20c9eca8e..552c16075 100644 --- a/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp +++ b/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp @@ -120,9 +120,7 @@ int main() static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); -#if TEST_STD_VER >= 11 - static_assert((!std::is_convertible::value), ""); -#endif + static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); static_assert((!std::is_convertible::value), ""); diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp index 883548270..43f23f5cc 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // type_traits // aligned_union @@ -19,6 +17,7 @@ int main() { +#ifndef _LIBCPP_HAS_NO_VARIADICS { typedef std::aligned_union<10, char >::type T1; #if TEST_STD_VER > 11 @@ -91,4 +90,5 @@ int main() static_assert(std::alignment_of::value == 4, ""); static_assert(sizeof(T1) == 4, ""); } +#endif } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp index 85b147266..61523e487 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -37,16 +37,8 @@ namespace std typedef S type; }; -// P0548 - template - struct common_type< ::S, ::S > { - typedef S type; - }; - template <> struct common_type< ::S, long> {}; template <> struct common_type > {}; - template <> struct common_type< ::X > {}; - template <> struct common_type< ::X, ::X > {}; } #if TEST_STD_VER >= 11 @@ -96,9 +88,6 @@ void test_bullet_two() { static_assert(std::is_same, int>::value, ""); static_assert(std::is_same, int volatile*>::value, ""); static_assert(std::is_same, void(*)()>::value, ""); - - static_assert(no_common_type >::value, ""); - static_assert(no_common_type >::value, ""); } template @@ -295,18 +284,4 @@ int main() test_bullet_three_two(); test_bullet_four(); #endif - -// P0548 - static_assert((std::is_same >::type, S >::value), ""); - static_assert((std::is_same, S >::type, S >::value), ""); - - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); - - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, int>::value), ""); } diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp index 4f45a0340..bcd839849 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -33,10 +33,4 @@ int main() test_decay(); test_decay(); test_decay(); -#if TEST_STD_VER > 11 - test_decay(); - test_decay(); - test_decay(); - test_decay(); -#endif } diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp index 4e875fa94..c340ba69c 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp @@ -16,13 +16,9 @@ #include "test_macros.h" -// NOTE: On Windows the function `test_is_function` and -// `test_is_function has the same mangled despite being -// a distinct instantiation. This causes Clang to emit an error. However -// structs do not have this problem. - template -struct test_is_function { +void test_is_function() +{ static_assert( std::is_function::value, ""); static_assert( std::is_function::value, ""); static_assert( std::is_function::value, ""); @@ -33,10 +29,11 @@ struct test_is_function { static_assert( std::is_function_v, ""); static_assert( std::is_function_v, ""); #endif -}; +} template -struct test_is_not_function { +void test_is_not_function() +{ static_assert(!std::is_function::value, ""); static_assert(!std::is_function::value, ""); static_assert(!std::is_function::value, ""); @@ -47,7 +44,7 @@ struct test_is_not_function { static_assert(!std::is_function_v, ""); static_assert(!std::is_function_v, ""); #endif -}; +} class Empty { diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index f685d71ee..691c549b5 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -14,12 +14,9 @@ #include #include "test_macros.h" -// NOTE: On Windows the function `test_is_member_function` and -// `test_is_member_function has the same mangled despite being -// a distinct instantiation. This causes Clang to emit an error. However -// structs do not have this problem. template -struct test_member_function_pointer_imp { +void test_member_function_pointer_imp() +{ static_assert(!std::is_void::value, ""); #if TEST_STD_VER > 11 static_assert(!std::is_null_pointer::value, ""); @@ -36,16 +33,16 @@ struct test_member_function_pointer_imp { static_assert(!std::is_union::value, ""); static_assert(!std::is_class::value, ""); static_assert(!std::is_function::value, ""); -}; +} template -struct test_member_function_pointer : - test_member_function_pointer_imp, - test_member_function_pointer_imp, - test_member_function_pointer_imp, - test_member_function_pointer_imp +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 { diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp deleted file mode 100644 index 9c72d4d44..000000000 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp +++ /dev/null @@ -1,79 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template struct is_aggregate; -// template constexpr bool is_aggregate_v = is_aggregate::value; - -#include -#include "test_macros.h" - -template -void test_true() -{ -#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) - static_assert( std::is_aggregate::value, ""); - static_assert( std::is_aggregate::value, ""); - static_assert( std::is_aggregate::value, ""); - static_assert( std::is_aggregate::value, ""); - static_assert( std::is_aggregate_v, ""); - static_assert( std::is_aggregate_v, ""); - static_assert( std::is_aggregate_v, ""); - static_assert( std::is_aggregate_v, ""); -#endif -} - -template -void test_false() -{ -#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE) - static_assert(!std::is_aggregate::value, ""); - static_assert(!std::is_aggregate::value, ""); - static_assert(!std::is_aggregate::value, ""); - static_assert(!std::is_aggregate::value, ""); - static_assert(!std::is_aggregate_v, ""); - static_assert(!std::is_aggregate_v, ""); - static_assert(!std::is_aggregate_v, ""); - static_assert(!std::is_aggregate_v, ""); -#endif -} - -struct Aggregate {}; -struct HasCons { HasCons(int); }; -struct HasPriv { - void PreventUnusedPrivateMemberWarning(); -private: - int x; -}; -struct Union { int x; void* y; }; - - -int main () -{ - { - test_false(); - test_false(); - test_false(); - test_false(); - test_false(); - test_false(); - test_false(); - test_false(); - test_false(); - } - { - test_true(); - test_true(); - test_true(); - test_true(); - } -} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp index 9d2ec5ede..f6ae40153 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -251,7 +251,6 @@ int main() LIBCPP_STATIC_ASSERT( clang_disallows_valid_static_cast_bug != std::__libcpp_is_constructible>::value, ""); - ((void)clang_disallows_valid_static_cast_bug); // Prevent unused warning #else static_assert(clang_disallows_valid_static_cast_bug == false, ""); LIBCPP_STATIC_ASSERT(std::__libcpp_is_constructible>::value, ""); diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp index 0bb373c96..42ecdb3b8 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp @@ -11,9 +11,7 @@ // is_trivially_copyable -// These compilers have not implemented Core 2094 which makes volatile -// qualified types trivially copyable. -// XFAIL: clang-3, clang-4, apple-clang, gcc +// XFAIL: gcc-4.9 #include #include @@ -24,13 +22,13 @@ void test_is_trivially_copyable() { static_assert( std::is_trivially_copyable::value, ""); static_assert( std::is_trivially_copyable::value, ""); - static_assert( std::is_trivially_copyable::value, ""); - static_assert( std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); #if TEST_STD_VER > 14 static_assert( std::is_trivially_copyable_v, ""); static_assert( std::is_trivially_copyable_v, ""); - static_assert( std::is_trivially_copyable_v, ""); - static_assert( std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); #endif } diff --git a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp index 198eee62b..e3c7bb5ad 100644 --- a/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp +++ b/test/std/utilities/optional/optional.bad_optional_access/default.pass.cpp @@ -9,13 +9,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // class bad_optional_access is default constructible diff --git a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp index dc6973927..b54a08f55 100644 --- a/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/equal.pass.cpp @@ -10,55 +10,44 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator==(const optional& x, const U& v); -// template constexpr bool operator==(const U& v, const optional& x); +// template constexpr bool operator==(const optional& x, const T& v); +// template constexpr bool operator==(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator==(const X& lhs, const X& rhs) { - return lhs.i_ == rhs.i_; -} +constexpr bool operator == ( const X &lhs, const X &rhs ) + { return lhs.i_ == rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert(!(o1 == T(1)), ""); - static_assert((o2 == T(1)), ""); - static_assert(!(o3 == T(1)), ""); - static_assert((o3 == T(2)), ""); - static_assert((o3 == val), ""); + static_assert ( !(o1 == T(1)), "" ); + static_assert ( (o2 == T(1)), "" ); + static_assert ( !(o3 == T(1)), "" ); + static_assert ( (o3 == T(2)), "" ); + static_assert ( (o3 == val), "" ); - static_assert(!(T(1) == o1), ""); - static_assert((T(1) == o2), ""); - static_assert(!(T(1) == o3), ""); - static_assert((T(2) == o3), ""); - static_assert((val == o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 == 42l, ""); - static_assert(!(101l == o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 == 42, ""); - static_assert(!(101 == o1), ""); - } + static_assert ( !(T(1) == o1), "" ); + static_assert ( (T(1) == o2), "" ); + static_assert ( !(T(1) == o3), "" ); + static_assert ( (T(2) == o3), "" ); + static_assert ( (val == o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp index e1bad12e3..064114fb9 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater.pass.cpp @@ -10,55 +10,46 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>(const optional& x, const U& v); -// template constexpr bool operator>(const U& v, const optional& x); +// template constexpr bool operator>(const optional& x, const T& v); +// template constexpr bool operator>(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator>(const X& lhs, const X& rhs) { return lhs.i_ > rhs.i_; } +constexpr bool operator > ( const X &lhs, const X &rhs ) + { return lhs.i_ > rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert(!(o1 > T(1)), ""); - static_assert(!(o2 > T(1)), ""); // equal - static_assert((o3 > T(1)), ""); - static_assert(!(o2 > val), ""); - static_assert(!(o3 > val), ""); // equal - static_assert(!(o3 > T(3)), ""); + static_assert ( !(o1 > T(1)), "" ); + static_assert ( !(o2 > T(1)), "" ); // equal + static_assert ( (o3 > T(1)), "" ); + static_assert ( !(o2 > val), "" ); + static_assert ( !(o3 > val), "" ); // equal + static_assert ( !(o3 > T(3)), "" ); - static_assert((T(1) > o1), ""); - static_assert(!(T(1) > o2), ""); // equal - static_assert(!(T(1) > o3), ""); - static_assert((val > o2), ""); - static_assert(!(val > o3), ""); // equal - static_assert((T(3) > o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 > 11l, ""); - static_assert(!(42l > o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 > 11, ""); - static_assert(!(42 > o1), ""); - } + static_assert ( (T(1) > o1), "" ); + static_assert ( !(T(1) > o2), "" ); // equal + static_assert ( !(T(1) > o3), "" ); + static_assert ( (val > o2), "" ); + static_assert ( !(val > o3), "" ); // equal + static_assert ( (T(3) > o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp index 342ddffc2..663686cdf 100644 --- a/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/greater_equal.pass.cpp @@ -10,57 +10,46 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>=(const optional& x, const U& v); -// template constexpr bool operator>=(const U& v, const optional& x); +// template constexpr bool operator>=(const optional& x, const T& v); +// template constexpr bool operator>=(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator>=(const X& lhs, const X& rhs) { - return lhs.i_ >= rhs.i_; -} +constexpr bool operator >= ( const X &lhs, const X &rhs ) + { return lhs.i_ >= rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert(!(o1 >= T(1)), ""); - static_assert((o2 >= T(1)), ""); // equal - static_assert((o3 >= T(1)), ""); - static_assert(!(o2 >= val), ""); - static_assert((o3 >= val), ""); // equal - static_assert(!(o3 >= T(3)), ""); + static_assert ( !(o1 >= T(1)), "" ); + static_assert ( (o2 >= T(1)), "" ); // equal + static_assert ( (o3 >= T(1)), "" ); + static_assert ( !(o2 >= val), "" ); + static_assert ( (o3 >= val), "" ); // equal + static_assert ( !(o3 >= T(3)), "" ); - static_assert((T(1) >= o1), ""); - static_assert((T(1) >= o2), ""); // equal - static_assert(!(T(1) >= o3), ""); - static_assert((val >= o2), ""); - static_assert((val >= o3), ""); // equal - static_assert((T(3) >= o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 >= 42l, ""); - static_assert(!(11l >= o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 >= 42, ""); - static_assert(!(11 >= o1), ""); - } + static_assert ( (T(1) >= o1), "" ); + static_assert ( (T(1) >= o2), "" ); // equal + static_assert ( !(T(1) >= o3), "" ); + static_assert ( (val >= o2), "" ); + static_assert ( (val >= o3), "" ); // equal + static_assert ( (T(3) >= o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp index bcf6afcc6..05ac5eb12 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_equal.pass.cpp @@ -10,57 +10,46 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<=(const optional& x, const U& v); -// template constexpr bool operator<=(const U& v, const optional& x); +// template constexpr bool operator<=(const optional& x, const T& v); +// template constexpr bool operator<=(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator<=(const X& lhs, const X& rhs) { - return lhs.i_ <= rhs.i_; -} +constexpr bool operator <= ( const X &lhs, const X &rhs ) + { return lhs.i_ <= rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert((o1 <= T(1)), ""); - static_assert((o2 <= T(1)), ""); // equal - static_assert(!(o3 <= T(1)), ""); - static_assert((o2 <= val), ""); - static_assert((o3 <= val), ""); // equal - static_assert((o3 <= T(3)), ""); + static_assert ( (o1 <= T(1)), "" ); + static_assert ( (o2 <= T(1)), "" ); // equal + static_assert ( !(o3 <= T(1)), "" ); + static_assert ( (o2 <= val), "" ); + static_assert ( (o3 <= val), "" ); // equal + static_assert ( (o3 <= T(3)), "" ); - static_assert(!(T(1) <= o1), ""); - static_assert((T(1) <= o2), ""); // equal - static_assert((T(1) <= o3), ""); - static_assert(!(val <= o2), ""); - static_assert((val <= o3), ""); // equal - static_assert(!(T(3) <= o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 <= 42l, ""); - static_assert(!(101l <= o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 <= 42, ""); - static_assert(!(101 <= o1), ""); - } + static_assert ( !(T(1) <= o1), "" ); + static_assert ( (T(1) <= o2), "" ); // equal + static_assert ( (T(1) <= o3), "" ); + static_assert ( !(val <= o2), "" ); + static_assert ( (val <= o3), "" ); // equal + static_assert ( !(T(3) <= o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp index 3d5e2144a..d1891a286 100644 --- a/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/less_than.pass.cpp @@ -10,55 +10,46 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<(const optional& x, const U& v); -// template constexpr bool operator<(const U& v, const optional& x); +// template constexpr bool operator<(const optional& x, const T& v); +// template constexpr bool operator<(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator<(const X& lhs, const X& rhs) { return lhs.i_ < rhs.i_; } +constexpr bool operator < ( const X &lhs, const X &rhs ) + { return lhs.i_ < rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert((o1 < T(1)), ""); - static_assert(!(o2 < T(1)), ""); // equal - static_assert(!(o3 < T(1)), ""); - static_assert((o2 < val), ""); - static_assert(!(o3 < val), ""); // equal - static_assert((o3 < T(3)), ""); + static_assert ( (o1 < T(1)), "" ); + static_assert ( !(o2 < T(1)), "" ); // equal + static_assert ( !(o3 < T(1)), "" ); + static_assert ( (o2 < val), "" ); + static_assert ( !(o3 < val), "" ); // equal + static_assert ( (o3 < T(3)), "" ); - static_assert(!(T(1) < o1), ""); - static_assert(!(T(1) < o2), ""); // equal - static_assert((T(1) < o3), ""); - static_assert(!(val < o2), ""); - static_assert(!(val < o3), ""); // equal - static_assert(!(T(3) < o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 < 101l, ""); - static_assert(!(42l < o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 < 101, ""); - static_assert(!(42 < o1), ""); - } + static_assert ( !(T(1) < o1), "" ); + static_assert ( !(T(1) < o2), "" ); // equal + static_assert ( (T(1) < o3), "" ); + static_assert ( !(val < o2), "" ); + static_assert ( !(val < o3), "" ); // equal + static_assert ( !(T(3) < o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp index 7da9b7ba7..ae2ff808f 100644 --- a/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.comp_with_t/not_equal.pass.cpp @@ -10,55 +10,44 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator!=(const optional& x, const U& v); -// template constexpr bool operator!=(const U& v, const optional& x); +// template constexpr bool operator!=(const optional& x, const T& v); +// template constexpr bool operator!=(const T& v, const optional& x); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator!=(const X& lhs, const X& rhs) { - return lhs.i_ != rhs.i_; -} +constexpr bool operator != ( const X &lhs, const X &rhs ) + { return lhs.i_ != rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; constexpr T val(2); - constexpr O o1; // disengaged - constexpr O o2{1}; // engaged - constexpr O o3{val}; // engaged + constexpr O o1; // disengaged + constexpr O o2{1}; // engaged + constexpr O o3{val}; // engaged - static_assert((o1 != T(1)), ""); - static_assert(!(o2 != T(1)), ""); - static_assert((o3 != T(1)), ""); - static_assert(!(o3 != T(2)), ""); - static_assert(!(o3 != val), ""); + static_assert ( (o1 != T(1)), "" ); + static_assert ( !(o2 != T(1)), "" ); + static_assert ( (o3 != T(1)), "" ); + static_assert ( !(o3 != T(2)), "" ); + static_assert ( !(o3 != val), "" ); - static_assert((T(1) != o1), ""); - static_assert(!(T(1) != o2), ""); - static_assert((T(1) != o3), ""); - static_assert(!(T(2) != o3), ""); - static_assert(!(val != o3), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 != 101l, ""); - static_assert(!(42l != o1), ""); - } - { - using O = optional; - constexpr O o1(42); - static_assert(o1 != 101, ""); - static_assert(!(42 != o1), ""); - } + static_assert ( (T(1) != o1), "" ); + static_assert ( !(T(1) != o2), "" ); + static_assert ( (T(1) != o3), "" ); + static_assert ( !(T(2) != o3), "" ); + static_assert ( !(val != o3), "" ); + } } diff --git a/test/std/utilities/optional/optional.hash/hash.pass.cpp b/test/std/utilities/optional/optional.hash/hash.pass.cpp index b4a1832cd..ea89dc3bd 100644 --- a/test/std/utilities/optional/optional.hash/hash.pass.cpp +++ b/test/std/utilities/optional/optional.hash/hash.pass.cpp @@ -22,28 +22,17 @@ struct A {}; struct B {}; -namespace std { - template <> -struct hash { - size_t operator()(B const&) TEST_NOEXCEPT_FALSE { return 0; } +struct std::hash { + size_t operator()(B const&) { return 0; } }; -} - int main() { using std::optional; const std::size_t nullopt_hash = std::hash>{}(optional{}); - - { - optional opt; - ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); - ASSERT_NOT_NOEXCEPT(std::hash>()(opt)); - } - { typedef int T; optional opt; diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp index 0fcc52be1..1207e2415 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp @@ -216,6 +216,7 @@ void test_throws() #ifndef TEST_HAS_NO_EXCEPTIONS using T = ThrowAssign; { + using T = ThrowAssign; optional opt; try { opt = 42; diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp index e7f59f1a9..b53625899 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template T& optional::emplace(Args&&... args); +// template void optional::emplace(Args&&... args); #include #include @@ -51,35 +51,27 @@ void test_one_arg() { using Opt = std::optional; { Opt opt; - auto & v = opt.emplace(); - static_assert( std::is_same_v, "" ); + opt.emplace(); assert(static_cast(opt) == true); assert(*opt == T(0)); - assert(&v == &*opt); } { Opt opt; - auto & v = opt.emplace(1); - static_assert( std::is_same_v, "" ); + opt.emplace(1); assert(static_cast(opt) == true); assert(*opt == T(1)); - assert(&v == &*opt); } { Opt opt(2); - auto & v = opt.emplace(); - static_assert( std::is_same_v, "" ); + opt.emplace(); assert(static_cast(opt) == true); assert(*opt == T(0)); - assert(&v == &*opt); } { Opt opt(2); - auto & v = opt.emplace(1); - static_assert( std::is_same_v, "" ); + opt.emplace(1); assert(static_cast(opt) == true); assert(*opt == T(1)); - assert(&v == &*opt); } } @@ -91,26 +83,20 @@ void test_multi_arg() using Opt = std::optional; { Opt opt; - auto &v = opt.emplace(101, 41); - static_assert( std::is_same_v, "" ); + opt.emplace(101, 41); assert(static_cast(opt) == true); - assert( v == T(101, 41)); assert(*opt == T(101, 41)); } { Opt opt; - auto &v = opt.emplace({1, 2, 3, 4}); - static_assert( std::is_same_v, "" ); + opt.emplace({1, 2, 3, 4}); assert(static_cast(opt) == true); - assert( v == T(4)); // T sets its value to the size of the init list - assert(*opt == T(4)); + assert(*opt == T(4)); // T sets its value to the size of the init list } { Opt opt; - auto &v = opt.emplace({1, 2, 3, 4, 5}, 6); - static_assert( std::is_same_v, "" ); + opt.emplace({1, 2, 3, 4, 5}, 6); assert(static_cast(opt) == true); - assert( v == T(5)); // T sets its value to the size of the init list assert(*opt == T(5)); // T sets its value to the size of the init list } } @@ -123,87 +109,73 @@ void test_on_test_type() { assert(T::alive == 0); { T::reset_constructors(); - auto &v = opt.emplace(); - static_assert( std::is_same_v, "" ); + opt.emplace(); assert(T::alive == 1); assert(T::constructed == 1); assert(T::default_constructed == 1); assert(T::destroyed == 0); assert(static_cast(opt) == true); assert(*opt == T()); - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace(); - static_assert( std::is_same_v, "" ); + opt.emplace(); assert(T::alive == 1); assert(T::constructed == 1); assert(T::default_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T()); - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace(101); - static_assert( std::is_same_v, "" ); + opt.emplace(101); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(101)); - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace(-10, 99); - static_assert( std::is_same_v, "" ); + opt.emplace(-10, 99); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(-10, 99)); - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace(-10, 99); - static_assert( std::is_same_v, "" ); + opt.emplace(-10, 99); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(-10, 99)); - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace({-10, 99, 42, 1}); - static_assert( std::is_same_v, "" ); + opt.emplace({-10, 99, 42, 1}); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(4)); // size of the initializer list - assert(&v == &*opt); } { T::reset_constructors(); - auto &v = opt.emplace({-10, 99, 42, 1}, 42); - static_assert( std::is_same_v, "" ); + opt.emplace({-10, 99, 42, 1}, 42); assert(T::alive == 1); assert(T::constructed == 1); assert(T::value_constructed == 1); assert(T::destroyed == 1); assert(static_cast(opt) == true); assert(*opt == T(4)); // size of the initializer list - assert(&v == &*opt); } } @@ -238,10 +210,8 @@ int main() } { optional opt; - auto &v = opt.emplace(42); - static_assert( std::is_same_v, "" ); + opt.emplace(42); assert(*opt == 42); - assert( v == 42); opt.emplace(); assert(*opt == 0); } @@ -254,9 +224,7 @@ int main() { assert(static_cast(opt) == true); assert(Y::dtor_called == false); - auto &v = opt.emplace(1); - static_assert( std::is_same_v, "" ); - assert(false); + opt.emplace(1); } catch (int i) { diff --git a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp index f6959c7e9..1c3c69a70 100644 --- a/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp @@ -11,7 +11,7 @@ // // template -// T& optional::emplace(initializer_list il, Args&&... args); +// void optional::emplace(initializer_list il, Args&&... args); #include #include @@ -76,27 +76,21 @@ int main() X x; optional opt(x); assert(X::dtor_called == false); - auto &v = opt.emplace({1, 2}); - static_assert( std::is_same_v, "" ); + opt.emplace({1, 2}); assert(X::dtor_called == true); assert(*opt == X({1, 2})); - assert(&v == &*opt); } { optional> opt; - auto &v = opt.emplace({1, 2, 3}, std::allocator()); - static_assert( std::is_same_v&, decltype(v)>, "" ); + opt.emplace({1, 2, 3}, std::allocator()); assert(static_cast(opt) == true); assert(*opt == std::vector({1, 2, 3})); - assert(&v == &*opt); } { optional opt; - auto &v = opt.emplace({1, 2}); - static_assert( std::is_same_v, "" ); + opt.emplace({1, 2}); assert(static_cast(opt) == true); assert(*opt == Y({1, 2})); - assert(&v == &*opt); } #ifndef TEST_HAS_NO_EXCEPTIONS { @@ -106,9 +100,7 @@ int main() { assert(static_cast(opt) == true); assert(Z::dtor_called == false); - auto &v = opt.emplace({1, 2}); - static_assert( std::is_same_v, "" ); - assert(false); + opt.emplace({1, 2}); } catch (int i) { diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp index e4e4a979e..4020d70a4 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp @@ -9,13 +9,6 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // template @@ -42,11 +35,6 @@ struct ExplicitThrow constexpr explicit ExplicitThrow(int x) { if (x != -1) TEST_THROW(6);} }; -struct ImplicitAny { - template - constexpr ImplicitAny(U&&) {} -}; - template constexpr bool implicit_conversion(optional&& opt, const From& v) @@ -91,15 +79,6 @@ void test_implicit() using T = TestTypes::TestType; assert(implicit_conversion(3, T(3))); } - { - using O = optional; - static_assert(!test_convertible(), ""); - static_assert(!test_convertible(), ""); - static_assert(!test_convertible(), ""); - static_assert(!test_convertible(), ""); - static_assert(!test_convertible(), ""); - - } #ifndef TEST_HAS_NO_EXCEPTIONS { try { diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp index e9e98c0bd..34a12b8ad 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/const_T.pass.cpp @@ -9,13 +9,6 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // constexpr optional(const T& v); diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp deleted file mode 100644 index 3224c1bac..000000000 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.fail.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// - -// constexpr optional(const optional& rhs); -// If is_trivially_copy_constructible_v is true, -// this constructor shall be a constexpr constructor. - -#include -#include -#include - -#include "test_macros.h" - -struct S { - constexpr S() : v_(0) {} - S(int v) : v_(v) {} - S(const S &rhs) : v_(rhs.v_) {} // make it not trivially copyable - int v_; - }; - - -int main() -{ - static_assert (!std::is_trivially_copy_constructible_v, "" ); - constexpr std::optional o1; - constexpr std::optional o2 = o1; // not constexpr -} diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp index 6b4283a28..5906d4edd 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/copy.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// constexpr optional(const optional& rhs); +// optional(const optional& rhs); #include #include @@ -32,16 +32,6 @@ void test(InitArgs&&... args) assert(*lhs == *rhs); } -template -constexpr bool constexpr_test(InitArgs&&... args) -{ - static_assert( std::is_trivially_copy_constructible_v, ""); // requirement - const optional rhs(std::forward(args)...); - optional lhs = rhs; - return (lhs.has_value() == rhs.has_value()) && - (lhs.has_value() ? *lhs == *rhs : true); -} - void test_throwing_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS struct Z { @@ -118,9 +108,6 @@ int main() { test(); test(3); - static_assert(constexpr_test(), "" ); - static_assert(constexpr_test(3), "" ); - { const optional o(42); optional o2(o); @@ -165,9 +152,4 @@ int main() { test_reference_extension(); } - { - constexpr std::optional o1{4}; - constexpr std::optional o2 = o1; - static_assert( *o2 == 4, "" ); - } } diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp deleted file mode 100644 index fb2e139ad..000000000 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.fail.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// - -// constexpr optional(const optional&& rhs); -// If is_trivially_move_constructible_v is true, -// this constructor shall be a constexpr constructor. - -#include -#include -#include - -#include "test_macros.h" - -struct S { - constexpr S() : v_(0) {} - S(int v) : v_(v) {} - constexpr S(const S &rhs) : v_(rhs.v_) {} // not trivially moveable - constexpr S(const S &&rhs) : v_(rhs.v_) {} // not trivially moveable - int v_; - }; - - -int main() -{ - static_assert (!std::is_trivially_move_constructible_v, "" ); - constexpr std::optional o1; - constexpr std::optional o2 = std::move(o1); // not constexpr -} diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp index 82acdd9d7..bff6f5bf8 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/move.pass.cpp @@ -8,17 +8,9 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // -// constexpr optional(optional&& rhs); +// optional(optional&& rhs); #include #include @@ -41,17 +33,6 @@ void test(InitArgs&&... args) assert(*lhs == *orig); } -template -constexpr bool constexpr_test(InitArgs&&... args) -{ - static_assert( std::is_trivially_copy_constructible_v, ""); // requirement - const optional orig(std::forward(args)...); - optional rhs(orig); - optional lhs = std::move(rhs); - return (lhs.has_value() == orig.has_value()) && - (lhs.has_value() ? *lhs == *orig : true); -} - void test_throwing_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS struct Z { @@ -155,9 +136,6 @@ int main() { test(); test(3); - static_assert(constexpr_test(), "" ); - static_assert(constexpr_test(3), "" ); - { optional o(42); optional o2(std::move(o)); @@ -220,9 +198,4 @@ int main() { test_reference_extension(); } - { - constexpr std::optional o1{4}; - constexpr std::optional o2 = std::move(o1); - static_assert( *o2 == 4, "" ); - } } diff --git a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp index 761cbee4b..eee749d01 100644 --- a/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp @@ -9,13 +9,6 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // constexpr optional(T&& v); diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp index 44e6e7305..516a79db5 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value.pass.cpp @@ -8,14 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // constexpr T& optional::value() &; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp index e2d48ec99..d4038e4ef 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const.pass.cpp @@ -8,14 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // constexpr const T& optional::value() const &; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp index 874a5441a..e189d3af6 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_const_rvalue.pass.cpp @@ -8,14 +8,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 - -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // // constexpr const T& optional::value() const &&; diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp index f94dcabde..c219e9704 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr T optional::value_or(U&& v) &&; +// template T optional::value_or(U&& v) &&; #include #include @@ -26,22 +26,22 @@ struct Y { int i_; - constexpr Y(int i) : i_(i) {} + Y(int i) : i_(i) {} }; struct X { int i_; - constexpr X(int i) : i_(i) {} - constexpr X(X&& x) : i_(x.i_) {x.i_ = 0;} - constexpr X(const Y& y) : i_(y.i_) {} - constexpr X(Y&& y) : i_(y.i_+1) {} + X(int i) : i_(i) {} + X(X&& x) : i_(x.i_) {x.i_ = 0;} + X(const Y& y) : i_(y.i_) {} + X(Y&& y) : i_(y.i_+1) {} friend constexpr bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} }; -constexpr int test() +int main() { { optional opt(in_place, 2); @@ -65,10 +65,4 @@ constexpr int test() assert(std::move(opt).value_or(Y(3)) == 4); assert(!opt); } - return 0; -} - -int main() -{ - static_assert(test() == 0); } diff --git a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp index 60cab7d27..2ef485b7f 100644 --- a/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp +++ b/test/std/utilities/optional/optional.object/optional.object.observe/value_rvalue.pass.cpp @@ -10,13 +10,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// XFAIL: with_system_cxx_lib=macosx10.12 -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.7 -// XFAIL: with_system_cxx_lib=macosx10.8 - // constexpr T& optional::value() &&; #include diff --git a/test/std/utilities/optional/optional.relops/equal.pass.cpp b/test/std/utilities/optional/optional.relops/equal.pass.cpp index 0752841d3..6650b6720 100644 --- a/test/std/utilities/optional/optional.relops/equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator==(const optional& x, const optional& y); +// template constexpr bool operator==(const optional& x, const optional& y); #include #include @@ -18,69 +18,57 @@ using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator==(const X& lhs, const X& rhs) { - return lhs.i_ == rhs.i_; -} +constexpr bool operator == ( const X &lhs, const X &rhs ) + { return lhs.i_ == rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert(o1 == o1, ""); - static_assert(o1 == o2, ""); - static_assert(!(o1 == o3), ""); - static_assert(!(o1 == o4), ""); - static_assert(!(o1 == o5), ""); + static_assert ( o1 == o1 , "" ); + static_assert ( o1 == o2 , "" ); + static_assert ( !(o1 == o3), "" ); + static_assert ( !(o1 == o4), "" ); + static_assert ( !(o1 == o5), "" ); - static_assert(o2 == o1, ""); - static_assert(o2 == o2, ""); - static_assert(!(o2 == o3), ""); - static_assert(!(o2 == o4), ""); - static_assert(!(o2 == o5), ""); + static_assert ( o2 == o1 , "" ); + static_assert ( o2 == o2 , "" ); + static_assert ( !(o2 == o3), "" ); + static_assert ( !(o2 == o4), "" ); + static_assert ( !(o2 == o5), "" ); - static_assert(!(o3 == o1), ""); - static_assert(!(o3 == o2), ""); - static_assert(o3 == o3, ""); - static_assert(!(o3 == o4), ""); - static_assert(o3 == o5, ""); + static_assert ( !(o3 == o1), "" ); + static_assert ( !(o3 == o2), "" ); + static_assert ( o3 == o3 , "" ); + static_assert ( !(o3 == o4), "" ); + static_assert ( o3 == o5 , "" ); - static_assert(!(o4 == o1), ""); - static_assert(!(o4 == o2), ""); - static_assert(!(o4 == o3), ""); - static_assert(o4 == o4, ""); - static_assert(!(o4 == o5), ""); + static_assert ( !(o4 == o1), "" ); + static_assert ( !(o4 == o2), "" ); + static_assert ( !(o4 == o3), "" ); + static_assert ( o4 == o4 , "" ); + static_assert ( !(o4 == o5), "" ); - static_assert(!(o5 == o1), ""); - static_assert(!(o5 == o2), ""); - static_assert(o5 == o3, ""); - static_assert(!(o5 == o4), ""); - static_assert(o5 == o5, ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 == O2(42), ""); - static_assert(!(O2(101) == o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 == O2(42), ""); - static_assert(!(O2(101) == o1), ""); - } + static_assert ( !(o5 == o1), "" ); + static_assert ( !(o5 == o2), "" ); + static_assert ( o5 == o3 , "" ); + static_assert ( !(o5 == o4), "" ); + static_assert ( o5 == o5 , "" ); + + } } diff --git a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp index f475f3796..f9b304496 100644 --- a/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_equal.pass.cpp @@ -10,74 +10,61 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator>= (const optional& x, const optional& y); +// template constexpr bool operator>= (const optional& x, const optional& y); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator>=(const X& lhs, const X& rhs) { - return lhs.i_ >= rhs.i_; -} +constexpr bool operator >= ( const X &lhs, const X &rhs ) + { return lhs.i_ >= rhs.i_ ; } -int main() { - { +int main() +{ + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert((o1 >= o1), ""); - static_assert((o1 >= o2), ""); - static_assert(!(o1 >= o3), ""); - static_assert(!(o1 >= o4), ""); - static_assert(!(o1 >= o5), ""); + static_assert ( (o1 >= o1), "" ); + static_assert ( (o1 >= o2), "" ); + static_assert ( !(o1 >= o3), "" ); + static_assert ( !(o1 >= o4), "" ); + static_assert ( !(o1 >= o5), "" ); - static_assert((o2 >= o1), ""); - static_assert((o2 >= o2), ""); - static_assert(!(o2 >= o3), ""); - static_assert(!(o2 >= o4), ""); - static_assert(!(o2 >= o5), ""); + static_assert ( (o2 >= o1), "" ); + static_assert ( (o2 >= o2), "" ); + static_assert ( !(o2 >= o3), "" ); + static_assert ( !(o2 >= o4), "" ); + static_assert ( !(o2 >= o5), "" ); - static_assert((o3 >= o1), ""); - static_assert((o3 >= o2), ""); - static_assert((o3 >= o3), ""); - static_assert(!(o3 >= o4), ""); - static_assert((o3 >= o5), ""); + static_assert ( (o3 >= o1), "" ); + static_assert ( (o3 >= o2), "" ); + static_assert ( (o3 >= o3), "" ); + static_assert ( !(o3 >= o4), "" ); + static_assert ( (o3 >= o5), "" ); - static_assert((o4 >= o1), ""); - static_assert((o4 >= o2), ""); - static_assert((o4 >= o3), ""); - static_assert((o4 >= o4), ""); - static_assert((o4 >= o5), ""); + static_assert ( (o4 >= o1), "" ); + static_assert ( (o4 >= o2), "" ); + static_assert ( (o4 >= o3), "" ); + static_assert ( (o4 >= o4), "" ); + static_assert ( (o4 >= o5), "" ); - static_assert((o5 >= o1), ""); - static_assert((o5 >= o2), ""); - static_assert((o5 >= o3), ""); - static_assert(!(o5 >= o4), ""); - static_assert((o5 >= o5), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 >= O2(42), ""); - static_assert(!(O2(11) >= o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 >= O2(42), ""); - static_assert(!(O2(1) >= o1), ""); - } + static_assert ( (o5 >= o1), "" ); + static_assert ( (o5 >= o2), "" ); + static_assert ( (o5 >= o3), "" ); + static_assert ( !(o5 >= o4), "" ); + static_assert ( (o5 >= o5), "" ); + } } diff --git a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp index c3f2af932..8a27eb471 100644 --- a/test/std/utilities/optional/optional.relops/greater_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/greater_than.pass.cpp @@ -10,72 +10,61 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator> (const optional& x, const optional& y); +// template constexpr bool operator> (const optional& x, const optional& y); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator>(const X& lhs, const X& rhs) { return lhs.i_ > rhs.i_; } +constexpr bool operator > ( const X &lhs, const X &rhs ) + { return lhs.i_ > rhs.i_ ; } -int main() { - { +int main() +{ + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert(!(o1 > o1), ""); - static_assert(!(o1 > o2), ""); - static_assert(!(o1 > o3), ""); - static_assert(!(o1 > o4), ""); - static_assert(!(o1 > o5), ""); + static_assert ( !(o1 > o1), "" ); + static_assert ( !(o1 > o2), "" ); + static_assert ( !(o1 > o3), "" ); + static_assert ( !(o1 > o4), "" ); + static_assert ( !(o1 > o5), "" ); - static_assert(!(o2 > o1), ""); - static_assert(!(o2 > o2), ""); - static_assert(!(o2 > o3), ""); - static_assert(!(o2 > o4), ""); - static_assert(!(o2 > o5), ""); + static_assert ( !(o2 > o1), "" ); + static_assert ( !(o2 > o2), "" ); + static_assert ( !(o2 > o3), "" ); + static_assert ( !(o2 > o4), "" ); + static_assert ( !(o2 > o5), "" ); - static_assert((o3 > o1), ""); - static_assert((o3 > o2), ""); - static_assert(!(o3 > o3), ""); - static_assert(!(o3 > o4), ""); - static_assert(!(o3 > o5), ""); + static_assert ( (o3 > o1), "" ); + static_assert ( (o3 > o2), "" ); + static_assert ( !(o3 > o3), "" ); + static_assert ( !(o3 > o4), "" ); + static_assert ( !(o3 > o5), "" ); - static_assert((o4 > o1), ""); - static_assert((o4 > o2), ""); - static_assert((o4 > o3), ""); - static_assert(!(o4 > o4), ""); - static_assert((o4 > o5), ""); + static_assert ( (o4 > o1), "" ); + static_assert ( (o4 > o2), "" ); + static_assert ( (o4 > o3), "" ); + static_assert ( !(o4 > o4), "" ); + static_assert ( (o4 > o5), "" ); - static_assert((o5 > o1), ""); - static_assert((o5 > o2), ""); - static_assert(!(o5 > o3), ""); - static_assert(!(o5 > o4), ""); - static_assert(!(o5 > o5), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 > O2(1), ""); - static_assert(!(O2(42) > o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 > O2(1), ""); - static_assert(!(O2(42) > o1), ""); - } + static_assert ( (o5 > o1), "" ); + static_assert ( (o5 > o2), "" ); + static_assert ( !(o5 > o3), "" ); + static_assert ( !(o5 > o4), "" ); + static_assert ( !(o5 > o5), "" ); + } } diff --git a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp index 35e80d3d4..a7d594dd3 100644 --- a/test/std/utilities/optional/optional.relops/less_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_equal.pass.cpp @@ -10,74 +10,61 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator<= (const optional& x, const optional& y); +// template constexpr bool operator<= (const optional& x, const optional& y); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator<=(const X& lhs, const X& rhs) { - return lhs.i_ <= rhs.i_; -} +constexpr bool operator <= ( const X &lhs, const X &rhs ) + { return lhs.i_ <= rhs.i_ ; } -int main() { - { +int main() +{ + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert((o1 <= o1), ""); - static_assert((o1 <= o2), ""); - static_assert((o1 <= o3), ""); - static_assert((o1 <= o4), ""); - static_assert((o1 <= o5), ""); + static_assert ( (o1 <= o1), "" ); + static_assert ( (o1 <= o2), "" ); + static_assert ( (o1 <= o3), "" ); + static_assert ( (o1 <= o4), "" ); + static_assert ( (o1 <= o5), "" ); - static_assert((o2 <= o1), ""); - static_assert((o2 <= o2), ""); - static_assert((o2 <= o3), ""); - static_assert((o2 <= o4), ""); - static_assert((o2 <= o5), ""); + static_assert ( (o2 <= o1), "" ); + static_assert ( (o2 <= o2), "" ); + static_assert ( (o2 <= o3), "" ); + static_assert ( (o2 <= o4), "" ); + static_assert ( (o2 <= o5), "" ); - static_assert(!(o3 <= o1), ""); - static_assert(!(o3 <= o2), ""); - static_assert((o3 <= o3), ""); - static_assert((o3 <= o4), ""); - static_assert((o3 <= o5), ""); + static_assert ( !(o3 <= o1), "" ); + static_assert ( !(o3 <= o2), "" ); + static_assert ( (o3 <= o3), "" ); + static_assert ( (o3 <= o4), "" ); + static_assert ( (o3 <= o5), "" ); - static_assert(!(o4 <= o1), ""); - static_assert(!(o4 <= o2), ""); - static_assert(!(o4 <= o3), ""); - static_assert((o4 <= o4), ""); - static_assert(!(o4 <= o5), ""); + static_assert ( !(o4 <= o1), "" ); + static_assert ( !(o4 <= o2), "" ); + static_assert ( !(o4 <= o3), "" ); + static_assert ( (o4 <= o4), "" ); + static_assert ( !(o4 <= o5), "" ); - static_assert(!(o5 <= o1), ""); - static_assert(!(o5 <= o2), ""); - static_assert((o5 <= o3), ""); - static_assert((o5 <= o4), ""); - static_assert((o5 <= o5), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 <= O2(42), ""); - static_assert(!(O2(101) <= o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 <= O2(42), ""); - static_assert(!(O2(101) <= o1), ""); - } + static_assert ( !(o5 <= o1), "" ); + static_assert ( !(o5 <= o2), "" ); + static_assert ( (o5 <= o3), "" ); + static_assert ( (o5 <= o4), "" ); + static_assert ( (o5 <= o5), "" ); + } } diff --git a/test/std/utilities/optional/optional.relops/less_than.pass.cpp b/test/std/utilities/optional/optional.relops/less_than.pass.cpp index 1dbffbd92..deffa5e84 100644 --- a/test/std/utilities/optional/optional.relops/less_than.pass.cpp +++ b/test/std/utilities/optional/optional.relops/less_than.pass.cpp @@ -10,72 +10,61 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator< (const optional& x, const optional& y); +// template constexpr bool operator< (const optional& x, const optional& y); #include using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator<(const X& lhs, const X& rhs) { return lhs.i_ < rhs.i_; } +constexpr bool operator < ( const X &lhs, const X &rhs ) + { return lhs.i_ < rhs.i_ ; } -int main() { - { +int main() +{ + { typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert(!(o1 < o1), ""); - static_assert(!(o1 < o2), ""); - static_assert((o1 < o3), ""); - static_assert((o1 < o4), ""); - static_assert((o1 < o5), ""); + static_assert ( !(o1 < o1), "" ); + static_assert ( !(o1 < o2), "" ); + static_assert ( (o1 < o3), "" ); + static_assert ( (o1 < o4), "" ); + static_assert ( (o1 < o5), "" ); - static_assert(!(o2 < o1), ""); - static_assert(!(o2 < o2), ""); - static_assert((o2 < o3), ""); - static_assert((o2 < o4), ""); - static_assert((o2 < o5), ""); + static_assert ( !(o2 < o1), "" ); + static_assert ( !(o2 < o2), "" ); + static_assert ( (o2 < o3), "" ); + static_assert ( (o2 < o4), "" ); + static_assert ( (o2 < o5), "" ); - static_assert(!(o3 < o1), ""); - static_assert(!(o3 < o2), ""); - static_assert(!(o3 < o3), ""); - static_assert((o3 < o4), ""); - static_assert(!(o3 < o5), ""); + static_assert ( !(o3 < o1), "" ); + static_assert ( !(o3 < o2), "" ); + static_assert ( !(o3 < o3), "" ); + static_assert ( (o3 < o4), "" ); + static_assert ( !(o3 < o5), "" ); - static_assert(!(o4 < o1), ""); - static_assert(!(o4 < o2), ""); - static_assert(!(o4 < o3), ""); - static_assert(!(o4 < o4), ""); - static_assert(!(o4 < o5), ""); + static_assert ( !(o4 < o1), "" ); + static_assert ( !(o4 < o2), "" ); + static_assert ( !(o4 < o3), "" ); + static_assert ( !(o4 < o4), "" ); + static_assert ( !(o4 < o5), "" ); - static_assert(!(o5 < o1), ""); - static_assert(!(o5 < o2), ""); - static_assert(!(o5 < o3), ""); - static_assert((o5 < o4), ""); - static_assert(!(o5 < o5), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 < O2(101), ""); - static_assert(!(O2(101) < o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 < O2(101), ""); - static_assert(!(O2(101) < o1), ""); - } + static_assert ( !(o5 < o1), "" ); + static_assert ( !(o5 < o2), "" ); + static_assert ( !(o5 < o3), "" ); + static_assert ( (o5 < o4), "" ); + static_assert ( !(o5 < o5), "" ); + } } diff --git a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp index 12d9922a9..fd11b2a20 100644 --- a/test/std/utilities/optional/optional.relops/not_equal.pass.cpp +++ b/test/std/utilities/optional/optional.relops/not_equal.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template constexpr bool operator!=(const optional& x, const optional& y); +// template constexpr bool operator!=(const optional& x, const optional& y); #include #include @@ -18,69 +18,57 @@ using std::optional; -struct X { - int i_; +struct X +{ + int i_; - constexpr X(int i) : i_(i) {} + constexpr X(int i) : i_(i) {} }; -constexpr bool operator!=(const X& lhs, const X& rhs) { - return lhs.i_ != rhs.i_; -} +constexpr bool operator != ( const X &lhs, const X &rhs ) + { return lhs.i_ != rhs.i_ ; } -int main() { - { +int main() +{ + { typedef X T; typedef optional O; - constexpr O o1; // disengaged - constexpr O o2; // disengaged - constexpr O o3{1}; // engaged - constexpr O o4{2}; // engaged - constexpr O o5{1}; // engaged + constexpr O o1; // disengaged + constexpr O o2; // disengaged + constexpr O o3{1}; // engaged + constexpr O o4{2}; // engaged + constexpr O o5{1}; // engaged - static_assert(!(o1 != o1), ""); - static_assert(!(o1 != o2), ""); - static_assert((o1 != o3), ""); - static_assert((o1 != o4), ""); - static_assert((o1 != o5), ""); + static_assert ( !(o1 != o1), "" ); + static_assert ( !(o1 != o2), "" ); + static_assert ( (o1 != o3), "" ); + static_assert ( (o1 != o4), "" ); + static_assert ( (o1 != o5), "" ); - static_assert(!(o2 != o1), ""); - static_assert(!(o2 != o2), ""); - static_assert((o2 != o3), ""); - static_assert((o2 != o4), ""); - static_assert((o2 != o5), ""); + static_assert ( !(o2 != o1), "" ); + static_assert ( !(o2 != o2), "" ); + static_assert ( (o2 != o3), "" ); + static_assert ( (o2 != o4), "" ); + static_assert ( (o2 != o5), "" ); - static_assert((o3 != o1), ""); - static_assert((o3 != o2), ""); - static_assert(!(o3 != o3), ""); - static_assert((o3 != o4), ""); - static_assert(!(o3 != o5), ""); + static_assert ( (o3 != o1), "" ); + static_assert ( (o3 != o2), "" ); + static_assert ( !(o3 != o3), "" ); + static_assert ( (o3 != o4), "" ); + static_assert ( !(o3 != o5), "" ); - static_assert((o4 != o1), ""); - static_assert((o4 != o2), ""); - static_assert((o4 != o3), ""); - static_assert(!(o4 != o4), ""); - static_assert((o4 != o5), ""); + static_assert ( (o4 != o1), "" ); + static_assert ( (o4 != o2), "" ); + static_assert ( (o4 != o3), "" ); + static_assert ( !(o4 != o4), "" ); + static_assert ( (o4 != o5), "" ); - static_assert((o5 != o1), ""); - static_assert((o5 != o2), ""); - static_assert(!(o5 != o3), ""); - static_assert((o5 != o4), ""); - static_assert(!(o5 != o5), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 != O2(101), ""); - static_assert(!(O2(42) != o1), ""); - } - { - using O1 = optional; - using O2 = optional; - constexpr O1 o1(42); - static_assert(o1 != O2(101), ""); - static_assert(!(O2(42) != o1), ""); - } + static_assert ( (o5 != o1), "" ); + static_assert ( (o5 != o2), "" ); + static_assert ( !(o5 != o3), "" ); + static_assert ( (o5 != o4), "" ); + static_assert ( !(o5 != o5), "" ); + + } } diff --git a/test/std/utilities/smartptr/unique.ptr/README.TXT b/test/std/utilities/smartptr/unique.ptr/README.TXT deleted file mode 100644 index 20f77f618..000000000 --- a/test/std/utilities/smartptr/unique.ptr/README.TXT +++ /dev/null @@ -1,16 +0,0 @@ -Test Naming and Directory Structure -=================================== - -The directory structure for the unique_ptr class templates differs from the -normal test directory naming conventions (e.g. matching the stable name in the standard). - -Instead of having a [unique.ptr.single] and [unique.ptr.runtime] directory, -each containing their own tests, a single directory, "unique.ptr.class", -contains both sets of tests. - -This allows the common behavior of the two unique_ptr specializations to be -tested in the same place without duplication. - -Tests specific to [unique.ptr.single] have the suffix ".single.pass.cpp" -and those specific to [unique.ptr.runtime] are named "*.runtime.pass.cpp". -Tests for both specializations are named normally. diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp deleted file mode 100644 index 54c2cf16e..000000000 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/pointer_type.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// - -// unique_ptr - -// Test unique_ptr::pointer type - -#include -#include - -#include "test_macros.h" - -struct Deleter { - struct pointer {}; -}; - -struct D2 { -private: - typedef void pointer; -}; - -struct D3 { - static long pointer; -}; - -template -void test_basic() { - typedef typename std::conditional::type VT; - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), ""); - } - { - typedef std::unique_ptr P; - static_assert((std::is_same::value), - ""); - } -#if TEST_STD_VER >= 11 - { - typedef std::unique_ptr P; - static_assert(std::is_same::value, ""); - } - { - typedef std::unique_ptr P; - static_assert(std::is_same::value, ""); - } -#endif -} - -int main() { - test_basic(); - test_basic(); -} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp deleted file mode 100644 index 5d2f955aa..000000000 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp +++ /dev/null @@ -1,120 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// unique_ptr - -// Test unique_ptr move assignment - -// test move assignment. Should only require a MoveConstructible deleter, or if -// deleter is a reference, not even that. - -#include -#include -#include - -#include "deleter_types.h" -#include "unique_ptr_test_helper.h" - -struct GenericDeleter { - void operator()(void*) const; -}; - -template -void test_basic() { - typedef typename std::conditional::type VT; - const int expect_alive = IsArray ? 5 : 1; - { - std::unique_ptr s1(newValue(expect_alive)); - A* p = s1.get(); - std::unique_ptr s2(newValue(expect_alive)); - assert(A::count == (expect_alive * 2)); - s2 = std::move(s1); - assert(A::count == expect_alive); - assert(s2.get() == p); - assert(s1.get() == 0); - } - assert(A::count == 0); - { - std::unique_ptr > s1(newValue(expect_alive), - Deleter(5)); - A* p = s1.get(); - std::unique_ptr > s2(newValue(expect_alive)); - assert(A::count == (expect_alive * 2)); - s2 = std::move(s1); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(A::count == expect_alive); - assert(s2.get_deleter().state() == 5); - assert(s1.get_deleter().state() == 0); - } - assert(A::count == 0); - { - CDeleter d1(5); - std::unique_ptr&> s1(newValue(expect_alive), d1); - A* p = s1.get(); - CDeleter d2(6); - std::unique_ptr&> s2(newValue(expect_alive), d2); - s2 = std::move(s1); - assert(s2.get() == p); - assert(s1.get() == 0); - assert(A::count == expect_alive); - assert(d1.state() == 5); - assert(d2.state() == 5); - } - assert(A::count == 0); -} - -template -void test_sfinae() { - typedef typename std::conditional::type VT; - { - typedef std::unique_ptr U; - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(std::is_nothrow_assignable::value, ""); - } - { - typedef std::unique_ptr U; - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(std::is_nothrow_assignable::value, ""); - } - { - typedef std::unique_ptr&> U; - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(std::is_nothrow_assignable::value, ""); - } - { - typedef std::unique_ptr&> U; - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(!std::is_assignable::value, ""); - static_assert(std::is_nothrow_assignable::value, ""); - } -} - - -int main() { - { - test_basic(); - test_sfinae(); - } - { - test_basic(); - test_sfinae(); - } -} diff --git a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp b/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp deleted file mode 100644 index 8d83c3c88..000000000 --- a/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp +++ /dev/null @@ -1,420 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// - -// unique_ptr - -// Test unique_ptr converting move ctor - -#include -#include - -#include "test_macros.h" -#include "unique_ptr_test_helper.h" -#include "type_id.h" - -template -struct GenericDeleter { - void operator()(void*) const {} -}; - -template -struct GenericConvertingDeleter { - - template - GenericConvertingDeleter(GenericConvertingDeleter) {} - - template - GenericConvertingDeleter& operator=(GenericConvertingDeleter const&) { - return *this; - } - - void operator()(void*) const {} -}; - -template -using EnableIfNotSame = typename std::enable_if< - !std::is_same::type, typename std::decay::type>::value ->::type; - -template -struct is_specialization; - -template