summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove <experimental/any>; use <any> instead. See ↵Marshall Clow2018-02-0120-1822/+0
| | | | | | https://libcxx.llvm.org/TS_deprecation.html llvm-svn: 323972
* Remove <experimental/optional>; use <optional> instead. See ↵Marshall Clow2018-02-0166-4317/+0
| | | | | | https://libcxx.llvm.org/TS_deprecation.html llvm-svn: 323971
* Implement LWG2870: Default value of parameter theta of polar should be dependentMarshall Clow2018-01-311-1/+1
| | | | llvm-svn: 323918
* Add tests to make sure that <string_view> provides std::size/data/empty in ↵Marshall Clow2018-01-305-1/+40
| | | | | | C++17 mode. This is LWG#3009, coming up for a vote in JAX - but we already do it, just don't have tests llvm-svn: 323719
* Fix the BinaryPredicate form of std::is_permutation to not rely on operator==Peter Collingbourne2018-01-261-0/+24
| | | | | | | | | | | | | | | | According to [1], forms 2 and 4 of std::is_permutation should use the passed in binary predicate to compare elements. operator== should only be used for forms 1 and 3 which do not take a binary predicate. This CL fixes forms 2 and 4 which relied on operator== for some comparisons. [1] http://en.cppreference.com/w/cpp/algorithm/is_permutation Patch by Thomas Anderson! Differential Revision: https://reviews.llvm.org/D42518 llvm-svn: 323563
* Implement LWG2783: stack::emplace() and queue::emplace() should return ↵Marshall Clow2018-01-242-21/+59
| | | | | | decltype(auto) llvm-svn: 323385
* [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
* [libcxx] Correctly handle invalid regex character class namesMikhail Maltsev2018-01-241-0/+37
| | | | | | | | | | | | | | | | | | | | Summary: Currently when a regular expression contains an invalid character class name std::regex constructors throw an std::regex_error with std::regex_constants::error_brack code. This patch changes the code to std::regex_constants::error_ctype and adds a test. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42291 llvm-svn: 323322
* 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-225-5/+116
| | | | llvm-svn: 323159
* Another batch of P0202 constepr algirithms. ↵Marshall Clow2018-01-226-8/+117
| | | | | | remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy llvm-svn: 323152
* Still more P0202 constexpr-ifying. This batch is: ↵Marshall Clow2018-01-225-6/+96
| | | | | | for_each/for_each_n/lexicographical_compare llvm-svn: 323147
* Add (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n. ↵Marshall Clow2018-01-224-4/+74
| | | | | | These will be enabled when that part of P0202 is implemented. NFC at this time. llvm-svn: 323137
* Really comment out the constexpr tests.Marshall Clow2018-01-222-30/+30
| | | | llvm-svn: 323072
* implement (but leave commented out) the constexpr tests from P0202 for ↵Marshall Clow2018-01-222-2/+47
| | | | | | std::merge. merge requires std::copy, which isn't constexpr yet. llvm-svn: 323070
* More P0202 constexpr work. This commit adds ↵Marshall Clow2018-01-208-10/+155
| | | | | | fill/fill_n/generate/generate_n/unique/unique_copy. I removed a specialization of fill_n that recognized when we were dealing with raw pointers and 1 byte trivially-assignable types and did a memset, because the compiler will do that optimization for us. llvm-svn: 323050
* More P0202 constexpr-ifying in <algorithm>. This commit handles ↵Marshall Clow2018-01-194-6/+82
| | | | | | replace/replace_if/replace_copy/replace_copy_if. llvm-svn: 322975
* More P0202 constexpr-ifying in <algorithm>. This commit handles 'transform'.Marshall Clow2018-01-192-3/+48
| | | | llvm-svn: 322970
* Fix most GCC test failures.Eric Fiselier2018-01-186-15/+61
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix nodiscard failure tests on compilers w/o -verify.Eric Fiselier2018-01-171-1/+1
| | | | | | | | | | | | | Previously .fail.cpp tests for nodiscard were run with -Wunused-result being a warning, not an error, when the compiler didn't support -verify. When -verify isn't enabled this change judiciously adds -Werror=unused-result when to only the failure tests containing the // expected-error string for nodiscard. As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to a test which was only supposed to run in C++ <= 11. llvm-svn: 322776
* More constexpr algorithms from P0202. search/search_nMarshall Clow2018-01-164-4/+79
| | | | llvm-svn: 322566
* More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, ↵Marshall Clow2018-01-1610-22/+155
| | | | | | binary_search llvm-svn: 322529
* Actually CALL the constexpr tests.Marshall Clow2018-01-162-0/+8
| | | | llvm-svn: 322528
* More constexpr (re P0202) - equal and mismatchMarshall Clow2018-01-164-4/+146
| | | | llvm-svn: 322527
* Fix constexpr failure on C++11-based buildbots.Marshall Clow2018-01-151-1/+1
| | | | llvm-svn: 322507
* More constexpr from P0202. count and count_if. Also fix a comment that ↵Marshall Clow2018-01-152-4/+33
| | | | | | Morwenn noted. llvm-svn: 322506
* Some of the tests from earlier today had 'int' as the return type when it ↵Marshall Clow2018-01-1515-15/+15
| | | | | | should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate. llvm-svn: 322505
* More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.Marshall Clow2018-01-159-14/+192
| | | | llvm-svn: 322504
* partition_point gets the P0202 treatmentMarshall Clow2018-01-153-4/+21
| | | | llvm-svn: 322493
* More constexpr algorithms from P0202. any_of/all_of/none_of.Marshall Clow2018-01-153-3/+48
| | | | llvm-svn: 322492
* First part of P0202: Adding constexpr modifiers to functions in <algorithm> ↵Marshall Clow2018-01-1511-8/+173
| | | | | | and <utility>. This commit is all the is_XXX algorithms. llvm-svn: 322489
* Add error code handling to remove_all testEkaterina Vaartis2018-01-121-1/+1
| | | | | | As mentioned by EricWF in revision D41830 llvm-svn: 322351
* [libcxx] Make std::basic_istream::get 0-terminate input array in case of error.Volodymyr Sapsai2018-01-112-0/+124
| | | | | | | | | | | | | | | | | | | It covers the cases when the sentry object returns false and when an exception was thrown. Corresponding standard paragraph is C++14 [istream.unformatted]p9: [...] In any case, if n is greater than zero it then stores a null character into the next successive location of the array. rdar://problem/35566567 Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40677 llvm-svn: 322326
* Make std::experimental::filesystem::remove and remove_all return false or 0 ↵Ekaterina Vaartis2018-01-112-3/+27
| | | | | | | | if the file doesn't exist Differential Revision: https://reviews.llvm.org/D41830 llvm-svn: 322293
* Fix misspelled macro name - thanks to andrew@ispras.ru for the catchMarshall Clow2018-01-101-1/+1
| | | | llvm-svn: 322196
* [libcxx] [test] Improve MSVC portability.Stephan T. Lavavej2018-01-102-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change add_ten to add_one to avoid triggering ubsan integer overflow.Billy Robert O'Neal III2018-01-083-67/+67
| | | | llvm-svn: 322021
* Add the C++17 extensions to std::search. Include the default searcher, but ↵Marshall Clow2018-01-0812-0/+1292
| | | | | | 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
* Add casts to prevent narrowing warnings.Billy Robert O'Neal III2018-01-063-6/+6
| | | | llvm-svn: 321923
* [libcxx] [test] Remove nonstandard things and resolve warnings in Xxx_scan testsBilly Robert O'Neal III2018-01-068-101/+98
| | | | | | | | | | | Reviewed as https://reviews.llvm.org/D41748 * These tests use function objects from functional, back_inserter from iterator, and equal from algorithm, so add those headers. * The use of iota targeting vector<unsigned char> with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&; so change the parameter to unsigned char with a static_cast. * Avoid naming unary_function in identity here as that is removed in '17. (This also fixes naming _VSTD, _NOEXCEPT_, and other libcxx-isms) * Change the predicate in the transform tests to add_ten so that problems with multiple application are caught. llvm-svn: 321922
* Move + and * operators of MoveOnly into MoveOnly.h.Billy Robert O'Neal III2018-01-051-10/+0
| | | | llvm-svn: 321852
* Fix incorrect handling of move-only types in transform_reduce iter iter iter ↵Billy Robert O'Neal III2018-01-051-0/+22
| | | | | | init, and add test. llvm-svn: 321851
* Add move-only types test to transform_reduce iter iter iter init op op.Billy Robert O'Neal III2018-01-051-0/+14
| | | | llvm-svn: 321849
* Add move-only types test for transform_reduce bop/uop.Billy Robert O'Neal III2018-01-051-0/+13
| | | | llvm-svn: 321848
* Fix nonstandard bits in transform_reduce_iter_iter_init_bop_uop.Billy Robert O'Neal III2018-01-051-43/+27
| | | | | | | | * _VSTD should be std. * <utility> is needed for forward. * unary_function is no longer standard (and unnecessary for this, a C++17-only test) llvm-svn: 321847
* Mark LWG2824 as complete. We already did it, but I added a test to be sureMarshall Clow2018-01-031-0/+41
| | | | llvm-svn: 321689
* Implement p0258r2: has_unique_object_representationsMarshall Clow2018-01-031-0/+104
| | | | llvm-svn: 321685
OpenPOWER on IntegriCloud