Marshall Clow
fa1a3d5c91
One more local type warning removed from the tests. NFC
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344421 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-12 21:59:32 +00:00
Eric Fiselier
c39fe08b20
Add diagnostics for min/max algorithms when a InputIterator is used.
...
These algorithms require a ForwardIterator or better. Ensure
we diagnose the contract violation at compile time instead of
of silently doing the wrong thing.
Further algorithms will be audited in upcoming patches.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340426 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-22 17:47:13 +00:00
Stephan T. Lavavej
c538ab0daa
[libcxx] [test] Fix whitespace, NFC.
...
test/std almost always uses spaces; now it is entirely tab-free.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329978 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:22 +00:00
Stephan T. Lavavej
bf3a3685cf
[libcxx] [test] Use TEST_COMPILER_C1XX.
...
Also TEST_COMPILER_CLANG in one place. (More could be changed.)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329977 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:17 +00:00
Stephan T. Lavavej
a2b7665eb2
[libcxx] [test] Strip trailing whitespace, NFC.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324959 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-12 22:54:35 +00:00
Eric Fiselier
b173b26b9e
Work around GCC constexpr initialization bug
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-03 01:48:21 +00:00
Peter Collingbourne
27c341db41
Fix the BinaryPredicate form of std::is_permutation to not rely on operator==
...
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323563 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 21:23:27 +00:00
Marshall Clow
5b12e3bdb4
Last batch of P0202 constexpr additions: includes/set_intersection/exchange
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323159 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 23:10:40 +00:00
Marshall Clow
63be4189d8
Another batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323152 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 21:43:04 +00:00
Marshall Clow
a15161a030
Still more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical_compare
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 20:44:33 +00:00
Marshall Clow
c84b496981
Add (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n. These will be enabled when that part of P0202 is implemented. NFC at this time.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323137 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 18:38:18 +00:00
Marshall Clow
27ae75c894
Really comment out the constexpr tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323072 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 01:51:49 +00:00
Marshall Clow
f7e345ab81
implement (but leave commented out) the constexpr tests from P0202 for std::merge. merge requires std::copy, which isn't constexpr yet.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323070 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-22 00:11:44 +00:00
Marshall Clow
48a4655868
More P0202 constexpr work. This commit adds 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.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323050 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-20 20:14:32 +00:00
Marshall Clow
a75d61347e
More P0202 constexpr-ifying in <algorithm>. This commit handles replace/replace_if/replace_copy/replace_copy_if.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322975 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-19 18:07:29 +00:00
Marshall Clow
ecd1909f5f
More P0202 constexpr-ifying in <algorithm>. This commit handles 'transform'.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322970 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-19 17:45:39 +00:00
Eric Fiselier
457d2c157b
Fix most GCC test failures.
...
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322810 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-18 03:41:06 +00:00
Marshall Clow
d6082200f6
More constexpr algorithms from P0202. search/search_n
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-16 15:48:27 +00:00
Marshall Clow
39b886259e
More constexpr algorithms from P0202: lower_bound, upper_bound, equal_range, binary_search
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-16 02:34:41 +00:00
Marshall Clow
f1caa62ccd
Actually CALL the constexpr tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322528 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-16 02:11:13 +00:00
Marshall Clow
4cd596538b
More constexpr (re P0202) - equal and mismatch
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322527 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-16 02:04:10 +00:00
Marshall Clow
5af38a078e
Fix constexpr failure on C++11-based buildbots.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322507 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:59:09 +00:00
Marshall Clow
0dc8ca7729
More constexpr from P0202. count and count_if. Also fix a comment that Morwenn noted.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322506 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:40:34 +00:00
Marshall Clow
82091c2583
Some of the tests from earlier today had 'int' as the return type when it should have been 'bool'. Fix that. It doesn't change the behavior of any of the tests, but it's more accurate.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322505 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:32:32 +00:00
Marshall Clow
6a1c2ffea4
More P0202 constexpr-ifying. All the find_XXX algorithms in this commit.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322504 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 19:26:05 +00:00
Marshall Clow
bb8010f6f2
partition_point gets the P0202 treatment
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322493 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 17:53:34 +00:00
Marshall Clow
de4b2869d7
More constexpr algorithms from P0202. any_of/all_of/none_of.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322492 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 17:20:36 +00:00
Marshall Clow
8d0d82585a
First part of P0202: Adding constexpr modifiers to functions in <algorithm> and <utility>. This commit is all the is_XXX algorithms.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322489 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 16:16:32 +00:00
Marshall Clow
210d12c946
Fix misspelled macro name - thanks to andrew@ispras.ru for the catch
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322196 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10 16:25:04 +00:00
Marshall Clow
334063336b
Add the C++17 extensions to std::search. Include the default searcher, but 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
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 19:18:00 +00:00
Stephan T. Lavavej
dd2a900c0b
[libcxx] [test] Fix MSVC warnings, null pointer deref.
...
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@320535 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 00:51:27 +00:00
Marshall Clow
aeded2bf6e
Fix PR#35948: generate_n does not accept floating point Size arguments.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@319675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 18:59:14 +00:00
Billy Robert O'Neal III
7e250fcdc1
Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Billy Robert O'Neal III
b981667776
Tolerate even more [[nodiscard]] in the STL. Reviewed as https://reviews.llvm.org/D39080
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318277 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:45:07 +00:00
Marshall Clow
3b8f03d964
Mark test as unsupported on C++98/03, since it uses move_iterator
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316917 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 16:07:59 +00:00
Marshall Clow
c3fa9655a4
Fix PR#35119 : set_union misbehaves with move_iterators. Thanks to Denis Yaroshevskiy for both the bug report and the fix.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316914 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 15:50:00 +00:00
Marshall Clow
90dfa2804a
Fix test for C++03
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@311967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-29 01:10:51 +00:00
Marshall Clow
25a78dcd77
Fix PR31166: std::inplace_merge seems to be unstable. Thanks to Jan Wilken Dörrie for the suggested fix.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@311952 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28 23:16:13 +00:00
Stephan T. Lavavej
5d91f314f1
[libcxx] [test] Change comments to say C++ instead of c++. NFC.
...
This makes them consistent (many comments already used uppercase).
The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +00:00
Stephan T. Lavavej
a686caad20
[libcxx] [test] Untabify, NFC.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Stephan T. Lavavej
b836deb5db
[libcxx] [test] Strip trailing whitespace. NFC.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Marshall Clow
10411c1626
Add non-parallel version of for_each_n (+tests) from the Parallelism TS
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303833 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 02:29:54 +00:00
Stephan T. Lavavej
559442652c
[libcxx] [test] Strip trailing whitespace. NFC.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 01:43:58 +00:00
Eric Fiselier
6b17a7ba2c
Cleanup _LIBCPP_HAS_NO_<c++11-feature> in algorithm
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300625 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-18 23:26:47 +00:00
Marshall Clow
50e32f569c
Update the algorithm tests to not use the (deprecated) function binders. No functional change.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 16:13:50 +00:00
Marshall Clow
699c414d73
Use 'REQUIRES: c++98 || c++03 || c++11 || c++14' instead of the deprecated 'REQUIRES-ANY: c++98, c++03, c++11, c++14'
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298600 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 14:20:43 +00:00
Marshall Clow
03b862f6ea
Remove random_shuffle in C++17. Please use shuffle instead. If you have to, you cant get it back by defining _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE before including any libc++ headers.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298597 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 13:43:37 +00:00
Marshall Clow
426546ecec
Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07 18:41:25 +00:00
Eric Fiselier
a2cd270943
Enable the -Wsign-compare warning to better support MSVC
...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 05:31:00 +00:00
Stephan T. Lavavej
f1cc7ff4c9
[libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 6/7.
...
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
(Affects 64-bit architectures.) Include <cstddef> so we can take/return std::ptrdiff_t
(instead of int) in random_shuffle()'s RNG. (C++14 D.12 [depr.alg.random.shuffle]/2 says that
difference_type is used, and we're shuffling a plain array.)
test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp
(Affects 64-bit architectures.) Include <iterator> because we're already using iterator_traits.
Then, store the result of subtracting two RanIts as difference_type instead of long
(which truncates on LLP64 architectures like MSVC x64).
test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp
test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp
(Affects 64-bit architectures.) Include <cstddef> so we can store the result of
subtracting two pointers as std::ptrdiff_t (instead of int).
test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp
(Affects 32-bit architectures.) Sometimes, size_t is too small. That's the case here,
where tellg() returns pos_type (N4606 27.7.2.3 [istream.unformatted]/39). Implementations can
have 64-bit pos_type (to handle large files) even when they have 32-bit size_t.
Fixes D27543.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289110 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 21:38:44 +00:00