summaryrefslogtreecommitdiffstats
path: root/test/std/utilities/function.objects
Commit message (Collapse)AuthorAgeFilesLines
* Remove all usages of REQUIRES-ANY in the test suite.Eric Fiselier2017-01-246-6/+6
| | | | | | | | | Pending LIT changes are about to remove the REQUIRES-ANY keyword in place of supporting boolean && and || within "REQUIRES". This patch prepares libc++ for that change so that when applied the bots don't lose their mind. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292901 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-211-0/+23
| | | | | | | | | | | | | | | | | | | | | Summary: Exactly what the title says. This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it. See http://wg21.link/P0513R0 for more info. If there are no comments in the next couple of days I'll commit this Reviewers: mclow.lists, K-ballo, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28938 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292684 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-181-1/+1
| | | | | | No functional change, no code review. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292434 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix MSVC warnings C4127 and C6326 about constants.Stephan T. Lavavej2017-01-182-2/+4
| | | | | | | | | | | | | | | | | | MSVC has compiler warnings C4127 "conditional expression is constant" (enabled by /W4) and C6326 "Potential comparison of a constant with another constant" (enabled by /analyze). They're potentially useful, although they're slightly annoying to library devs who know what they're doing. In the latest version of the compiler, C4127 is suppressed when the compiler sees simple tests like "if (name_of_thing)", so extracting comparison expressions into named constants is a workaround. At the same time, using std::integral_constant avoids C6326, which doesn't look at template arguments. test/std/containers/sequences/vector.bool/emplace.pass.cpp Replace 1 == 1 with true, which is the same as far as the library is concerned. Fixes D28837. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292432 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR31489 - std::function self-swap segfaultsEric Fiselier2016-12-292-94/+195
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290721 91177308-0d34-0410-b5e6-96231b3b80d8
* fix newly failing c++03 testsEric Fiselier2016-12-241-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290472 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unused parameters and variablesEric Fiselier2016-12-233-6/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable the -Wsign-compare warning to better support MSVCEric Fiselier2016-12-112-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289363 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 7/7. test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4). test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1). test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp This test is intentionally writing doubles to ostream_iterator<int>. It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC. test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float. test/std/numerics/complex.number/cmplx.over/arg.pass.cpp test/std/numerics/complex.number/cmplx.over/norm.pass.cpp These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long. Saying static_cast<double>(x) avoids this. test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index, we can just iterate with `T s`. test/std/re/re.traits/value.pass.cpp regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t (which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation. (And 100 is representable even when char has a signed range.) test/std/strings/string.view/string.view.hash/string_view.pass.cpp Add static_cast<char_type> because `'0' + i` has type int. test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2 says that pow(int, int) returns double, so this was truncating double to int. Adding static_cast<T> silences this. test/std/utilities/function.objects/unord.hash/integral.pass.cpp This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this. test/std/utilities/utility/exchange/exchange.pass.cpp First, this was exchanging 67.2 into an int, but that's inherently truncating. Changing this to static_cast<short>(67) avoids the truncation while preserving the "what if T and U are different" test coverage. Second, this was exchanging {} with the explicit type float into an int, and that's also inherently truncating. Specifying short is just as good. test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp Add static_cast<short>. Note that this affects template argument deduction for make_pair(), better fulfilling the test's intent. For example, this was saying `typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking make_pair() to return pair<int, int>, which was then being converted to pair<int, short>. (pair's converting constructors are tested elsewhere.) Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>. (There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.) Fixes D27544. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289111 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-085-10/+10
| | | | | | | | | | | | | loss of data", part 2/7. These tests for some guy's transparent operator functors were needlessly truncating their double results to int. Preserving the doubleness makes compilers happier. I'm following existing practice by adding an "// exact in binary" comment when the result isn't a whole number. (The changes from 6 to 6.0 and so forth are stylistic, not critical.) Fixes D27539. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289106 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] D26815: Fix an assumption about the state of moved-from ↵Stephan T. Lavavej2016-11-181-2/+2
| | | | | | | | | | | std::functions. The Standard doesn't provide any guarantees beyond "valid but unspecified" for moved-from std::functions. libcxx moves from small targets and leaves them there, while MSVC's STL empties out the source. Mark these assertions as libcxx-specific. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287382 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-0412-12/+36
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286007 91177308-0d34-0410-b5e6-96231b3b80d8
* Update LWG 2767 and add test caseEric Fiselier2016-10-161-0/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284324 91177308-0d34-0410-b5e6-96231b3b80d8
* Add void_t and invoke feature test macrosEric Fiselier2016-10-141-0/+39
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284209 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement http://wg21.link/p0302r1: Removing Allocator Support in ↵Marshall Clow2016-10-1312-0/+210
| | | | | | std::function. These functions never worked, and as far as I know, no one ever called them. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284164 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove use of _VSTD::__invoke in the not_fn testsEric Fiselier2016-10-121-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283991 91177308-0d34-0410-b5e6-96231b3b80d8
* Add tests to check that swap(std::function, std::function) is noexcept. This ↵Marshall Clow2016-10-101-1/+14
| | | | | | is LWG#2062, but we already do this. No changes to the library, just adding tests. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283780 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilitiesEric Fiselier2016-10-012-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283032 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing _v traits. is_bind_expression_v, is_placeholder_v and ↵Marshall Clow2016-09-222-0/+8
| | | | | | uses_allocator_v git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282126 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG 2148: Make non-enum default hash specialization well-formedEric Fiselier2016-08-102-5/+40
| | | | | | | | | | | | | | | | | Summary: This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable. See also: * http://cplusplus.github.io/LWG/lwg-active.html#2543 * https://llvm.org/bugs/show_bug.cgi?id=28917 Reviewers: mclow.lists, EricWF Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D23331 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278300 91177308-0d34-0410-b5e6-96231b3b80d8
* Guard libc++ specific tests SFINAE on std::bind's call operator. Patch from ↵Eric Fiselier2016-07-241-3/+5
| | | | | | STL@microsoft.com git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276576 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG 2393. Check for LValue-callability.Eric Fiselier2016-07-243-0/+65
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276546 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix inheriting constructor test for std::function.Eric Fiselier2016-07-201-4/+7
| | | | | | | | | The test I originally checked in only worked with ToT Clang. This patch updates the test so that it works as far back as 3.5. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276093 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missed test in r276090.Eric Fiselier2016-07-201-0/+23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276091 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement P0358r1. Fixes for not_fn.Eric Fiselier2016-06-271-28/+69
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273837 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG 2488 - Make the placeholders constexpr.Eric Fiselier2016-06-261-0/+28
| | | | | | | | | | | | | | | | | | | | This patch makes the bind placeholders in std::placeholders both (1) const and (2) constexpr (See below). This is technically a breaking change for any code using the placeholders outside of std::bind and depending on them being non-const. However I don't think this will break any real world code. (1) Previously the placeholders were non-const extern globals in all dialects. This patch changes these extern globals to be const in all dialects. Since the cv-qualifiers don't participate in name mangling for globals this is an ABI compatible change. (2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only applies to C++17 I don't see any reason not to backport this change. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273824 91177308-0d34-0410-b5e6-96231b3b80d8
* Move remaining _LIBCPP_VERSION tests into test/libcxxEric Fiselier2016-06-221-20/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273367 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use C++17 terse static assert. Patch from STL@microsoft.comEric Fiselier2016-06-222-34/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273353 91177308-0d34-0410-b5e6-96231b3b80d8
* Suppress unused warnings in std::invoke tests.Eric Fiselier2016-06-221-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273348 91177308-0d34-0410-b5e6-96231b3b80d8
* Guard libc++ assumption about identity hashing in test. Patch from ↵Eric Fiselier2016-06-221-3/+7
| | | | | | STL@microsoft.com git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273345 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-142-2/+6
| | | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
* Prevent truncation warning. Patch from STL@microsoft.comEric Fiselier2016-06-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272621 91177308-0d34-0410-b5e6-96231b3b80d8
* Add not_fn test for throwing operator!Eric Fiselier2016-06-021-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271502 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark LWG issue 2545 as complete. Add extra testsEric Fiselier2016-06-022-0/+132
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271489 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark LWG issue 2450 as complete.Eric Fiselier2016-06-027-6/+80
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271473 91177308-0d34-0410-b5e6-96231b3b80d8
* Add C++17 std::not_fn negator.Eric Fiselier2016-06-022-0/+578
| | | | | | | | | | | | | | | Summary: Exactly what it sounds like. I plan to commit this in a couple of days assuming no objections. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20799 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271464 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-017-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark LWG issue 2565 as complete. Update the tests to check it.Eric Fiselier2016-05-312-28/+100
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271238 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Improve tests to use the UNSUPPORTED lit directiveAsiri Rathnayake2016-05-285-25/+15
| | | | | | | | | | | | | | | | | | | Quite a few libcxx tests seem to follow the format: #if _LIBCPP_STD_VER > X // Do test. #else // Empty test. #endif We should instead use the UNSUPPORTED lit directive to exclude the test on earlier C++ standards. This gives us a more accurate number of test passes for those standards and avoids unnecessary conflicts with other lit directives on the same tests. Reviewers: bcraig, ericwf, mclow.lists Differential revision: http://reviews.llvm.org/D20730 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271108 91177308-0d34-0410-b5e6-96231b3b80d8
* Move INVOKE tests into test/libcxx sub-tree.Eric Fiselier2016-04-296-1419/+16
| | | | | | | | | | Testing the concrete implementation of INVOKE means calling the implementation specific names `__invoke` and `__invoke_constexpr`. For this reason the test are non-standard. For this reason it's best if the tests live outside of the `test/std` directory. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267973 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove names of unreferenced parameters. Patch from STL@microsoft.comEric Fiselier2016-04-282-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267852 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'is_callable' and 'is_nothrow_callable' traits and cleanup INVOKE.Eric Fiselier2016-04-204-55/+200
| | | | | | | | | | | | | The primary purpose of this patch is to add the 'is_callable' traits. Since 'is_nothrow_callable' required making 'INVOKE' conditionally noexcept I also took this oppertunity to implement a constexpr version of INVOKE. This fixes 'std::experimental::apply' which required constexpr 'INVOKE support'. This patch will be followed up with some cleanup. Primarly removing most of "__member_function_traits" since it's no longer used by INVOKE (in C++11 at least). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266836 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG issue 2219 - support reference_wrapper in INVOKEEric Fiselier2016-04-185-35/+201
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266590 91177308-0d34-0410-b5e6-96231b3b80d8
* Add hash specializations for __int128_t. Fixes LWG issue 2119Eric Fiselier2016-04-181-3/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266587 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement LWG#2385; remove the allocator-aware std::function::assign call. ↵Marshall Clow2016-01-251-0/+4
| | | | | | It was useless, and didn't actually *do anything* with the allocator. Now it's gone. On the off chance that someone is mistakenly calling it, it's only gone in C++1z git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258697 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traitsEric Fiselier2016-01-201-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258287 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing license headersEric Fiselier2016-01-192-0/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258196 91177308-0d34-0410-b5e6-96231b3b80d8
* One more missing std:: qualification from JonathanMarshall Clow2016-01-121-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@257506 91177308-0d34-0410-b5e6-96231b3b80d8
* Add tests for the extended integer types - as required by LWG#2119Marshall Clow2015-11-171-0/+40
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@253376 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo I just introduced.Marshall Clow2015-11-101-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@252614 91177308-0d34-0410-b5e6-96231b3b80d8