diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2018-01-20 20:14:32 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2018-01-20 20:14:32 +0000 |
commit | 4bfb9313c1ede05d3d59571faace20cd810e1fb9 (patch) | |
tree | 0d3ab7d6bd8a9f75caf8a2e4efa608a352052f91 /libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp | |
parent | 52fa0e9300892bfe982b948136c91c512170200c (diff) | |
download | bcm5719-llvm-4bfb9313c1ede05d3d59571faace20cd810e1fb9.tar.gz bcm5719-llvm-4bfb9313c1ede05d3d59571faace20cd810e1fb9.zip |
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.
llvm-svn: 323050
Diffstat (limited to 'libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp')
-rw-r--r-- | libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp index c72adac9e2e..8b9e109d7be 100644 --- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp +++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp @@ -11,14 +11,26 @@ // template<ForwardIterator Iter, class T> // requires OutputIterator<Iter, const T&> -// void +// constexpr void // constexpr after C++17 // fill(Iter first, Iter last, const T& value); #include <algorithm> #include <cassert> +#include "test_macros.h" #include "test_iterators.h" +#if TEST_STD_VER > 17 +TEST_CONSTEXPR bool test_constexpr() { + int ia[] = {0, 1, 2, 3, 4}; + + std::fill(std::begin(ia), std::end(ia), 5); + + return std::all_of(std::begin(ia), std::end(ia), [](int a) {return a == 5; }) + ; + } +#endif + template <class Iter> void test_char() @@ -56,4 +68,8 @@ int main() test_int<bidirectional_iterator<int*> >(); test_int<random_access_iterator<int*> >(); test_int<int*>(); + +#if TEST_STD_VER > 17 + static_assert(test_constexpr()); +#endif } |