summaryrefslogtreecommitdiff
path: root/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp')
-rw-r--r--test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp b/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
index c72adac9e2e4..1c08fee40bc2 100644
--- a/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp
+++ b/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
}