aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/std/input.output/string.streams/stringstream.cons/string.pass.cpp19
-rw-r--r--test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp8
-rw-r--r--test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp9
3 files changed, 32 insertions, 4 deletions
diff --git a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
index 3776f17f5304..f808bcd14dea 100644
--- a/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
+++ b/test/std/input.output/string.streams/stringstream.cons/string.pass.cpp
@@ -18,6 +18,16 @@
#include <sstream>
#include <cassert>
+template<typename T>
+struct NoDefaultAllocator : std::allocator<T>
+{
+ template<typename U> struct rebind { using other = NoDefaultAllocator<U>; };
+ NoDefaultAllocator(int id_) : id(id_) { }
+ template<typename U> NoDefaultAllocator(const NoDefaultAllocator<U>& a) : id(a.id) { }
+ int id;
+};
+
+
int main()
{
{
@@ -46,4 +56,13 @@ int main()
ss << i << ' ' << 123;
assert(ss.str() == L"456 1236 ");
}
+ { // This is https://bugs.llvm.org/show_bug.cgi?id=33727
+ typedef std::basic_string <char, std::char_traits<char>, NoDefaultAllocator<char> > S;
+ typedef std::basic_stringbuf<char, std::char_traits<char>, NoDefaultAllocator<char> > SB;
+
+ S s(NoDefaultAllocator<char>(1));
+ SB sb(s);
+ // This test is not required by the standard, but *where else* could it get the allocator?
+ assert(sb.str().get_allocator() == s.get_allocator());
+ }
}
diff --git a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
index 78165383a158..d49ba8d1139b 100644
--- a/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
+++ b/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/adopt_lock.pass.cpp
@@ -14,7 +14,7 @@
// template <class ...Mutex> class scoped_lock;
-// scoped_lock(Mutex&..., adopt_lock_t);
+// scoped_lock(adopt_lock_t, Mutex&...);
#include <mutex>
#include <cassert>
@@ -43,7 +43,7 @@ int main()
using LG = std::scoped_lock<TestMutex>;
m1.lock();
{
- LG lg(m1, std::adopt_lock);
+ LG lg(std::adopt_lock, m1);
assert(m1.locked);
}
assert(!m1.locked);
@@ -53,7 +53,7 @@ int main()
using LG = std::scoped_lock<TestMutex, TestMutex>;
m1.lock(); m2.lock();
{
- LG lg(m1, m2, std::adopt_lock);
+ LG lg(std::adopt_lock, m1, m2);
assert(m1.locked && m2.locked);
}
assert(!m1.locked && !m2.locked);
@@ -63,7 +63,7 @@ int main()
using LG = std::scoped_lock<TestMutex, TestMutex, TestMutex>;
m1.lock(); m2.lock(); m3.lock();
{
- LG lg(m1, m2, m3, std::adopt_lock);
+ LG lg(std::adopt_lock, m1, m2, m3);
assert(m1.locked && m2.locked && m3.locked);
}
assert(!m1.locked && !m2.locked && !m3.locked);
diff --git a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
index f3113435f3ce..1696f9cc2320 100644
--- a/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
+++ b/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp
@@ -261,4 +261,13 @@ int main() {
test_copy_ctor_valueless_by_exception();
test_copy_ctor_sfinae();
test_constexpr_copy_ctor_extension();
+#if 0
+// disable this for the moment; it fails on older compilers.
+// Need to figure out which compilers will support it.
+{ // This is the motivating example from P0739R0
+ std::variant<int, double> v1(3);
+ std::variant v2 = v1;
+ (void) v2;
+}
+#endif
}