summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Disable refwrap/weak_result.pass.cpp in C++20 mode (broken ↵Billy Robert O'Neal III2020-01-081-0/+2
| | | | by P0357R3)
* [libcxx] [test] Fix valarray UB and MSVC warnings.Stephan T. Lavavej2019-12-121-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [libcxx] [test] Calling min and max on an empty valarray is UB. libcxx/test/std/numerics/numarray/template.valarray/valarray.members/min.pass.cpp libcxx/test/std/numerics/numarray/template.valarray/valarray.members/max.pass.cpp The calls `v1.min();` and `v1.max();` were emitting nodiscard warnings with MSVC's STL. Upon closer inspection, these calls were triggering undefined behavior. N4842 [valarray.members] says: "T min() const; 8 Preconditions: size() > 0 is true. T max() const; 10 Preconditions: size() > 0 is true." As these tests already provide coverage for non-empty valarrays (immediately above), I've simply deleted the code for empty valarrays. [libcxx] [test] Add macros to msvc_stdlib_force_include.h (NFC). libcxx/test/support/msvc_stdlib_force_include.h These macros are being used by: libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Defining them to nothing allows that test to pass. [libcxx] [test] Silence MSVC warning C5063 for is_constant_evaluated (NFC). libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp This test is intentionally writing code that MSVC intentionally warns about, so the warning should be silenced. Additionally, comment an endif for clarity. [libcxx] [test] Silence MSVC warning C4127 (NFC). libcxx/test/support/charconv_test_helpers.h MSVC avoids emitting this warning when it sees a single constexpr value being tested, but this condition is a mix of compile-time and run-time. Using push-disable-pop is the least intrusive way to silence this. [libcxx] [test] Silence MSVC truncation warning (NFC). libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp This test is intentionally truncating float to int, which MSVC intentionally warns about, so push-disable-pop is necessary. [libcxx] [test] Avoid truncation warnings in erase_if tests (NFC). libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp These tests use maps with `short` keys and values, emitting MSVC truncation warnings from `int`. Adding `static_cast` to `key_type` and `mapped_type` avoids these warnings. As these tests require C++20 mode (or newer), for brevity I've changed the multimap tests to use emplace to initialize the test data. This has no effect on the erase_if testing.
* [libc++] Cleanup and enable multiple warnings.Eric Fiselier2019-12-123-0/+8
| | | | | | | | | | Too many warnings are being disabled too quickly. Warnings are important to keeping libc++ correct. This patch re-enables two warnings: -Wconstant-evaluated and -Wdeprecated-copy. In future, all warnings disabled for the test suite should require an attached bug. The bug should state the plan for re-enabling that warning, or a strong case why it should remain disabled.
* Fix _LIBCPP_HAS_ definitions for Android.Dan Albert2019-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Android added quick_exit()/at_quick_exit() in API level 21, aligned_alloc() in API level 28, and timespec_get() in API level 29, but has the other C11 features at all API levels (since they're basically just coming from clang directly). _LIBCPP_HAS_QUICK_EXIT and _LIBCPP_HAS_TIMESPEC_GET already existed, so we can reuse them. (And use _LIBCPP_HAS_TIMESPEC_GET in a few more places where _LIBCPP_HAS_C11_FEATURES has been used as a proxy. This isn't correct for Android.) _LIBCPP_HAS_ALIGNED_ALLOC is added, to cover aligned_alloc() (obviously). Add a missing std:: before aligned_alloc in a cstdlib test, and remove a couple of !defined(_WIN32)s now that we're explicitly testing TEST_HAS_ALIGNED_ALLOC rather than TEST_HAS_C11_FEATURES. Reviewers: danalbert, EricWF, mclow.lists Reviewed By: danalbert Subscribers: srhines, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69929
* [libc++] [chrono] Fix year_month_weekday::ok() implementation.Marek Kurdej2019-11-151-3/+23
| | | | | | | | | | | | Reviewers: ldionne, EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: christof, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D70282
* [libc++] Add test and remove workaround for PR13592Louis Dionne2019-10-301-3/+9
| | | | | | | | PR13592 was caused by a problem in how to compiler implemented the __is_convertible_to intrinsic. That problem, reported as PR13591, was fixed back in 2012. We don't support such old versions of Clang anyway, so we don't need the library workaround that had been added to solve PR13592 (while waiting for the compiler fix).
* PR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.David Blaikie2019-10-281-0/+16
|
* [libcxx][NFC] Strip trailing whitespace, fix typo.Stephan T. Lavavej2019-10-235-7/+7
|
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-2327-57/+57
|
* [libc++][NFC] Remove excess trailing newlines from most filesCasey Carter2019-10-233-3/+0
| | | | Testing git commit access.
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-2211-12/+12
| | | | (Testing git commit access.)
* P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of ↵Richard Smith2019-10-191-0/+5
| | | | | | | | | | | | | | | | is_invocable that would internally conjure up a deprecated function type. Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings. Reviewers: mclow.lists, EricWF Subscribers: christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68879 llvm-svn: 375307
* [libc++][test] Silence more warnings in variant testsCasey Carter2019-10-144-4/+4
| | | | | | More cases of signed-to-unsigned conversion warnings that missed the train for d2623522. llvm-svn: 374778
* [libc++][test] std::variant test cleanupCasey Carter2019-10-136-5/+7
| | | | | | | | * Add the conventional `return 0` to `main` in `variant.assign/conv.pass.cpp` and `variant.ctor/conv.pass.cpp` * Fix some MSVC signed-to-unsigned conversion warnings by replacing `int` literarls with `unsigned int` literals llvm-svn: 374723
* [libc++][test] Silence MSVC warning in std::optional testCasey Carter2019-10-121-1/+1
| | | | | | `make_optional<string>(4, 'X')` passes `4` (an `int`) as the first argument to `string`'s `(size_t, charT)` constructor, triggering a signed/unsigned mismatch warning when compiling with MSVC at `/W4`. The incredibly simple fix is to instead use an unsigned literal (`4u`). llvm-svn: 374684
* [libc++][test] Miscellaneous MSVC cleanupsCasey Carter2019-10-091-1/+3
| | | | | | | | | | | | * Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++. * Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`. * Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined. * Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings. * Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating. Differential Revision: https://reviews.llvm.org/D68681 llvm-svn: 374248
* [libc++] Take 2: Implement LWG 3158Louis Dionne2019-09-272-1/+34
| | | | | | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. This was previously committed as r372778 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 373092
* [libc++] Take 2: Implement LWG 2510Louis Dionne2019-09-269-6/+193
| | | | | | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. This was previously committed as r372777 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372983
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-2512-25/+2
| | | | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. This is a re-application of r372787. llvm-svn: 372916
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-2522-218/+31
| | | | | | | | | | | | This also reverts: - r372778: [libc++] Implement LWG 3158 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older - r372787: Purge mentions of GCC 4 from the test suite Reason: the change breaks compilation of LLVM with libc++, for details see http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html llvm-svn: 372832
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-2416-29/+6
| | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. llvm-svn: 372787
* [libc++] Try fixing tests that fail on GCC 5 and olderLouis Dionne2019-09-244-0/+16
| | | | llvm-svn: 372782
* [libc++] Remove C++03 variadics in shared_ptrZoe Carver2019-09-242-122/+79
| | | | | | | | | | | | | | Summary: As suggested by @ldionne in D66178, this patch removes C++03 variadics //only//. Following patches will apply more updates. Reviewers: ldionne, EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits, ldionne Tags: #libc Differential Revision: https://reviews.llvm.org/D67675 llvm-svn: 372780
* [libc++] Implement LWG 3158Louis Dionne2019-09-242-1/+34
| | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 372778
* [libc++] Implement LWG 2510Louis Dionne2019-09-249-5/+166
| | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372777
* Fix various test failures with GCCEric Fiselier2019-09-132-3/+7
| | | | llvm-svn: 371880
* libcxx: Rename last two .hpp files in libcxx to .hNico Weber2019-08-215-7/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D66544 llvm-svn: 369597
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-21104-128/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* [libc++] Implement LWG 3199Louis Dionne2019-08-201-0/+12
| | | | | | | | | | | | | | | | Summary: The resolution of LWG 3199 makes sure that input-streaming into an empty bitset does not set the failbit on the input stream. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65105 llvm-svn: 369422
* [libc++] Precise XFAIL for AppleClang 11Louis Dionne2019-08-201-1/+1
| | | | | | This test doesn't fail on all patch levels of AppleClang 11 llvm-svn: 369420
* [libc++] Disable <chrono> ""d and ""y literal tests on AppleClang 10.0.0Louis Dionne2019-08-202-0/+2
| | | | | | | | In r368882, I enabled those tests for all AppleClang's above version 9. However, it turns out that the feature is only supported starting with AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole. llvm-svn: 369409
* [libc++] Add XFAIL for is_base_of test on AppleClang 11Louis Dionne2019-08-191-2/+2
| | | | llvm-svn: 369280
* [libc++] Mark <chrono> test as unsupported on AppleClang 9Louis Dionne2019-08-141-0/+1
| | | | llvm-svn: 368914
* [libc++] Mark std::tuple CTAD test as failing on AppleClang 9Louis Dionne2019-08-141-0/+1
| | | | | | | | Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is insufficient. I suspect the corresponding LLVM Clang is broken too, but we don't seem to have testers using that Clang. llvm-svn: 368911
* [libc++] Enable <chrono> ""d and ""y literals for AppleClang 10 and upLouis Dionne2019-08-142-2/+2
| | | | | | AppleClang supports those literals starting in version 10.0.1. llvm-svn: 368882
* [libc++] Mark two <chrono> tests as unsupported on AppleClang 11Louis Dionne2019-08-132-2/+2
| | | | | | | The operator""y and operator""d will eventually be supported by AppleClang, but no released version supports them at the moment. llvm-svn: 368749
* [libc++] Implement CTAD for std::tupleLouis Dionne2019-08-121-13/+57
| | | | | | | | | | | | | | | | | | | | | Summary: We were using implicit deduction guides instead of explicit ones, however the implicit ones don't do work anymore when changing the constructors. This commit adds the actual guides specified in the Standard to make libc++ (1) closer to the Standard and (2) more resistent to changes in std::tuple's constructors. Reviewers: Quuxplusone Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65225 llvm-svn: 368599
* Implement hh_mm_ss from P1466R3. Reviewed as https://reviews.llvm.org/D65365.Marshall Clow2019-08-0815-0/+782
| | | | llvm-svn: 368299
* Fix tests with modules enabledEric Fiselier2019-07-294-0/+4
| | | | llvm-svn: 367268
* Fix a bug in std::chrono::abs where it would fail when the duration's period ↵Marshall Clow2019-07-261-0/+6
| | | | | | had not been reduced.s llvm-svn: 367120
* Implement change #4 of P1466: Change weekday to accept both 0 and 7 as ↵Marshall Clow2019-07-2519-60/+155
| | | | | | Sunday. Add accessors 'c_encoding' and 'iso_encoding' to provide different interpretations of the weekday. Remove 'operator unsigned' llvm-svn: 366981
* Implement most of P1612R1: Relocate endian. Moves the std::endian ↵Marshall Clow2019-07-231-48/+0
| | | | | | functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that llvm-svn: 366776
* [libc++] Add C++17 deduction guides for std::functionLouis Dionne2019-07-183-0/+283
| | | | | | | | | | | | Summary: http://llvm.org/PR39606 Reviewers: Quuxplusone Subscribers: christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D54410 llvm-svn: 366484
* Add test for variant construction with duplicate types.Eric Fiselier2019-07-141-0/+12
| | | | llvm-svn: 366032
* Harden variant test added in r366022Eric Fiselier2019-07-141-3/+3
| | | | | | | The test was brittle since it only went boom for one specific type, when really it should go boom for all of them. llvm-svn: 366025
* Avoid eager template instantiation caused by the variant narrowing checks.Eric Fiselier2019-07-141-1/+13
| | | | | | | | | | | | | | | | | | The standard disallows narrowing conversions when constructing a variant. This is checked by attempting to perform braced initialization of the destination type from the argument type. However, braced initialization can force the compiler (mostly clang) to eagerly instantiate the constructors of the destintation type -- which can lead to errors in a non-immediate context. However, as variant is currently specified, the narrowing checks only observably apply when the destination type is arithmetic. Meaning we can skip the check for class types. Hense avoiding the hard errors. In order to cause fewer build breakages, this patch avoids the narrowing check except when the destination type is arithmetic. llvm-svn: 366022
* Fix non-conformance it `std::tuple`.Eric Fiselier2019-07-121-0/+16
| | | | | | | | | | | | | | Previously we implemented all one trillion tuple-like constructors using a single generic overload. This worked fairly well, except that it differed in behavior from the standard version because it didn't consider both T&& and T const&. This was observable for certain types. This patch addresses that issue by splitting the generic constructor in two. We now provide both T&& and T const& versions of the tuple-like constructors (sort of). llvm-svn: 365973
* Add option to disable variant narrowing conversion changes.Eric Fiselier2019-07-126-93/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paper P0608R3 - "A sane variant converting constructor" disallows narrowing conversions in variant. It was meant to address this surprising problem: std::variant<std::string, bool> v = "abc"; assert(v.index() == 1); // constructs a bool. However, it also disables every potentially narrowing conversion. For example: variant<unsigned> v = 0; // ill-formed variant<string, double> v2 = 42; // ill-formed (int -> double narrows) These latter changes break code. A lot of code. Within Google it broke on the order of a hundred thousand target with thousands of root causes responsible for the breakages. Of the breakages related to the narrowing restrictions, none of them exposed outstanding bugs. However, the breakages caused by boolean conversions (~13 root causes), all but one of them were bugs. For this reasons, I am adding a flag to disable the narrowing conversion changes but not the boolean conversions one. One purpose of this flag is to allow users to opt-out of breaking changes in variant until the offending code can be cleaned up. For non-trivial variant usages the amount of cleanup may be significant. This flag is also required to support automated tooling, such as clang-tidy, that can automatically fix code broken by this change. In order for clang-tidy to know the correct alternative to construct, it must know what alternative was being constructed previously, which means running it over the old version of std::variant. Because this change breaks so much code, I will be implementing the aforementioned clang-tidy check in the very near future. Additionally I'm plan present this new information to the committee so they can re-consider if this is a breaking change we want to make. I think libc++ should very seriously consider pulling this change before the 9.0 release branch is cut. But that's a separate discussion that I will start on the lists. For now this is the minimal first step. llvm-svn: 365960
* This patch makes swap functions constexpr. Both swap overloads, swap_ranges ↵Zoe Carver2019-07-052-0/+32
| | | | | | and iter_swap are updated (with tests). llvm-svn: 365238
* Fix tuple's conditionally explicit constructors for very weird userEric Fiselier2019-07-031-0/+14
| | | | | | | | | | | | types. It seems some people like to write types that can explicitly convert to anything, but cannot be used to explicitly construct anything. This patch makes tuple tolerate such types, as is required by the standard. llvm-svn: 365074
OpenPOWER on IntegriCloud