summaryrefslogtreecommitdiff
path: root/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
diff options
context:
space:
mode:
authorNikolas Klauser <nikolasklauser@berlin.de>2022-03-10 20:15:23 +0100
committerNikolas Klauser <nikolasklauser@berlin.de>2022-03-19 18:48:14 +0100
commit85e9b2687a13d1908aa86d1b89c5ce398a06cd39 (patch)
treed6f50807591d6db709d232d85c91bc477e3e4034 /libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
parent1bcc28b884ff4fbe2ecc011b8ea2b84e7987167b (diff)
[libc++] Prepare string tests for constexpr
These are the lastâ„¢ changes to the tests for constexpr preparation. Reviewed By: Quuxplusone, #libc, Mordante Spies: Mordante, EricWF, libcxx-commits Differential Revision: https://reviews.llvm.org/D120951
Diffstat (limited to 'libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp')
-rw-r--r--libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index fd96af4c550e..07d84a7d5c2c 100644
--- a/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -172,7 +172,7 @@ bool test() {
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
- { // test iterator operations that throw
+ if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef cpp17_input_iterator<TIter> IIter;
@@ -219,17 +219,20 @@ bool test() {
std::string s_short = "hello";
std::string s_long = "Lorem ipsum dolor sit amet, consectetur/";
std::string s_othertype = "hello";
- const unsigned char *first = reinterpret_cast<const unsigned char*>(s_othertype.data());
std::string s_sneaky = "hello";
test(s_short, s_short.data() + s_short.size(), s_short.data() + s_short.size() + 1,
std::string("hello\0", 6));
test(s_long, s_long.data() + s_long.size(), s_long.data() + s_long.size() + 1,
std::string("Lorem ipsum dolor sit amet, consectetur/\0", 41));
- test(s_othertype, first + 2, first + 5, std::string("hellollo"));
s_sneaky.reserve(12);
test(s_sneaky, s_sneaky.data(), s_sneaky.data() + 6, std::string("hellohello\0", 11));
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ const unsigned char *first = reinterpret_cast<const unsigned char*>(s_othertype.data());
+ test(s_othertype, first + 2, first + 5, std::string("hellollo"));
+ }
}
{ // test with a move iterator that returns char&&