summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
Commit message (Collapse)AuthorAgeFilesLines
...
* [libcxx][test] Silence -Wself-assign diagnosticsRoman Lebedev2018-04-072-7/+7
| | | | | | | | | | | | | | | | | | | | Summary: D44883 extends -Wself-assign to also work on C++ classes. These new warnings pop up in the test suite, so they have to be silenced. Please refer to the D45082 for disscussion on whether this is the right way to solve this. Testing: `ninja check-libcxx check-libcxxabi` in stage-2 build. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: Quuxplusone, cfe-commits Differential Revision: https://reviews.llvm.org/D45128 llvm-svn: 329490
* fix typo in align_const_pair_U_V.pass.cppEric Fiselier2018-03-291-1/+1
| | | | llvm-svn: 328760
* Move libc++ pair/tuple assign test to libcxx/ test directory.Eric Fiselier2018-03-293-140/+38
| | | | | | | | | | | Libc++ implements the pair& operator=(pair<U, V>) assignment operator using a single template that handles assignment from all tuple-like types. This patch moves the test for that to the libcxx test directory since it's non-standard. It also adds additional tests to the std/.../pair directory to test the standard behavior this template implements. llvm-svn: 328758
* avoid new/delete ellision in construct.pass.cppEric Fiselier2018-03-251-0/+4
| | | | llvm-svn: 328445
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2018-03-221-1/+1
| | | | llvm-svn: 328264
* Workaround GCC bug PR78489 - SFINAE order is not respected.Eric Fiselier2018-03-221-0/+6
| | | | | | | | | | | This patch works around variant test failures which are new to GCC 8. GCC 8 either doesn't perform SFINAE in lexical order, or it doesn't halt after encountering the first failure. This causes hard error to occur instead of substitution failure. See gcc.gnu.org/PR78489 llvm-svn: 328261
* Use DoNotOptimize to prevent new/delete elision.Eric Fiselier2018-03-221-1/+5
| | | | | | | | | | | The new/delete tests, in particular those which test replacement functions, often fail when the optimizer is enabled because the calls to new/delete may be optimized away, regardless of their side-effects. This patch converts the tests to use DoNotOptimize in order to prevent the elision. llvm-svn: 328245
* Un-XFAIL a test under new GCC version; the GCC bug has been fixedEric Fiselier2018-03-221-1/+1
| | | | llvm-svn: 328229
* Fix improperly failing test - and the code it was testing. Thanks to Stephan ↵Marshall Clow2018-03-221-3/+4
| | | | | | Lavavej for the catch. llvm-svn: 328225
* Fix PR22634 - std::allocator doesn't respect over-aligned types.Eric Fiselier2018-03-221-22/+76
| | | | | | | | | | | | | | | | | | | | This patch fixes std::allocator, and more specifically, all users of __libcpp_allocate and __libcpp_deallocate, to support over-aligned types. __libcpp_allocate/deallocate now take an alignment parameter, and when the specified alignment is greater than that supported by malloc/new, the aligned version of operator new is called (assuming it's available). When aligned new isn't available, the old behavior has been kept, and the alignment parameter is ignored. This patch depends on recent changes to __builtin_operator_new/delete which allow them to be used to call any regular new/delete operator. By using __builtin_operator_new/delete when possible, the new/delete erasure optimization is maintained. llvm-svn: 328180
* Implement LWG3034: P0767R1 breaks previously-standard-layout typesMarshall Clow2018-03-212-0/+66
| | | | llvm-svn: 328064
* Implement LWG3035: std::allocator's constructors should be constexpr.Marshall Clow2018-03-201-0/+50
| | | | llvm-svn: 328059
* Implement P0767R1 - Deprecate PODMarshall Clow2018-03-061-0/+102
| | | | llvm-svn: 326801
* [libcxx] [test] Fix MSVC warnings and errors.Stephan T. Lavavej2018-02-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fix MSVC x64 truncation warnings. warning C4267: conversion from 'size_t' to 'int', possible loss of data test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp Fix MSVC uninitialized memory warning. warning C6001: Using uninitialized memory 'vl'. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp Include <cassert> for the assert() macro. Fixes D43273. llvm-svn: 326120
* [libcxx] [test] Strip trailing whitespace, NFC.Stephan T. Lavavej2018-02-122-4/+4
| | | | llvm-svn: 324959
* Fix has_unique_object_representation after Clang commit r324134.Eric Fiselier2018-02-021-2/+4
| | | | | | | | | Clang previously reported an empty union as having a unique object representation. This was incorrect and was fixed in a recent Clang commit. This patch fixes the libc++ tests. llvm-svn: 324153
* Disable test in C++<11 mode due to use of alignas.Richard Smith2018-02-011-0/+2
| | | | llvm-svn: 324033
* Make std::get_temporary_buffer respect overaligned types when possibleRichard Smith2018-02-011-0/+33
| | | | | | | | Patch by Chris Kennelly! Differential Revision: https://reviews.llvm.org/D41746 llvm-svn: 324020
* [libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference ↵Eric Fiselier2018-01-241-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | binding in std::tuple. Summary: See https://bugs.llvm.org/show_bug.cgi?id=20855 Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example: ``` // The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call. std::tuple<int, const std::string&> t(std::make_tuple(42, "abc")); ``` However, we are over-aggressive and we incorrectly diagnose cases such as: ``` void foo(std::tuple<int const&, int const&> const&); foo(std::make_tuple(42, 42)); ``` This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as: ``` std::tuple<int, const std::string&> t(42, "abc"); ``` Reviewers: rsmith, mclow.lists Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41977 llvm-svn: 323380
* include <cstdint> to get uint32_tMarshall Clow2018-01-241-0/+1
| | | | llvm-svn: 323306
* Implement P0463R1: 'Endian just Endian'. Reviewed as ↵Marshall Clow2018-01-241-0/+47
| | | | | | https://reviews.llvm.org/D35472 llvm-svn: 323296
* Last batch of P0202 constexpr additions: includes/set_intersection/exchangeMarshall Clow2018-01-221-1/+29
| | | | llvm-svn: 323159
* Fix most GCC test failures.Eric Fiselier2018-01-181-0/+48
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes almost all currently failing tests when using GCC ToT. The specific changes are: (A) Workaround gcc.gnu.org/PR83921 which rejects variables w/o initializers in constexpr contexts -- even when the variable is an empty class. This bug has been worked around at all callsites by adding an initializer. Additionally a new test, constexpr_init.pass.cpp, has been added to test that Clang doesn't suffer from these bugs. (B) Fix streambuf.assign/swap.pass.cpp. This test was never actually calling the swap method as intended. In fact, the swap function it intended to call was ill-formed when instantiated. GCC diagnosed this ill-formedness w/o needing an instantiation. (C) size_delete11.pass.cpp was fixed by adding c++2a to the list of unsupported dialects. llvm-svn: 322810
* [libcxx] [test] Improve MSVC portability.Stephan T. Lavavej2018-01-101-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. llvm-svn: 322144
* Apparently 'C++14' is different than 'c++14'Marshall Clow2018-01-081-1/+1
| | | | llvm-svn: 322034
* Add the C++17 extensions to std::search. Include the default searcher, but ↵Marshall Clow2018-01-0811-0/+1264
| | | | | | not the Boyer-Moore or Boyer-Moore-Horspool searcher (yet). BUT put the BM and BMH tests in place, marked to XFAIL. The other searchers will follow soon llvm-svn: 322019
* Add pre-C++11 is_constructible wrappers for 3 argumentsDimitry Andric2018-01-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: After rL319736 for D28253 (which fixes PR28929), gcc cannot compile `<memory>` anymore in pre-C+11 modes, complaining: ``` In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)': /usr/include/c++/v1/memory:4365:5: error: wrong number of template arguments (4, should be at least 1) static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); ^ In file included from /usr/include/c++/v1/memory:649:0, from test.cpp:1: /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible' struct _LIBCPP_TEMPLATE_VIS is_constructible ^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory:4365:5: error: template argument 1 is invalid static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" ); ^ /usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)': /usr/include/c++/v1/memory:4444:5: error: wrong number of template arguments (4, should be at least 1) static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); ^ In file included from /usr/include/c++/v1/memory:649:0, from test.cpp:1: /usr/include/c++/v1/type_traits:3198:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible' struct _LIBCPP_TEMPLATE_VIS is_constructible ^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/v1/memory:648:0, from test.cpp:1: /usr/include/c++/v1/memory:4444:5: error: template argument 1 is invalid static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" ); ^ ``` This is also reported in https://bugs.freebsd.org/224946 (FreeBSD is apparently one of the very few projects that regularly builds programs against libc++ with gcc). The reason is that the static assertions are invoking `is_constructible` with three arguments, while gcc does not have the built-in `is_constructible` feature, and the pre-C++11 `is_constructible` wrappers in `<type_traits>` only provide up to two arguments. I have added additional wrappers for three arguments, modified the `is_constructible` entry point to take three arguments instead, and added a simple test to is_constructible.pass.cpp. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: krytarowski, cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D41805 llvm-svn: 321963
* Implement p0258r2: has_unique_object_representationsMarshall Clow2018-01-031-0/+104
| | | | llvm-svn: 321685
* [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII.Stephan T. Lavavej2017-12-131-1/+1
| | | | | | | | | | | | | | | benchmarks/util_smartptr.bench.cpp Change CRLF to LF. test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp Consistently comment "\u20ac" as EURO SIGN, its Unicode name, instead of the actual Unicode character. test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp Avoid non-ASCII dash. Fixes D40991. llvm-svn: 320536
* [libcxx] [test] Fix MSVC warnings, null pointer deref.Stephan T. Lavavej2017-12-133-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp Silence MSVC warning C4244. This is expected when passing floating-point values for size. test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Avoid MSVC "warning C4293: '<<': shift count negative or too big, undefined behavior". MSVC sees (1ULL << N) and warns - being guarded by const bool canFit is insufficient. A small change to the code avoids the warning without the need for a pragma. Remove a spurious printf() declaration from to_ullong.pass.cpp. Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was probably copy-pasted. test/std/utilities/tuple/tuple.general/ignore.pass.cpp Use LIBCPP_STATIC_ASSERT for consistency with other files. test/support/container_test_types.h Fix a null pointer dereference, found by MSVC /analyze warning C6011 "Dereferencing NULL pointer 'm_expected_args'." Fixes D41030. llvm-svn: 320535
* [libcxx] P0604, invoke_result and is_invocableZhihao Yuan2017-12-128-291/+349
| | | | | | | | | | | | | | | | | | | | Summary: Introduce a new form of `result_of` without function type encoding. Rename and split `is_callable/is_nothrow_callable` into `is_invocable/is_nothrow_invocable/is_invocable_r/is_nothrow_invocable_r` (and associated types accordingly) Change function type encoding of previous `is_callable/is_nothrow_callable` traits to conventional template type parameter lists. Reviewers: EricWF, mclow.lists, bebuch Reviewed By: EricWF, bebuch Subscribers: lichray, bebuch, cfe-commits Differential Revision: https://reviews.llvm.org/D38831 llvm-svn: 320509
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2017-12-071-1/+1
| | | | llvm-svn: 319994
* Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)Marshall Clow2017-12-052-0/+58
| | | | llvm-svn: 319736
* Fix problems with r'890 when building on machines where sizeof(size_t) != ↵Marshall Clow2017-11-272-6/+3
| | | | | | sizeof(unsigned long long) and C++03 llvm-svn: 319106
* Fix PR#35438 - bitset constructor does not zero unused bitsMarshall Clow2017-11-272-1/+20
| | | | llvm-svn: 319074
* Fix failure on C++03 botsMarshall Clow2017-11-272-0/+6
| | | | llvm-svn: 319042
* Implement LWG#2948: unique_ptr does not define operator<< for stream outputMarshall Clow2017-11-272-0/+60
| | | | llvm-svn: 319038
* More of P0600; marking allocation routines as [[nodiscard]]Marshall Clow2017-11-264-0/+137
| | | | llvm-svn: 318992
* [libcxx] Implement std::to_address for C++20Eric Fiselier2017-11-221-0/+120
| | | | | | | | | | | | | | Summary: Now implements P0653R2 - Utility to convert to raw pointer. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D35470 llvm-svn: 318865
* Add another test_macros.h include I missed to tuple.by.type.pass.cppBilly Robert O'Neal III2017-11-221-0/+1
| | | | llvm-svn: 318830
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-218-17/+17
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* Tolerate even more [[nodiscard]] in the STL. Reviewed as ↵Billy Robert O'Neal III2017-11-154-10/+10
| | | | | | https://reviews.llvm.org/D39080 llvm-svn: 318277
* Tolerate [[nodiscard]] annotations in the STL. Reviewed as ↵Billy Robert O'Neal III2017-11-158-9/+9
| | | | | | https://reviews.llvm.org/D39033 llvm-svn: 318276
* Implement P0550R2: Transformation Trait remove_cvrefMarshall Clow2017-11-131-0/+52
| | | | llvm-svn: 318011
* Add a fail test for aligned_union of an incomplete type. See LWG#2979. NFCMarshall Clow2017-10-311-0/+23
| | | | llvm-svn: 316969
* Placate unused variable warnings uncovered by improvements to clang's ↵Benjamin Kramer2017-10-145-0/+7
| | | | | | -Wunused-variable llvm-svn: 315809
* Remove unneeded typename from testRoger Ferrer Ibanez2017-10-102-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D38628 llvm-svn: 315278
* Fix accidental assignment inside test assertsEric Fiselier2017-10-042-2/+2
| | | | llvm-svn: 314947
* Add C++17 explicit deduction guides to std::pair.Eric Fiselier2017-10-042-3/+84
| | | | | | | This patch adds the newly standardized deduction guides for std::pair, allowing it to work class template deduction. llvm-svn: 314864
* Fix two failing -verify tests to tolerate old and new clang versionsEric Fiselier2017-09-172-5/+5
| | | | llvm-svn: 313502
OpenPOWER on IntegriCloud