Merge to upstream r226192.
Change-Id: Id459c8ce0d7dec371ff4d064ee2c71f6b7178e63
This commit is contained in:
@@ -1420,7 +1420,7 @@ protected:
|
||||
|
||||
// template <class charT> class numpunct_byname
|
||||
|
||||
template <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS numpunct_byname<char>
|
||||
|
||||
@@ -551,26 +551,26 @@ typedef enum memory_order
|
||||
|
||||
#if _GNUC_VER >= 407
|
||||
namespace __gcc_atomic {
|
||||
template <typename T>
|
||||
template <typename _Tp>
|
||||
struct __gcc_atomic_t {
|
||||
__gcc_atomic_t() _NOEXCEPT {}
|
||||
explicit __gcc_atomic_t(T value) _NOEXCEPT : __a_value(value) {}
|
||||
T __a_value;
|
||||
explicit __gcc_atomic_t(_Tp value) _NOEXCEPT : __a_value(value) {}
|
||||
_Tp __a_value;
|
||||
};
|
||||
#define _Atomic(x) __gcc_atomic::__gcc_atomic_t<x>
|
||||
|
||||
template <typename T> T __create();
|
||||
template <typename _Tp> _Tp __create();
|
||||
|
||||
template <typename __Tp, typename __Td>
|
||||
typename enable_if<sizeof(__Tp()->__a_value = __create<__Td>()), char>::type
|
||||
template <typename _Tp, typename _Td>
|
||||
typename enable_if<sizeof(_Tp()->__a_value = __create<_Td>()), char>::type
|
||||
__test_atomic_assignable(int);
|
||||
template <typename T, typename U>
|
||||
template <typename _Tp, typename _Up>
|
||||
__two __test_atomic_assignable(...);
|
||||
|
||||
template <typename __Tp, typename __Td>
|
||||
template <typename _Tp, typename _Td>
|
||||
struct __can_assign {
|
||||
static const bool value =
|
||||
sizeof(__test_atomic_assignable<__Tp, __Td>(1)) == sizeof(char);
|
||||
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
|
||||
};
|
||||
|
||||
static inline constexpr int __to_gcc_order(memory_order __order) {
|
||||
|
||||
@@ -120,6 +120,24 @@ inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {ret
|
||||
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||
#endif // putc
|
||||
|
||||
#ifdef clearerr
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
|
||||
#undef clearerr
|
||||
inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
|
||||
#endif // clearerr
|
||||
|
||||
#ifdef feof
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
|
||||
#undef feof
|
||||
inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
|
||||
#endif // feof
|
||||
|
||||
#ifdef ferror
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
|
||||
#undef ferror
|
||||
inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
|
||||
#endif // ferror
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::FILE;
|
||||
|
||||
@@ -2608,9 +2608,7 @@ public:
|
||||
assign(_ForwardIterator __first, _ForwardIterator __last,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
{
|
||||
__member_init(__f);
|
||||
__parse(__first, __last);
|
||||
return *this;
|
||||
return assign(basic_regex(__first, __last, __f));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
@@ -1433,11 +1433,11 @@ template <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Up = void, class V = void>
|
||||
template <class _Tp, class _Up = void, class _Vp = void>
|
||||
struct _LIBCPP_TYPE_VIS_ONLY common_type
|
||||
{
|
||||
public:
|
||||
typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type;
|
||||
typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
|
||||
@@ -23,6 +23,9 @@ if(PYTHONINTERP_FOUND)
|
||||
set(LIT_ARGS "${LLVM_LIT_ARGS}")
|
||||
separate_arguments(LIT_ARGS)
|
||||
|
||||
set(LIBCXX_LIT_VARIANT "libcxx" CACHE STRING
|
||||
"Configuration variant to use for LIT.")
|
||||
|
||||
pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
|
||||
pythonize_bool(LIBCXX_ENABLE_RTTI)
|
||||
pythonize_bool(LIBCXX_ENABLE_SHARED)
|
||||
|
||||
@@ -17,13 +17,13 @@ class Configuration(object):
|
||||
self.lit_config = lit_config
|
||||
self.config = config
|
||||
self.cxx = None
|
||||
self.src_root = None
|
||||
self.libcxx_src_root = None
|
||||
self.obj_root = None
|
||||
self.library_root = None
|
||||
self.cxx_library_root = None
|
||||
self.env = {}
|
||||
self.compile_flags = []
|
||||
self.link_flags = []
|
||||
self.use_system_lib = False
|
||||
self.use_system_cxx_lib = False
|
||||
self.use_clang_verify = False
|
||||
self.use_ccache = False
|
||||
self.long_tests = None
|
||||
@@ -56,8 +56,8 @@ class Configuration(object):
|
||||
self.configure_triple()
|
||||
self.configure_src_root()
|
||||
self.configure_obj_root()
|
||||
self.configure_library_root()
|
||||
self.configure_use_system_lib()
|
||||
self.configure_cxx_library_root()
|
||||
self.configure_use_system_cxx_lib()
|
||||
self.configure_use_clang_verify()
|
||||
self.configure_ccache()
|
||||
self.configure_env()
|
||||
@@ -137,27 +137,28 @@ class Configuration(object):
|
||||
compiler_name, major_ver, minor_ver))
|
||||
|
||||
def configure_src_root(self):
|
||||
self.src_root = self.get_lit_conf(
|
||||
self.libcxx_src_root = self.get_lit_conf(
|
||||
'libcxx_src_root', os.path.dirname(self.config.test_source_root))
|
||||
|
||||
def configure_obj_root(self):
|
||||
self.obj_root = self.get_lit_conf('libcxx_obj_root', self.src_root)
|
||||
self.obj_root = self.get_lit_conf('libcxx_obj_root',
|
||||
self.libcxx_src_root)
|
||||
|
||||
def configure_library_root(self):
|
||||
self.library_root = self.get_lit_conf('libcxx_library_root',
|
||||
self.obj_root)
|
||||
def configure_cxx_library_root(self):
|
||||
self.cxx_library_root = self.get_lit_conf('cxx_library_root',
|
||||
self.obj_root)
|
||||
|
||||
def configure_use_system_lib(self):
|
||||
def configure_use_system_cxx_lib(self):
|
||||
# This test suite supports testing against either the system library or
|
||||
# the locally built one; the former mode is useful for testing ABI
|
||||
# compatibility between the current headers and a shipping dynamic
|
||||
# library.
|
||||
self.use_system_lib = self.get_lit_bool('use_system_lib')
|
||||
if self.use_system_lib is None:
|
||||
self.use_system_cxx_lib = self.get_lit_bool('use_system_cxx_lib')
|
||||
if self.use_system_cxx_lib is None:
|
||||
# Default to testing against the locally built libc++ library.
|
||||
self.use_system_lib = False
|
||||
self.use_system_cxx_lib = False
|
||||
self.lit_config.note(
|
||||
"inferred use_system_lib as: %r" % self.use_system_lib)
|
||||
"inferred use_system_cxx_lib as: %r" % self.use_system_cxx_lib)
|
||||
|
||||
def configure_use_clang_verify(self):
|
||||
'''If set, run clang with -verify on failing tests.'''
|
||||
@@ -228,12 +229,12 @@ class Configuration(object):
|
||||
locale.setlocale(locale.LC_ALL, default_locale)
|
||||
|
||||
# Write an "available feature" that combines the triple when
|
||||
# use_system_lib is enabled. This is so that we can easily write XFAIL
|
||||
# use_system_cxx_lib is enabled. This is so that we can easily write XFAIL
|
||||
# markers for tests that are known to fail with versions of libc++ as
|
||||
# were shipped with a particular triple.
|
||||
if self.use_system_lib:
|
||||
if self.use_system_cxx_lib:
|
||||
self.config.available_features.add(
|
||||
'with_system_lib=%s' % self.config.target_triple)
|
||||
'with_system_cxx_lib=%s' % self.config.target_triple)
|
||||
|
||||
# Some linux distributions have different locale data than others.
|
||||
# Insert the distributions name and name-version into the available
|
||||
@@ -268,28 +269,14 @@ class Configuration(object):
|
||||
self.config.available_features.add(std)
|
||||
# Configure include paths
|
||||
self.compile_flags += ['-nostdinc++']
|
||||
self.compile_flags += ['-I' + self.src_root + '/test/support']
|
||||
libcxx_headers = self.get_lit_conf('libcxx_headers',
|
||||
self.src_root + '/include')
|
||||
if not os.path.isdir(libcxx_headers):
|
||||
self.lit_config.fatal("libcxx_headers='%s' is not a directory."
|
||||
% libcxx_headers)
|
||||
self.compile_flags += ['-I' + libcxx_headers]
|
||||
self.configure_compile_flags_header_includes()
|
||||
if sys.platform.startswith('linux'):
|
||||
self.compile_flags += ['-D__STDC_FORMAT_MACROS',
|
||||
'-D__STDC_LIMIT_MACROS',
|
||||
'-D__STDC_CONSTANT_MACROS']
|
||||
# Configure feature flags.
|
||||
enable_exceptions = self.get_lit_bool('enable_exceptions', True)
|
||||
if enable_exceptions:
|
||||
self.config.available_features.add('exceptions')
|
||||
else:
|
||||
self.compile_flags += ['-fno-exceptions']
|
||||
enable_rtti = self.get_lit_bool('enable_rtti', True)
|
||||
if enable_rtti:
|
||||
self.config.available_features.add('rtti')
|
||||
else:
|
||||
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
||||
self.configure_compile_flags_exceptions()
|
||||
self.configure_compile_flags_rtti()
|
||||
enable_32bit = self.get_lit_bool('enable_32bit', False)
|
||||
if enable_32bit:
|
||||
self.compile_flags += ['-m32']
|
||||
@@ -298,12 +285,9 @@ class Configuration(object):
|
||||
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock',
|
||||
True)
|
||||
if not enable_threads:
|
||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
|
||||
self.config.available_features.add('libcpp-has-no-threads')
|
||||
self.configure_compile_flags_no_threads()
|
||||
if not enable_monotonic_clock:
|
||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
|
||||
self.config.available_features.add(
|
||||
'libcpp-has-no-monotonic-clock')
|
||||
self.configure_compile_flags_no_monotonic_clock()
|
||||
elif not enable_monotonic_clock:
|
||||
self.lit_config.fatal('enable_monotonic_clock cannot be false when'
|
||||
' enable_threads is true.')
|
||||
@@ -313,8 +297,53 @@ class Configuration(object):
|
||||
compile_flags_str = self.get_lit_conf('compile_flags', '')
|
||||
self.compile_flags += shlex.split(compile_flags_str)
|
||||
|
||||
def configure_compile_flags_header_includes(self):
|
||||
self.compile_flags += ['-I' + self.libcxx_src_root + '/test/support']
|
||||
libcxx_headers = self.get_lit_conf('libcxx_headers',
|
||||
self.libcxx_src_root + '/include')
|
||||
if not os.path.isdir(libcxx_headers):
|
||||
self.lit_config.fatal("libcxx_headers='%s' is not a directory."
|
||||
% libcxx_headers)
|
||||
self.compile_flags += ['-I' + libcxx_headers]
|
||||
|
||||
def configure_compile_flags_exceptions(self):
|
||||
enable_exceptions = self.get_lit_bool('enable_exceptions', True)
|
||||
if enable_exceptions:
|
||||
self.config.available_features.add('exceptions')
|
||||
else:
|
||||
self.compile_flags += ['-fno-exceptions']
|
||||
|
||||
def configure_compile_flags_rtti(self):
|
||||
enable_rtti = self.get_lit_bool('enable_rtti', True)
|
||||
if enable_rtti:
|
||||
self.config.available_features.add('rtti')
|
||||
else:
|
||||
self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
|
||||
|
||||
def configure_compile_flags_no_threads(self):
|
||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
|
||||
self.config.available_features.add('libcpp-has-no-threads')
|
||||
|
||||
def configure_compile_flags_no_monotonic_clock(self):
|
||||
self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
|
||||
self.config.available_features.add('libcpp-has-no-monotonic-clock')
|
||||
|
||||
def configure_link_flags(self):
|
||||
self.link_flags += ['-nodefaultlibs']
|
||||
|
||||
# Configure library path
|
||||
self.configure_link_flags_cxx_library_path()
|
||||
self.configure_link_flags_abi_library_path()
|
||||
|
||||
# Configure libraries
|
||||
self.configure_link_flags_cxx_library()
|
||||
self.configure_link_flags_abi_library()
|
||||
self.configure_extra_library_flags()
|
||||
|
||||
link_flags_str = self.get_lit_conf('link_flags', '')
|
||||
self.link_flags += shlex.split(link_flags_str)
|
||||
|
||||
def configure_link_flags_cxx_library_path(self):
|
||||
libcxx_library = self.get_lit_conf('libcxx_library')
|
||||
# Configure libc++ library paths.
|
||||
if libcxx_library is not None:
|
||||
@@ -323,25 +352,31 @@ class Configuration(object):
|
||||
self.lit_config.fatal(
|
||||
"libcxx_library='%s' is not a valid file." %
|
||||
libcxx_library)
|
||||
if self.use_system_lib:
|
||||
if self.use_system_cxx_lib:
|
||||
self.lit_config.fatal(
|
||||
"Conflicting options: 'libcxx_library' cannot be used "
|
||||
"with 'use_system_lib=true'")
|
||||
"with 'use_system_cxx_lib=true'")
|
||||
self.link_flags += ['-Wl,-rpath,' +
|
||||
os.path.dirname(libcxx_library)]
|
||||
elif not self.use_system_lib:
|
||||
self.link_flags += ['-L' + self.library_root,
|
||||
'-Wl,-rpath,' + self.library_root]
|
||||
elif not self.use_system_cxx_lib:
|
||||
self.link_flags += ['-L' + self.cxx_library_root,
|
||||
'-Wl,-rpath,' + self.cxx_library_root]
|
||||
|
||||
def configure_link_flags_abi_library_path(self):
|
||||
# Configure ABI library paths.
|
||||
abi_library_path = self.get_lit_conf('abi_library_path', '')
|
||||
if abi_library_path:
|
||||
self.link_flags += ['-L' + abi_library_path,
|
||||
'-Wl,-rpath,' + abi_library_path]
|
||||
# Configure libraries
|
||||
|
||||
def configure_link_flags_cxx_library(self):
|
||||
libcxx_library = self.get_lit_conf('libcxx_library')
|
||||
if libcxx_library:
|
||||
self.link_flags += [libcxx_library]
|
||||
else:
|
||||
self.link_flags += ['-lc++']
|
||||
|
||||
def configure_link_flags_abi_library(self):
|
||||
cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
|
||||
if cxx_abi == 'libstdc++':
|
||||
self.link_flags += ['-lstdc++']
|
||||
@@ -356,20 +391,28 @@ class Configuration(object):
|
||||
else:
|
||||
self.lit_config.fatal(
|
||||
'C++ ABI setting %s unsupported for tests' % cxx_abi)
|
||||
# Configure extra libraries.
|
||||
|
||||
def configure_extra_library_flags(self):
|
||||
enable_threads = self.get_lit_bool('enable_threads', True)
|
||||
llvm_unwinder = self.get_lit_conf('llvm_unwinder', False)
|
||||
if sys.platform == 'darwin':
|
||||
self.link_flags += ['-lSystem']
|
||||
elif sys.platform.startswith('linux'):
|
||||
self.link_flags += ['-lgcc_eh', '-lc', '-lm', '-lpthread',
|
||||
'-lrt', '-lgcc_s']
|
||||
if not llvm_unwinder:
|
||||
self.link_flags += ['-lgcc_eh']
|
||||
self.link_flags += ['-lc', '-lm']
|
||||
if enable_threads:
|
||||
self.link_flags += ['-lpthread']
|
||||
self.link_flags += ['-lrt']
|
||||
if llvm_unwinder:
|
||||
self.link_flags += ['-lunwind', '-ldl']
|
||||
else:
|
||||
self.link_flags += ['-lgcc_s']
|
||||
elif sys.platform.startswith('freebsd'):
|
||||
self.link_flags += ['-lc', '-lm', '-pthread', '-lgcc_s']
|
||||
else:
|
||||
self.lit_config.fatal("unrecognized system: %r" % sys.platform)
|
||||
|
||||
link_flags_str = self.get_lit_conf('link_flags', '')
|
||||
self.link_flags += shlex.split(link_flags_str)
|
||||
|
||||
def configure_sanitizer(self):
|
||||
san = self.get_lit_conf('use_sanitizer', '').strip()
|
||||
if san:
|
||||
@@ -409,7 +452,7 @@ class Configuration(object):
|
||||
self.config.available_features.add('tsan')
|
||||
else:
|
||||
self.lit_config.fatal('unsupported value for '
|
||||
'libcxx_use_san: {0}'.format(san))
|
||||
'use_sanitizer: {0}'.format(san))
|
||||
|
||||
def configure_triple(self):
|
||||
# Get or infer the target triple.
|
||||
@@ -437,10 +480,10 @@ class Configuration(object):
|
||||
"inferred target_triple as: %r" % self.config.target_triple)
|
||||
|
||||
def configure_env(self):
|
||||
if sys.platform == 'darwin' and not self.use_system_lib:
|
||||
if sys.platform == 'darwin' and not self.use_system_cxx_lib:
|
||||
libcxx_library = self.get_lit_conf('libcxx_library')
|
||||
if libcxx_library:
|
||||
library_root = os.path.dirname(libcxx_library)
|
||||
cxx_library_root = os.path.dirname(libcxx_library)
|
||||
else:
|
||||
library_root = self.library_root
|
||||
self.env['DYLD_LIBRARY_PATH'] = library_root
|
||||
cxx_library_root = self.cxx_library_root
|
||||
self.env['DYLD_LIBRARY_PATH'] = cxx_library_root
|
||||
|
||||
@@ -3,7 +3,7 @@ config.cxx_under_test = "@LIBCXX_COMPILER@"
|
||||
config.std = "@LIBCXX_STD_VERSION@"
|
||||
config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
|
||||
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
|
||||
config.libcxx_library_root = "@LIBCXX_LIBRARY_DIR@"
|
||||
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
|
||||
config.enable_exceptions = "@LIBCXX_ENABLE_EXCEPTIONS@"
|
||||
config.enable_rtti = "@LIBCXX_ENABLE_RTTI@"
|
||||
config.enable_shared = "@LIBCXX_ENABLE_SHARED@"
|
||||
@@ -13,6 +13,7 @@ config.enable_monotonic_clock = "@LIBCXX_ENABLE_MONOTONIC_CLOCK@"
|
||||
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
|
||||
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
|
||||
config.abi_library_path = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
|
||||
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
|
||||
|
||||
# Let the main config do the real work.
|
||||
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
|
||||
@@ -29,8 +29,9 @@ int main()
|
||||
{
|
||||
typedef std::vector<bool> T;
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
H>::value), "");
|
||||
static_assert((std::is_same<H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
|
||||
|
||||
bool ba[] = {true, false, true, true, false};
|
||||
T vb(std::begin(ba), std::end(ba));
|
||||
H h;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// iterator erase(const_iterator position);
|
||||
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// iterator erase(const_iterator first, const_iterator last);
|
||||
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// void swap(vector<T,Alloc>& x, vector<T,Alloc>& y);
|
||||
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <cassert>
|
||||
#include "test_allocator.h"
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// test <stdint.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
#include <csignal>
|
||||
#include <cwctype>
|
||||
#include <climits>
|
||||
|
||||
@@ -27,8 +27,8 @@ test(int i)
|
||||
{
|
||||
typedef std::error_code T;
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
H>::value), "");
|
||||
static_assert((std::is_same<H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
T ec(i, std::system_category());
|
||||
assert(h(ec) == i);
|
||||
|
||||
@@ -29,8 +29,8 @@ void
|
||||
test()
|
||||
{
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
H>::value), "");
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
// std::string g1 = "1234567890";
|
||||
// std::string g2 = "1234567891";
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
std::experimental::erased_type e();
|
||||
std::experimental::erased_type e;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <iterator>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// test <cstdint>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <cwchar>
|
||||
#include <csignal>
|
||||
#include <cwctype>
|
||||
#include <climits>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
//
|
||||
// This test uses new symbols that were not defined in the libc++ shipped on
|
||||
// darwin11 and darwin12:
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <locale>
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
// charT tolower(charT) const;
|
||||
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
// XFAIL: linux
|
||||
|
||||
#include <locale>
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
// const charT* tolower(charT* low, const charT* high) const;
|
||||
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
// XFAIL: linux
|
||||
|
||||
#include <locale>
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
// charT toupper(charT) const;
|
||||
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
// XFAIL: linux
|
||||
|
||||
#include <locale>
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
// const charT* toupper(charT* low, const charT* high) const;
|
||||
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
// XFAIL: linux
|
||||
|
||||
#include <locale>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
//
|
||||
// This test uses new symbols that were not defined in the libc++ shipped on
|
||||
// darwin11 and darwin12:
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <locale>
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// XFAIL: android
|
||||
|
||||
// <locale>
|
||||
|
||||
// class num_put<charT, OutputIterator>
|
||||
@@ -15,7 +17,6 @@
|
||||
|
||||
// TODO GLIBC uses a different string for positive and negative NAN numbers.
|
||||
// XFAIL: linux-gnu
|
||||
// XFAIL: android
|
||||
|
||||
#include <locale>
|
||||
#include <ios>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <locale>
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
//
|
||||
// This test uses new symbols that were not defined in the libc++ shipped on
|
||||
// darwin11 and darwin12:
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <locale>
|
||||
|
||||
|
||||
@@ -23,4 +23,13 @@ int main()
|
||||
r2.assign(r1);
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
assert(std::regex_search("ab", r2));
|
||||
|
||||
bool caught = false;
|
||||
try { r2.assign("(def", std::regex::extended); }
|
||||
catch(std::regex_error &) { caught = true; }
|
||||
assert(caught);
|
||||
assert(r2.flags() == std::regex::ECMAScript);
|
||||
assert(r2.mark_count() == 2);
|
||||
assert(std::regex_search("ab", r2));
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
// REQUIRES: locale.en_US.UTF-8
|
||||
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// TODO: investigation needed
|
||||
// XFAIL: linux-gnu
|
||||
|
||||
@@ -27,8 +27,8 @@ void
|
||||
test()
|
||||
{
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
H>::value), "");
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
std::string g1 = "1234567890";
|
||||
std::string g2 = "1234567891";
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// assign(basic_string<charT,traits>&& str);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// operator+(charT lhs, basic_string<charT,traits,Allocator>&& rhs);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// operator+(const charT* lhs, basic_string<charT,traits,Allocator>&& rhs);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// operator+(basic_string<charT,traits,Allocator>&& lhs, charT rhs);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// operator+(basic_string<charT,traits,Allocator>&& lhs, const charT* rhs);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// const basic_string<charT,traits,Allocator>&& rhs);
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "min_allocator.h"
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <string>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <string>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <string>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <string>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
|
||||
|
||||
// <string>
|
||||
|
||||
|
||||
@@ -12,9 +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_lib=x86_64-apple-darwin11
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin12
|
||||
// XFAIL: with_system_lib=x86_64-apple-darwin13
|
||||
// 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
|
||||
|
||||
// <future>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <climits>
|
||||
|
||||
@@ -28,6 +28,8 @@ int main()
|
||||
std::thread::id id1;
|
||||
std::thread::id id2 = std::this_thread::get_id();
|
||||
typedef std::hash<std::thread::id> H;
|
||||
static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
assert(h(id1) != h(id2));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <scoped_allocator>
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::divides<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(36, 4) == 9);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::divides<> F2;
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::minus<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(3, 2) == 1);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::minus<> F2;
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::modulus<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(36, 8) == 4);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::modulus<> F2;
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::multiplies<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(3, 2) == 6);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::multiplies<> F2;
|
||||
|
||||
@@ -19,7 +19,8 @@ int main()
|
||||
{
|
||||
typedef std::negate<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, int>::value), "" );
|
||||
assert(f(36) == -36);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::negate<> F2;
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::plus<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(3, 2) == 5);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::plus<> F2;
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::bit_and<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(0xEA95, 0xEA95) == 0xEA95);
|
||||
assert(f(0xEA95, 0x58D3) == 0x4891);
|
||||
assert(f(0x58D3, 0xEA95) == 0x4891);
|
||||
|
||||
@@ -20,7 +20,8 @@ int main()
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
typedef std::bit_not<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, int>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, int>::value), "" );
|
||||
assert((f(0xEA95) & 0xFFFF ) == 0x156A);
|
||||
assert((f(0x58D3) & 0xFFFF ) == 0xA72C);
|
||||
assert((f(0) & 0xFFFF ) == 0xFFFF);
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::bit_or<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(0xEA95, 0xEA95) == 0xEA95);
|
||||
assert(f(0xEA95, 0x58D3) == 0xFAD7);
|
||||
assert(f(0x58D3, 0xEA95) == 0xFAD7);
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::bit_xor<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, int>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::result_type>::value), "" );
|
||||
assert(f(0xEA95, 0xEA95) == 0);
|
||||
assert(f(0xEA95, 0x58D3) == 0xB246);
|
||||
assert(f(0x58D3, 0xEA95) == 0xB246);
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::equal_to<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(f(36, 36));
|
||||
assert(!f(36, 6));
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::greater<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(!f(36, 36));
|
||||
assert(f(36, 6));
|
||||
assert(!f(6, 36));
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::greater_equal<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(f(36, 36));
|
||||
assert(f(36, 6));
|
||||
assert(!f(6, 36));
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::less<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(!f(36, 36));
|
||||
assert(!f(36, 6));
|
||||
assert(f(6, 36));
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::less_equal<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(f(36, 36));
|
||||
assert(!f(36, 6));
|
||||
assert(f(6, 36));
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::not_equal_to<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(!f(36, 36));
|
||||
assert(f(36, 6));
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
@@ -10,40 +10,99 @@
|
||||
// <functional>
|
||||
|
||||
// template<Returnable R, CopyConstructible... ArgTypes>
|
||||
// class function<R(ArgTypes...)>
|
||||
// : public unary_function<T1, R> // iff sizeof...(ArgTypes) == 1 and
|
||||
// // ArgTypes contains T1
|
||||
// : public binary_function<T1, T2, R> // iff sizeof...(ArgTypes) == 2 and
|
||||
// // ArgTypes contains T1 and T2
|
||||
// {
|
||||
// class function<R(ArgTypes...)> {
|
||||
// public:
|
||||
// typedef R result_type;
|
||||
// ...
|
||||
// };
|
||||
// typedef R result_type;
|
||||
// typedef T1 argument_type; // iff sizeof...(ArgTypes) == 1 and
|
||||
// // the type in ArgTypes is T1
|
||||
// typedef T1 first_argument_type; // iff sizeof...(ArgTypes) == 2 and
|
||||
// // ArgTypes contains T1 and T2
|
||||
// typedef T2 second_argument_type; // iff sizeof...(ArgTypes) == 2 and
|
||||
// // ArgTypes contains T1 and T2
|
||||
// ...
|
||||
// };
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
template <typename T>
|
||||
class has_argument_type
|
||||
{
|
||||
typedef char yes;
|
||||
typedef long no;
|
||||
|
||||
template <typename C> static yes check( typename C::argument_type * );
|
||||
template <typename C> static no check(...);
|
||||
public:
|
||||
enum { value = sizeof(check<T>(0)) == sizeof(yes) };
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class has_first_argument_type
|
||||
{
|
||||
typedef char yes;
|
||||
typedef long no;
|
||||
|
||||
template <typename C> static yes check( typename C::first_argument_type * );
|
||||
template <typename C> static no check(...);
|
||||
public:
|
||||
enum { value = sizeof(check<T>(0)) == sizeof(yes) };
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
class has_second_argument_type
|
||||
{
|
||||
typedef char yes;
|
||||
typedef long no;
|
||||
|
||||
template <typename C> static yes check( typename C::second_argument_type *);
|
||||
template <typename C> static no check(...);
|
||||
public:
|
||||
enum { value = sizeof(check<T>(0)) == sizeof(yes) };
|
||||
};
|
||||
|
||||
template <class F, class return_type>
|
||||
void test_nullary_function ()
|
||||
{
|
||||
static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
|
||||
static_assert((!has_argument_type<F>::value), "" );
|
||||
static_assert((!has_first_argument_type<F>::value), "" );
|
||||
static_assert((!has_second_argument_type<F>::value), "" );
|
||||
}
|
||||
|
||||
template <class F, class return_type, class arg_type>
|
||||
void test_unary_function ()
|
||||
{
|
||||
static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
|
||||
static_assert((std::is_same<typename F::argument_type, arg_type>::value), "" );
|
||||
static_assert((!has_first_argument_type<F>::value), "" );
|
||||
static_assert((!has_second_argument_type<F>::value), "" );
|
||||
}
|
||||
|
||||
template <class F, class return_type, class arg_type1, class arg_type2>
|
||||
void test_binary_function ()
|
||||
{
|
||||
static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
|
||||
static_assert((std::is_same<typename F::first_argument_type, arg_type1>::value), "" );
|
||||
static_assert((std::is_same<typename F::second_argument_type, arg_type2>::value), "" );
|
||||
static_assert((!has_argument_type<F>::value), "" );
|
||||
}
|
||||
|
||||
template <class F, class return_type>
|
||||
void test_other_function ()
|
||||
{
|
||||
static_assert((std::is_same<typename F::result_type, return_type>::value), "" );
|
||||
static_assert((!has_argument_type<F>::value), "" );
|
||||
static_assert((!has_first_argument_type<F>::value), "" );
|
||||
static_assert((!has_second_argument_type<F>::value), "" );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((!std::is_base_of<std::unary_function <int, int>,
|
||||
std::function<int()> >::value), "");
|
||||
static_assert((!std::is_base_of<std::binary_function<int, int, int>,
|
||||
std::function<int()> >::value), "");
|
||||
static_assert(( std::is_same< std::function<int()>::result_type,
|
||||
int>::value), "");
|
||||
|
||||
static_assert(( std::is_base_of<std::unary_function <int, double>,
|
||||
std::function<double(int)> >::value), "");
|
||||
static_assert((!std::is_base_of<std::binary_function<int, int, double>,
|
||||
std::function<double(int)> >::value), "");
|
||||
static_assert(( std::is_same< std::function<double(int)>::result_type,
|
||||
double>::value), "");
|
||||
|
||||
static_assert((!std::is_base_of<std::unary_function <int, double>,
|
||||
std::function<double(int, char)> >::value), "");
|
||||
static_assert(( std::is_base_of<std::binary_function<int, char, double>,
|
||||
std::function<double(int, char)> >::value), "");
|
||||
static_assert(( std::is_same< std::function<double(int, char)>::result_type,
|
||||
double>::value), "");
|
||||
test_nullary_function<std::function<int()>, int>();
|
||||
test_unary_function <std::function<double(int)>, double, int>();
|
||||
test_binary_function <std::function<double(int, char)>, double, int, char>();
|
||||
test_other_function <std::function<double(int, char, double)>, double>();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::logical_and<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(f(36, 36));
|
||||
assert(!f(36, 0));
|
||||
assert(!f(0, 36));
|
||||
|
||||
@@ -19,7 +19,8 @@ int main()
|
||||
{
|
||||
typedef std::logical_not<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, bool>::value), "" );
|
||||
assert(!f(36));
|
||||
assert(f(0));
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::logical_or<int> F;
|
||||
const F f = F();
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(f(36, 36));
|
||||
assert(f(36, 0));
|
||||
assert(f(0, 36));
|
||||
|
||||
@@ -19,7 +19,9 @@ int main()
|
||||
{
|
||||
typedef std::binary_negate<std::logical_and<int> > F;
|
||||
const F f = F(std::logical_and<int>());
|
||||
static_assert((std::is_base_of<std::binary_function<int, int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<int, F::first_argument_type>::value), "" );
|
||||
static_assert((std::is_same<int, F::second_argument_type>::value), "" );
|
||||
static_assert((std::is_same<bool, F::result_type>::value), "" );
|
||||
assert(!f(36, 36));
|
||||
assert( f(36, 0));
|
||||
assert( f(0, 36));
|
||||
|
||||
@@ -19,7 +19,8 @@ int main()
|
||||
{
|
||||
typedef std::unary_negate<std::logical_not<int> > F;
|
||||
const F f = F(std::logical_not<int>());
|
||||
static_assert((std::is_base_of<std::unary_function<int, bool>, F>::value), "");
|
||||
static_assert((std::is_same<F::argument_type, int>::value), "" );
|
||||
static_assert((std::is_same<F::result_type, bool>::value), "" );
|
||||
assert(f(36));
|
||||
assert(!f(0));
|
||||
}
|
||||
|
||||
@@ -33,11 +33,12 @@ template <class T>
|
||||
void
|
||||
test()
|
||||
{
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
std::hash<T> >::value), "");
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
typedef typename std::underlying_type<T>::type under_type;
|
||||
|
||||
std::hash<T> h1;
|
||||
H h1;
|
||||
std::hash<under_type> h2;
|
||||
for (int i = 0; i <= 5; ++i)
|
||||
{
|
||||
|
||||
@@ -28,9 +28,11 @@ template <class T>
|
||||
void
|
||||
test()
|
||||
{
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
std::hash<T> >::value), "");
|
||||
std::hash<T> h;
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
|
||||
std::size_t t0 = h(0.);
|
||||
std::size_t tn0 = h(-0.);
|
||||
std::size_t tp1 = h(0.1);
|
||||
|
||||
@@ -27,9 +27,11 @@ template <class T>
|
||||
void
|
||||
test()
|
||||
{
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
std::hash<T> >::value), "");
|
||||
std::hash<T> h;
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
|
||||
for (int i = 0; i <= 5; ++i)
|
||||
{
|
||||
T t(i);
|
||||
|
||||
@@ -27,9 +27,11 @@ template <class T>
|
||||
void
|
||||
test()
|
||||
{
|
||||
static_assert((std::is_base_of<std::unary_function<T, std::size_t>,
|
||||
std::hash<T> >::value), "");
|
||||
std::hash<T> h;
|
||||
typedef std::hash<T> H;
|
||||
static_assert((std::is_same<typename H::argument_type, T>::value), "" );
|
||||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
|
||||
typedef typename std::remove_pointer<T>::type type;
|
||||
type i;
|
||||
type j;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define DELETER_H
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't copy from lvalue
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// deleter is a reference, not even that.
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't copy from const lvalue
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't copy from lvalue
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr move ctor
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// test move ctor. Can't copy from const lvalue
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't assign from lvalue
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't assign from const lvalue
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from const lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from const lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
struct A
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// test converting move assignment with reference deleters
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../deleter.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// deleter is a reference, not even that.
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// deleter is a reference, not even that.
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't assign from lvalue
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
struct A
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// test converting move assignment with reference deleters
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr converting move assignment
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// Can't assign from const lvalue
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from const lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Can't assign from const lvalue
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../deleter.h"
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Do not convert from an array unique_ptr
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
struct A
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// Test unique_ptr(pointer) ctor
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <cassert>
|
||||
|
||||
// template <class U> explicit unique_ptr(auto_ptr<U>&);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user