summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
Commit message (Collapse)AuthorAgeFilesLines
...
* Include what we use, instead of letting them get pulled in implictly. This ↵Marshall Clow2015-07-163-0/+5
| | | | | | makes the tests work on VS. Thanks to STL for the report llvm-svn: 242454
* Make sure that __libcpp_compressed_pair_imp default-constructs its' members, ↵Marshall Clow2015-07-161-0/+16
| | | | | | rather than value-initializing them. Fixes PR#24137 llvm-svn: 242377
* Remove non-ascii charactersEric Fiselier2015-07-141-5/+5
| | | | llvm-svn: 242197
* Implement n4169 - Add invoke function templateEric Fiselier2015-07-141-0/+268
| | | | llvm-svn: 242195
* [libcxx] LWG2420 bits for bind<void> - Patch from K-BalloEric Fiselier2015-07-101-3/+16
| | | | | | | Implemented LWG2420 bits for bind<void> Review: http://reviews.llvm.org/D10997 llvm-svn: 241967
* Automatically detect and use clang verify in failure tests.Eric Fiselier2015-07-061-1/+0
| | | | | | | | | Automatically enable clang verify whenever the '-verify-ignore-unexpected' flag is supported. Failure tests are run using verify if they contain one or more "expected-*" diagnostics tags. Otherwise they are run normally. llvm-svn: 241492
* Noticed that std::allocator<const T> was missing the definition for ↵Marshall Clow2015-07-012-0/+9
| | | | | | is_always_equal. Fixed this, and added a test for it. llvm-svn: 241190
* Make support for thread-unsafe C functions optional.Ed Schouten2015-06-244-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | One of the aspects of CloudABI is that it aims to help you write code that is thread-safe out of the box. This is very important if you want to write libraries that are easy to reuse. For CloudABI we decided to not provide the thread-unsafe functions. So far this is working out pretty well, as thread-unsafety issues are detected really early on. The following patch adds a knob to libc++, _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS, that can be set to disable thread-unsafe functions that can easily be avoided in practice. The following functions are not thread-safe: - <clocale>: locale handles should be preferred over setlocale(). - <cstdlib>: mbrlen(), mbrtowc() and wcrtomb() should be preferred over their non-restartable counterparts. - <ctime>: asctime(), ctime(), gmtime() and localtime() are not thread-safe. The first two are also deprecated by POSIX. Differential Revision: http://reviews.llvm.org/D8703 Reviewed by: marshall llvm-svn: 240527
* Fix PR#18843. Thanks to Howard for the fixMarshall Clow2015-06-191-0/+4
| | | | llvm-svn: 240136
* Fix std::function allocator constructors in C++03.Eric Fiselier2015-06-143-119/+206
| | | | | | | | | The C++03 version of function tried to default construct the allocator in the uses allocator constructors when no allocation was performed. These constructors would fail to compile when used with allocators that had no default constructor. llvm-svn: 239708
* Cleanup result_of tests and fix issues with the C++03 result_of.Eric Fiselier2015-06-132-61/+306
| | | | | | | | | | The two main fixes this patch contains are: - use __identity_t instead of common_type. common_type was used as an identity metafunction but the decay resulted in incorrect results. - Pointers to free functions were not counted as functions. Remove the pointer before checking if a type is a function. llvm-svn: 239668
* Refactor is_member_function_pointer to use is_function and not ↵Eric Fiselier2015-06-131-13/+47
| | | | | | | | | | __member_function_traits. Replacing the dependancy on __member_function_traits with is_function allows is_member_function_pointer to work more often. In particular it allows it to work when we don't have variadic templates but the function has an arity > 3. llvm-svn: 239649
* Add 'is_always_equal' tests for scoped_allocator. Found that I had typed ↵Marshall Clow2015-06-031-0/+75
| | | | | | '||' where I meant '&&' in the code; fixed that, too llvm-svn: 238931
* Implement the first part of N4258 - allocator_traits<X>::is_always_equal. ↵Marshall Clow2015-06-021-0/+48
| | | | | | Also fixes PR#23723 llvm-svn: 238848
* Fix PR#23647 - make_shared<volatile bool> - second tryMarshall Clow2015-05-271-3/+3
| | | | llvm-svn: 238370
* Revert 238354 while I figure out what broke in weak_ptrMarshall Clow2015-05-271-3/+3
| | | | llvm-svn: 238355
* Fix PR#23647 - make_shared<volatile bool>Marshall Clow2015-05-271-0/+61
| | | | llvm-svn: 238354
* Cleanup move/forward tests and remove references to __rv.Eric Fiselier2015-05-273-30/+15
| | | | llvm-svn: 238270
* Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded ↵Marshall Clow2015-05-194-0/+94
| | | | | | operator& llvm-svn: 237699
* Add support for N4389 - std::bool_constantMarshall Clow2015-05-181-0/+32
| | | | llvm-svn: 237636
* Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptrMarshall Clow2015-05-102-2/+14
| | | | llvm-svn: 236953
* Fix for LWG2454: Add raw_storage_iterator::base() memberMarshall Clow2015-05-101-0/+48
| | | | llvm-svn: 236948
* A few bits of N2994 didn't get fully implemented a long time ago. Thanks to ↵Marshall Clow2015-04-161-1/+1
| | | | | | STL@microsoft.com for the bug report llvm-svn: 235134
* Qualify an internal call in is_assignable to prevent ADL lookup, which would ↵Marshall Clow2015-04-141-0/+6
| | | | | | 'complete' an type definition unnecessarily. Thanks to Richard Smith for the report. llvm-svn: 234886
* [libcxx] Fix PR22771 - Support access control SFINAE in the library version ↵Eric Fiselier2015-03-301-0/+6
| | | | | | | | | | | | | | | | | | | of is_convertible. Summary: Currently the conversion check does not take place in a context where access control SFINAE is applied. This patch changes the context of the test expression so that SFINAE occurs if access control does not permit the conversion. Related bug: https://llvm.org/bugs/show_bug.cgi?id=22771 Reviewers: mclow.lists, rsmith, dim Reviewed By: dim Subscribers: dim, rodrigc, emaste, cfe-commits Differential Revision: http://reviews.llvm.org/D8461 llvm-svn: 233552
* Add tests for library version of is_convertibleEric Fiselier2015-03-261-0/+18
| | | | llvm-svn: 233285
* [libc++] Fix PR22922 - Allocator support for std::function does not know how ↵Eric Fiselier2015-03-185-15/+18
| | | | | | | | | | | | | | | | | | | to rebind. Summary: This patch changes std::function to use allocator_traits to rebind the allocator instead of allocator itself. It also changes most of the tests to use `bare_allocator` where possible instead of `test_allocator`. Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8391 llvm-svn: 232686
* [libcxx] Move tuple_size and tuple_element overloads for pair and array out ↵Eric Fiselier2015-03-172-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of !defined(_LIBCPP_HAS_NO_VARIADICS) block. Summary: There is no reason to guard `tuple_size`, `tuple_element` and `get<I>(...)` for pair and array inside of `<__tuple>` so that they are only available when we have variadic templates. This requires there be redundant declarations and definitions. It also makes it easy to get things wrong. For example the following code should compile (and does in c++11). ``` #define _LIBCPP_HAS_NO_VARIADICS #include <array> int main() { static_assert((std::tuple_size<std::array<int, 10> volatile>::value == 10), ""); } ``` This patch lifts the non-variadic parts of `tuple_size`, `tuple_types`, and `get<I>(...)` to the top of `<__tuple>` where they don't require variadic templates. This patch also removes `<__tuple_03>` because there is no longer a need for it. Reviewers: danalbert, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7774 llvm-svn: 232492
* Use generic feature name for sanitizers that replace new and deleteEric Fiselier2015-03-105-5/+5
| | | | llvm-svn: 231841
* [libc++] Try and prevent evaluation of `is_default_constructible` on tuples ↵Eric Fiselier2015-02-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default constructor if it is not needed. Summary: Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should. ``` #include <type_traits> template <class T> struct IllFormedDefaultImp { IllFormedDefaultImp(T x) : value(x) {} constexpr IllFormedDefaultImp() {} T value; }; typedef IllFormedDefaultImp<int &> IllFormedDefault; template <class T, class U> struct pair { template <bool Dummy = true, class = typename std::enable_if< std::is_default_constructible<T>::value && std::is_default_constructible<U>::value && Dummy>::type > constexpr pair() : first(), second() {} pair(T const & t, U const & u) : first(t), second(u) {} T first; U second; }; int main() { int x = 1; IllFormedDefault v(x); pair<IllFormedDefault, IllFormedDefault> p(v, v); } ``` One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple. Reviewers: mclow.lists, rsmith, K-ballo, EricWF Reviewed By: EricWF Subscribers: ldionne, cfe-commits Differential Revision: http://reviews.llvm.org/D7569 llvm-svn: 230120
* Mark more tuple tests as unsupported in C++98 && C++03Eric Fiselier2015-02-192-0/+4
| | | | llvm-svn: 229810
* [libcxx] Mark most tuple tests UNSUPPORTED for c++03 and c++98.Eric Fiselier2015-02-1952-12/+103
| | | | | | | | | | | | | | Summary: No declaration for the type `tuple` is given in c++03 or c++98 modes. Mark all tests that use the actual `tuple` type as UNSUPPORTED. Reviewers: jroelofs, mclow.lists, danalbert Reviewed By: danalbert Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5956 llvm-svn: 229808
* [libc++] Fix PR20084 - std::is_function<void() const> failed.Eric Fiselier2015-02-181-13/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces some black magic to detect const and volatile qualified function types such as `void () const`. The patch works in the following way: We first rule out any type that satisfies on of the following. These restrictions are important so that the test below works properly. * `is_class<_Tp>::value` * `is_union<_Tp>::value` * `is_void<_Tp>::value` * `is_reference<_Tp>::value` * `__is_nullptr_t<_Tp>::value` If none of the above is true we perform overload resolution on `__source<_Tp>(0)` to determine the return type. * If `_Tp&` is well-formed we select `_Tp& __source(int)`. `_Tp&` is only ill formed for cv void types and cv/ref qualified function types. * Otherwise we select `__dummy_type __source(...)`. Since we know `_Tp` cannot be void then it must be a function type. let `R` be the returned from `__source<_Tp>(0)`. We perform overload resolution on `__test<_Tp>(R)`. * If `R` is `__dummy_type` we call `true_type __test(__dummy_type)`. * if `R` is `_Tp&` and `_Tp&` decays to `_Tp*` we call `true_type __test(_Tp*)`. Only references to function types decay to a pointer of the same type. * In all other cases we call `false_type __test(...)`. `__source<_Tp>(0)` will try and form `_Tp&` in the return type. if `_Tp&` is not well formed the return type of `__source<_Tp>(0)` will be dummy type. `_Tp&` is only ill-formed for cv/ref qualified function types (and void which is dealt with elsewhere). This fixes PR20084 - http://llvm.org/bugs/show_bug.cgi?id=20084 Reviewers: rsmith, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7573 llvm-svn: 229696
* [libcxx] Fix PR 22468 - std::function<void()> does not accept ↵Eric Fiselier2015-02-104-0/+81
| | | | | | | | | | | | | | | | | | | non-void-returning functions Summary: The bug can be found here: http://llvm.org/bugs/show_bug.cgi?id=22468 `__invoke_void_return_wrapper` is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause `function::operator()(...)` to not compile. Reviewers: eugenis, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7444 llvm-svn: 228705
* Fix use of C++11 extensions in C++03 code.Eric Fiselier2015-02-102-1/+3
| | | | llvm-svn: 228698
* Get tests running with warnings. Fix warnings in headers and testsEric Fiselier2015-02-0523-16/+57
| | | | llvm-svn: 228344
* We had two identical files named 'MoveOnly.h' in the test suite. Move one to ↵Marshall Clow2015-01-2811-60/+10
| | | | | | support/, remove the other, and update all the tests that included them. No functionality change. llvm-svn: 227370
* Removed some tabs that snuck into the test suite. No functionality changeMarshall Clow2015-01-282-14/+14
| | | | llvm-svn: 227363
* Cleaning up the test suite; remove some includes of non-standard file <__config>Marshall Clow2015-01-181-3/+1
| | | | llvm-svn: 226411
* Rename system_lib -> system_cxx_lib. NFCJonathan Roelofs2015-01-1413-26/+26
| | | | llvm-svn: 226061
* Walter Brown sent a list of tests which needed 'additional includes' to ↵Marshall Clow2015-01-0956-0/+56
| | | | | | match what was in the standard. Added these includes to the tests. No changes to the library or test results. llvm-svn: 225541
* In early C++11 standard drafts, std::function derived from ↵Marshall Clow2015-01-081-29/+88
| | | | | | std::unary_function or std::binary_function if there was only one (or two) parameters. Before C++11 shipped, this restiction was lifted, but libc++ still does this (which is fine). However, the tests still check for this outdated requiremnt. Change then to check for the nested typedefs instead (which are still required by the standard). No change to the library. llvm-svn: 225430
* Add checks to make sure the hash functor has the right typedefsMarshall Clow2015-01-081-0/+4
| | | | llvm-svn: 225429
* Missed a typenameMarshall Clow2015-01-071-2/+2
| | | | llvm-svn: 225408
* libc++ implements its' hash objects as deriving from std::unary_function, ↵Marshall Clow2015-01-076-16/+24
| | | | | | and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library. llvm-svn: 225403
* In C++03, a bunch of the arithmetic/logical/comparison functors (such as ↵Marshall Clow2015-01-074-4/+8
| | | | | | negate/bit_not.pass/logical_not) were defined as deriving from unary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion. llvm-svn: 225402
* Add tests to check the typedefs from the result of std::owner_lessMarshall Clow2015-01-071-0/+8
| | | | llvm-svn: 225381
* Missed one comparison test in r225375Marshall Clow2015-01-071-1/+3
| | | | llvm-svn: 225376
* In C++03, a bunch of the arithmetic/logical/comparison functors (such as ↵Marshall Clow2015-01-0716-16/+48
| | | | | | add/equal_to/logical_or) were defined as deriving from binary_funtion. That restriction was removed in C++11, but the tests still check for this. Change the test to look for the embedded types first_argument/second_argument/result_type. No change to the library, just more standards-compliant tests. Thanks to STL @ Microsoft for the suggestion. llvm-svn: 225375
* Prevent ill-formed instantiation of __invoke_of<...> during the evaluation ↵Eric Fiselier2014-12-231-0/+49
| | | | | | | | | | | | | | | | of a bind expression. Fixes PR22003. The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind expressions always tries to deduce the return type for Fn(Args...) even when Fn is not a nested bind expression. This can cause hard compile errors when the instantation of Fn(Args...) is ill-formed. This patch prevents the instantation of __invoke_of<Fn, Args...> unless Fn is actually a bind expression. Bug reportand patch from Michel Morin. http://llvm.org/bugs/show_bug.cgi?id=22003 llvm-svn: 224753
OpenPOWER on IntegriCloud