libcxx initial import

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/thread/futures/futures.overview/future_errc.pass.cpp b/test/thread/futures/futures.overview/future_errc.pass.cpp
new file mode 100644
index 0000000..45ee779
--- /dev/null
+++ b/test/thread/futures/futures.overview/future_errc.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <future>
+
+// enum class future_errc
+// {
+//     broken_promise,
+//     future_already_retrieved,
+//     promise_already_satisfied,
+//     no_state
+// };
+
+#include <future>
+
+int main()
+{
+    static_assert(std::future_errc::broken_promise == 0, "");
+    static_assert(std::future_errc::future_already_retrieved == 1, "");
+    static_assert(std::future_errc::promise_already_satisfied == 2, "");
+    static_assert(std::future_errc::no_state == 3, "");
+}
diff --git a/test/thread/futures/futures.overview/future_status.pass.cpp b/test/thread/futures/futures.overview/future_status.pass.cpp
new file mode 100644
index 0000000..e783ca7
--- /dev/null
+++ b/test/thread/futures/futures.overview/future_status.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <future>
+
+// enum class future_status
+// {
+//     ready,
+//     timeout,
+//     deferred
+// };
+
+#include <future>
+
+int main()
+{
+    static_assert(std::future_status::ready == 0, "");
+    static_assert(std::future_status::timeout == 1, "");
+    static_assert(std::future_status::deferred == 2, "");
+}
diff --git a/test/thread/futures/futures.overview/launch.pass.cpp b/test/thread/futures/futures.overview/launch.pass.cpp
new file mode 100644
index 0000000..1c308e4
--- /dev/null
+++ b/test/thread/futures/futures.overview/launch.pass.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <future>
+
+// enum class launch
+// {
+//     any,
+//     async,
+//     sync
+// };
+
+#include <future>
+
+int main()
+{
+    static_assert(std::launch::any == 0, "");
+    static_assert(std::launch::async == 1, "");
+    static_assert(std::launch::sync == 2, "");
+}
diff --git a/test/thread/futures/version.pass.cpp b/test/thread/futures/version.pass.cpp
new file mode 100644
index 0000000..2cfe55d
--- /dev/null
+++ b/test/thread/futures/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <future>
+
+#include <future>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/thread/macro.pass.cpp b/test/thread/macro.pass.cpp
new file mode 100644
index 0000000..baa2e5c
--- /dev/null
+++ b/test/thread/macro.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// #define __STDCPP_THREADS __cplusplus
+
+#include <thread>
+
+int main()
+{
+#ifndef __STDCPP_THREADS
+#error __STDCPP_THREADS is not defined
+#endif
+}
diff --git a/test/thread/thread.condition/cv_status.pass.cpp b/test/thread/thread.condition/cv_status.pass.cpp
new file mode 100644
index 0000000..be2e9a3
--- /dev/null
+++ b/test/thread/thread.condition/cv_status.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// enum class cv_status { no_timeout, timeout };
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    assert(std::cv_status::no_timeout == 0);
+    assert(std::cv_status::timeout == 1);
+}
diff --git a/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp b/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
new file mode 100644
index 0000000..4fcb369
--- /dev/null
+++ b/test/thread/thread.condition/notify_all_at_thread_exit.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// void
+//   notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+#error notify_all_at_thread_exit not implemented
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp b/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp
new file mode 100644
index 0000000..4d8d6d6
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/assign.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// condition_variable& operator=(const condition_variable&) = delete;
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable cv0;
+    std::condition_variable cv1;
+    cv1 = cv0;
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp b/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp
new file mode 100644
index 0000000..c302d6a
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/copy.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// condition_variable(const condition_variable&) = delete;
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable cv0;
+    std::condition_variable cv1(cv0);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp
new file mode 100644
index 0000000..71cb830
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/default.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// condition_variable();
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable cv;
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp
new file mode 100644
index 0000000..72382ad
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/destructor.pass.cpp
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// ~condition_variable();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable* cv;
+std::mutex m;
+typedef std::unique_lock<std::mutex> Lock;
+
+bool f_ready = false;
+bool g_ready = false;
+
+void f()
+{
+    Lock lk(m);
+    f_ready = true;
+    cv->notify_one();
+    delete cv;
+}
+
+void g()
+{
+    Lock lk(m);
+    g_ready = true;
+    cv->notify_one();
+    while (!f_ready)
+        cv->wait(lk);
+}
+
+int main()
+{
+    cv = new std::condition_variable;
+    std::thread th2(g);
+    Lock lk(m);
+    while (!g_ready)
+        cv->wait(lk);
+    lk.unlock();
+    std::thread th1(f);
+    th1.join();
+    th2.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
new file mode 100644
index 0000000..e73ca3c
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// typedef pthread_cond_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    static_assert((std::is_same<std::condition_variable::native_handle_type,
+                                pthread_cond_t*>::value), "");
+    std::condition_variable cv;
+    std::condition_variable::native_handle_type h = cv.native_handle();
+    assert(h != nullptr);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp
new file mode 100644
index 0000000..a652f2a
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/notify_all.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// void notify_all();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test0 = 0;
+int test1 = 0;
+int test2 = 0;
+
+void f1()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 == 1);
+    test1 = 2;
+}
+
+void f2()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 == 1);
+    test2 = 2;
+}
+
+int main()
+{
+    std::thread t1(f1);
+    std::thread t2(f2);
+    std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        test1 = 1;
+        test2 = 1;
+    }
+    cv.notify_all();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        std::unique_lock<std::mutex>lk(mut);
+    }
+    t1.join();
+    t2.join();
+    assert(test1 == 2);
+    assert(test2 == 2);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
new file mode 100644
index 0000000..55c7073
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/notify_one.pass.cpp
@@ -0,0 +1,92 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// void notify_one();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test0 = 0;
+int test1 = 0;
+int test2 = 0;
+
+void f1()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 == 1);
+    test1 = 2;
+}
+
+void f2()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 == 1);
+    test2 = 2;
+}
+
+int main()
+{
+    std::thread t1(f1);
+    std::thread t2(f2);
+    std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        test1 = 1;
+        test2 = 1;
+    }
+    cv.notify_one();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        std::unique_lock<std::mutex>lk(mut);
+    }
+    if (test1 == 2)
+    {
+        t1.join();
+        test1 = 0;
+    }
+    else if (test2 == 2)
+    {
+        t2.join();
+        test2 = 0;
+    }
+    else
+        assert(false);
+    cv.notify_one();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        std::unique_lock<std::mutex>lk(mut);
+    }
+    if (test1 == 2)
+    {
+        t1.join();
+        test1 = 0;
+    }
+    else if (test2 == 2)
+    {
+        t2.join();
+        test2 = 0;
+    }
+    else
+        assert(false);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp
new file mode 100644
index 0000000..793278d
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// void wait(unique_lock<mutex>& lock);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+void f()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 != 0);
+}
+
+int main()
+{
+    std::unique_lock<std::mutex>lk(mut);
+    std::thread t(f);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 != 0);
+    test2 = 1;
+    lk.unlock();
+    cv.notify_one();
+    t.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
new file mode 100644
index 0000000..ebe8510
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_for.pass.cpp
@@ -0,0 +1,85 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// template <class Rep, class Period>
+//     cv_status
+//     wait_for(unique_lock<mutex>& lock,
+//              const chrono::duration<Rep, Period>& rel_time);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds milliseconds;
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    while (test2 == 0 &&
+           cv.wait_for(lk, milliseconds(250)) == std::cv_status::no_timeout)
+        ;
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < milliseconds(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - milliseconds(250) < milliseconds(5));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
new file mode 100644
index 0000000..d2cf615
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
@@ -0,0 +1,93 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// template <class Rep, class Period, class Predicate>
+//     bool
+//     wait_for(unique_lock<mutex>& lock,
+//              const chrono::duration<Rep, Period>& rel_time,
+//              Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds milliseconds;
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    bool r = cv.wait_for(lk, milliseconds(250), Pred(test2));
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < milliseconds(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - milliseconds(250) < milliseconds(2));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp
new file mode 100644
index 0000000..7aea96f
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_pred.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// template <class Predicate>
+//   void wait(unique_lock<mutex>& lock, Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <functional>
+#include <cassert>
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+void f()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    cv.wait(lk, Pred(test2));
+    assert(test2 != 0);
+}
+
+int main()
+{
+    std::unique_lock<std::mutex>lk(mut);
+    std::thread t(f);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 != 0);
+    test2 = 1;
+    lk.unlock();
+    cv.notify_one();
+    t.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp
new file mode 100644
index 0000000..921891d
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_until.pass.cpp
@@ -0,0 +1,100 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// template <class Clock, class Duration>
+//   cv_status
+//   wait_until(unique_lock<mutex>& lock,
+//              const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+struct Clock
+{
+    typedef std::chrono::milliseconds duration;
+    typedef duration::rep             rep;
+    typedef duration::period          period;
+    typedef std::chrono::time_point<Clock> time_point;
+    static const bool is_monotonic =  true;
+
+    static time_point now()
+    {
+        using namespace std::chrono;
+        return time_point(duration_cast<duration>(
+                monotonic_clock::now().time_since_epoch()
+                                                 ));
+    }
+};
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    Clock::time_point t = t0 + Clock::duration(250);
+    while (test2 == 0 && cv.wait_until(lk, t) == std::cv_status::no_timeout)
+        ;
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < Clock::duration(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - Clock::duration(250) < Clock::duration(5));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp
new file mode 100644
index 0000000..0eb4825
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvar/wait_until_pred.pass.cpp
@@ -0,0 +1,111 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable;
+
+// template <class Clock, class Duration, class Predicate>
+//     bool
+//     wait_until(unique_lock<mutex>& lock,
+//                const chrono::time_point<Clock, Duration>& abs_time,
+//                Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+struct Clock
+{
+    typedef std::chrono::milliseconds duration;
+    typedef duration::rep             rep;
+    typedef duration::period          period;
+    typedef std::chrono::time_point<Clock> time_point;
+    static const bool is_monotonic =  true;
+
+    static time_point now()
+    {
+        using namespace std::chrono;
+        return time_point(duration_cast<duration>(
+                monotonic_clock::now().time_since_epoch()
+                                                 ));
+    }
+};
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+std::condition_variable cv;
+std::mutex mut;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    std::unique_lock<std::mutex> lk(mut);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    Clock::time_point t = t0 + Clock::duration(250);
+    bool r = cv.wait_until(lk, t, Pred(test2));
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < Clock::duration(250));
+        assert(test2 != 0);
+        assert(r);
+    }
+    else
+    {
+        assert(t1 - t0 - Clock::duration(250) < Clock::duration(2));
+        assert(test2 == 0);
+        assert(!r);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        std::unique_lock<std::mutex>lk(mut);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp b/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp
new file mode 100644
index 0000000..539140d
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/assign.fail.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// condition_variable_any& operator=(const condition_variable_any&) = delete;
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable_any cv0;
+    std::condition_variable_any cv1;
+    cv1 = cv0;
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp b/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp
new file mode 100644
index 0000000..dc3971d
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/copy.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// condition_variable_any(const condition_variable_any&) = delete;
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable_any cv0;
+    std::condition_variable_any cv1(cv0);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp
new file mode 100644
index 0000000..71fa472
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/default.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// condition_variable_any();
+
+#include <condition_variable>
+#include <cassert>
+
+int main()
+{
+    std::condition_variable_any cv;
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp
new file mode 100644
index 0000000..f891816
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/destructor.pass.cpp
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// ~condition_variable_any();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable_any* cv;
+std::mutex m;
+
+bool f_ready = false;
+bool g_ready = false;
+
+void f()
+{
+    m.lock();
+    f_ready = true;
+    cv->notify_one();
+    delete cv;
+    m.unlock();
+}
+
+void g()
+{
+    m.lock();
+    g_ready = true;
+    cv->notify_one();
+    while (!f_ready)
+        cv->wait(m);
+    m.unlock();
+}
+
+int main()
+{
+    cv = new std::condition_variable_any;
+    std::thread th2(g);
+    m.lock();
+    while (!g_ready)
+        cv->wait(m);
+    m.unlock();
+    std::thread th1(f);
+    th1.join();
+    th2.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp
new file mode 100644
index 0000000..1620239
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/notify_all.pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// void notify_all();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test0 = 0;
+int test1 = 0;
+int test2 = 0;
+
+void f1()
+{
+    L1 lk(m0);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 == 1);
+    test1 = 2;
+}
+
+void f2()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 == 1);
+    test2 = 2;
+}
+
+int main()
+{
+    std::thread t1(f1);
+    std::thread t2(f2);
+    std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    {
+        L1 lk(m0);
+        test1 = 1;
+        test2 = 1;
+    }
+    cv.notify_all();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        L1 lk(m0);
+    }
+    t1.join();
+    t2.join();
+    assert(test1 == 2);
+    assert(test2 == 2);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
new file mode 100644
index 0000000..9d6f25e
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/notify_one.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// void notify_one();
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test0 = 0;
+int test1 = 0;
+int test2 = 0;
+
+void f1()
+{
+    L1 lk(m0);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 == 1);
+    test1 = 2;
+}
+
+void f2()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 == 1);
+    test2 = 2;
+}
+
+int main()
+{
+    std::thread t1(f1);
+    std::thread t2(f2);
+    std::this_thread::sleep_for(std::chrono::milliseconds(100));
+    {
+        L1 lk(m0);
+        test1 = 1;
+        test2 = 1;
+    }
+    cv.notify_one();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        L1 lk(m0);
+    }
+    if (test1 == 2)
+    {
+        t1.join();
+        test1 = 0;
+    }
+    else if (test2 == 2)
+    {
+        t2.join();
+        test2 = 0;
+    }
+    else
+        assert(false);
+    cv.notify_one();
+    {
+        std::this_thread::sleep_for(std::chrono::milliseconds(100));
+        L1 lk(m0);
+    }
+    if (test1 == 2)
+    {
+        t1.join();
+        test1 = 0;
+    }
+    else if (test2 == 2)
+    {
+        t2.join();
+        test2 = 0;
+    }
+    else
+        assert(false);
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp
new file mode 100644
index 0000000..ac36012
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock>
+//   void wait(Lock& lock);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+void f()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    while (test2 == 0)
+        cv.wait(lk);
+    assert(test2 != 0);
+}
+
+int main()
+{
+    L1 lk(m0);
+    std::thread t(f);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 != 0);
+    test2 = 1;
+    lk.unlock();
+    cv.notify_one();
+    t.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp
new file mode 100644
index 0000000..d9108e7
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_for.pass.cpp
@@ -0,0 +1,88 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock, class Rep, class Period>
+//   cv_status
+//   wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds milliseconds;
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    while (test2 == 0 &&
+           cv.wait_for(lk, milliseconds(250)) == std::cv_status::no_timeout)
+        ;
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < milliseconds(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - milliseconds(250) < milliseconds(5));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
new file mode 100644
index 0000000..5a30c84
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_for_pred.pass.cpp
@@ -0,0 +1,96 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock, class Rep, class Period, class Predicate>
+//   bool
+//   wait_for(Lock& lock, const chrono::duration<Rep, Period>& rel_time,
+//            Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef std::chrono::milliseconds milliseconds;
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    bool r = cv.wait_for(lk, milliseconds(250), Pred(test2));
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < milliseconds(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - milliseconds(250) < milliseconds(2));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp
new file mode 100644
index 0000000..d764458
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_pred.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock, class Predicate>
+//   void wait(Lock& lock, Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <functional>
+#include <cassert>
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+void f()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    cv.wait(lk, Pred(test2));
+    assert(test2 != 0);
+}
+
+int main()
+{
+    L1 lk(m0);
+    std::thread t(f);
+    assert(test1 == 0);
+    while (test1 == 0)
+        cv.wait(lk);
+    assert(test1 != 0);
+    test2 = 1;
+    lk.unlock();
+    cv.notify_one();
+    t.join();
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp
new file mode 100644
index 0000000..145ec87
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_until.pass.cpp
@@ -0,0 +1,103 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock, class Clock, class Duration>
+//   cv_status
+//   wait_until(Lock& lock, const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+struct Clock
+{
+    typedef std::chrono::milliseconds duration;
+    typedef duration::rep             rep;
+    typedef duration::period          period;
+    typedef std::chrono::time_point<Clock> time_point;
+    static const bool is_monotonic =  true;
+
+    static time_point now()
+    {
+        using namespace std::chrono;
+        return time_point(duration_cast<duration>(
+                monotonic_clock::now().time_since_epoch()
+                                                 ));
+    }
+};
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    Clock::time_point t = t0 + Clock::duration(250);
+    while (test2 == 0 && cv.wait_until(lk, t) == std::cv_status::no_timeout)
+        ;
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < Clock::duration(250));
+        assert(test2 != 0);
+    }
+    else
+    {
+        assert(t1 - t0 - Clock::duration(250) < Clock::duration(5));
+        assert(test2 == 0);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp b/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp
new file mode 100644
index 0000000..8cc94d7
--- /dev/null
+++ b/test/thread/thread.condition/thread.condition.condvarany/wait_until_pred.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+// class condition_variable_any;
+
+// template <class Lock, class Duration, class Predicate>
+//     bool
+//     wait_until(Lock& lock,
+//                const chrono::time_point<Clock, Duration>& abs_time,
+//                Predicate pred);
+
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <chrono>
+#include <cassert>
+
+struct Clock
+{
+    typedef std::chrono::milliseconds duration;
+    typedef duration::rep             rep;
+    typedef duration::period          period;
+    typedef std::chrono::time_point<Clock> time_point;
+    static const bool is_monotonic =  true;
+
+    static time_point now()
+    {
+        using namespace std::chrono;
+        return time_point(duration_cast<duration>(
+                monotonic_clock::now().time_since_epoch()
+                                                 ));
+    }
+};
+
+class Pred
+{
+    int& i_;
+public:
+    explicit Pred(int& i) : i_(i) {}
+
+    bool operator()() {return i_ != 0;}
+};
+
+std::condition_variable_any cv;
+
+typedef std::timed_mutex L0;
+typedef std::unique_lock<L0> L1;
+
+L0 m0;
+
+int test1 = 0;
+int test2 = 0;
+
+int runs = 0;
+
+void f()
+{
+    L1 lk(m0);
+    assert(test2 == 0);
+    test1 = 1;
+    cv.notify_one();
+    Clock::time_point t0 = Clock::now();
+    Clock::time_point t = t0 + Clock::duration(250);
+    bool r = cv.wait_until(lk, t, Pred(test2));
+    Clock::time_point t1 = Clock::now();
+    if (runs == 0)
+    {
+        assert(t1 - t0 < Clock::duration(250));
+        assert(test2 != 0);
+        assert(r);
+    }
+    else
+    {
+        assert(t1 - t0 - Clock::duration(250) < Clock::duration(2));
+        assert(test2 == 0);
+        assert(!r);
+    }
+    ++runs;
+}
+
+int main()
+{
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        test2 = 1;
+        lk.unlock();
+        cv.notify_one();
+        t.join();
+    }
+    test1 = 0;
+    test2 = 0;
+    {
+        L1 lk(m0);
+        std::thread t(f);
+        assert(test1 == 0);
+        while (test1 == 0)
+            cv.wait(lk);
+        assert(test1 != 0);
+        lk.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.condition/version.pass.cpp b/test/thread/thread.condition/version.pass.cpp
new file mode 100644
index 0000000..e252025
--- /dev/null
+++ b/test/thread/thread.condition/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <condition_variable>
+
+#include <condition_variable>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/thread/thread.general/nothing_to_do.pass.cpp b/test/thread/thread.general/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.general/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
new file mode 100644
index 0000000..df3e7fb
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
@@ -0,0 +1,505 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class L1, class L2, class... L3>
+//   void lock(L1&, L2&, L3&...);
+
+#include <mutex>
+#include <cassert>
+
+class L0
+{
+    bool locked_;
+
+public:
+    L0() : locked_(false) {}
+
+    void lock()
+    {
+        locked_ = true;
+    }
+
+    bool try_lock()
+    {
+        locked_ = true;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+class L1
+{
+    bool locked_;
+
+public:
+    L1() : locked_(false) {}
+
+    void lock()
+    {
+        locked_ = true;
+    }
+
+    bool try_lock()
+    {
+        locked_ = false;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+class L2
+{
+    bool locked_;
+
+public:
+    L2() : locked_(false) {}
+
+    void lock()
+    {
+        throw 1;
+    }
+
+    bool try_lock()
+    {
+        throw 1;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+int main()
+{
+    {
+        L0 l0;
+        L0 l1;
+        std::lock(l0, l1);
+        assert(l0.locked());
+        assert(l1.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        std::lock(l0, l1);
+        assert(l0.locked());
+        assert(l1.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        std::lock(l0, l1);
+        assert(l0.locked());
+        assert(l1.locked());
+    }
+    {
+        L0 l0;
+        L2 l1;
+        try
+        {
+            std::lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        try
+        {
+            std::lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+    {
+        L1 l0;
+        L2 l1;
+        try
+        {
+            std::lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+    {
+        L2 l0;
+        L1 l1;
+        try
+        {
+            std::lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+    {
+        L2 l0;
+        L2 l1;
+        try
+        {
+            std::lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        std::lock(l0, l1, l2);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L1 l2;
+        std::lock(l0, l1, l2);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L0 l2;
+        std::lock(l0, l1, l2);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L0 l2;
+        std::lock(l0, l1, l2);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L0 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L0 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L0 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L1 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L1 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L1 l0;
+        L2 l1;
+        L2 l2;
+        try
+        {
+            std::lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        L0 l3;
+        std::lock(l0, l1, l2, l3);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        L1 l3;
+        std::lock(l0, l1, l2, l3);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L1 l2;
+        L0 l3;
+        std::lock(l0, l1, l2, l3);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L0 l2;
+        L0 l3;
+        std::lock(l0, l1, l2, l3);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L0 l2;
+        L0 l3;
+        std::lock(l0, l1, l2, l3);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        L2 l3;
+        try
+        {
+            std::lock(l0, l1, l2, l3);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+            assert(!l3.locked());
+        }
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L2 l2;
+        L0 l3;
+        try
+        {
+            std::lock(l0, l1, l2, l3);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+            assert(!l3.locked());
+        }
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L0 l2;
+        L0 l3;
+        try
+        {
+            std::lock(l0, l1, l2, l3);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+            assert(!l3.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L0 l2;
+        L0 l3;
+        try
+        {
+            std::lock(l0, l1, l2, l3);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+            assert(!l3.locked());
+        }
+    }
+#endif
+}
diff --git a/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
new file mode 100644
index 0000000..121fc6d
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
@@ -0,0 +1,516 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class L1, class L2, class... L3>
+//   int try_lock(L1&, L2&, L3&...);
+
+#include <mutex>
+#include <cassert>
+
+class L0
+{
+    bool locked_;
+
+public:
+    L0() : locked_(false) {}
+
+    bool try_lock()
+    {
+        locked_ = true;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+class L1
+{
+    bool locked_;
+
+public:
+    L1() : locked_(false) {}
+
+    bool try_lock()
+    {
+        locked_ = false;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+class L2
+{
+    bool locked_;
+
+public:
+    L2() : locked_(false) {}
+
+    bool try_lock()
+    {
+        throw 1;
+        return locked_;
+    }
+
+    void unlock() {locked_ = false;}
+
+    bool locked() const {return locked_;}
+};
+
+
+
+int main()
+{
+    {
+        L0 l0;
+        L0 l1;
+        assert(std::try_lock(l0, l1) == -1);
+        assert(l0.locked());
+        assert(l1.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        assert(std::try_lock(l0, l1) == 1);
+        assert(!l0.locked());
+        assert(!l1.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        assert(std::try_lock(l0, l1) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+    }
+    {
+        L0 l0;
+        L2 l1;
+        try
+        {
+            std::try_lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        try
+        {
+            std::try_lock(l0, l1);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+        }
+    }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        assert(std::try_lock(l0, l1, l2) == -1);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+    }
+    {
+        L1 l0;
+        L1 l1;
+        L1 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L2 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L2 l2;
+        assert(std::try_lock(l0, l1, l2) == 1);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L1 l2;
+        assert(std::try_lock(l0, l1, l2) == 2);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L0 l2;
+        assert(std::try_lock(l0, l1, l2) == 1);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L0 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L2 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L0 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L0 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L1 l0;
+        L1 l1;
+        L0 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L1 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L1 l2;
+        assert(std::try_lock(l0, l1, l2) == 1);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L1 l0;
+        L1 l1;
+        L2 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L1 l0;
+        L2 l1;
+        L1 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L2 l0;
+        L1 l1;
+        L1 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L0 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L2 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L2 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L2 l1;
+        L1 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L1 l1;
+        L2 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L1 l0;
+        L2 l1;
+        L2 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L0 l0;
+        L2 l1;
+        L1 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L2 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L1 l0;
+        L2 l1;
+        L0 l2;
+        assert(std::try_lock(l0, l1, l2) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+    }
+    {
+        L2 l0;
+        L0 l1;
+        L1 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L2 l0;
+        L1 l1;
+        L0 l2;
+        try
+        {
+            std::try_lock(l0, l1, l2);
+            assert(false);
+        }
+        catch (int)
+        {
+            assert(!l0.locked());
+            assert(!l1.locked());
+            assert(!l2.locked());
+        }
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        L0 l3;
+        assert(std::try_lock(l0, l1, l2, l3) == -1);
+        assert(l0.locked());
+        assert(l1.locked());
+        assert(l2.locked());
+        assert(l3.locked());
+    }
+    {
+        L1 l0;
+        L0 l1;
+        L0 l2;
+        L0 l3;
+        assert(std::try_lock(l0, l1, l2, l3) == 0);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+        assert(!l3.locked());
+    }
+    {
+        L0 l0;
+        L1 l1;
+        L0 l2;
+        L0 l3;
+        assert(std::try_lock(l0, l1, l2, l3) == 1);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+        assert(!l3.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L1 l2;
+        L0 l3;
+        assert(std::try_lock(l0, l1, l2, l3) == 2);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+        assert(!l3.locked());
+    }
+    {
+        L0 l0;
+        L0 l1;
+        L0 l2;
+        L1 l3;
+        assert(std::try_lock(l0, l1, l2, l3) == 3);
+        assert(!l0.locked());
+        assert(!l1.locked());
+        assert(!l2.locked());
+        assert(!l3.locked());
+    }
+#endif
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
new file mode 100644
index 0000000..868f7a4
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard(mutex_type& m, adopt_lock_t);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    time_point t1;
+    {
+    m.lock();
+    std::lock_guard<std::mutex> lg(m, std::adopt_lock);
+    t1 = Clock::now();
+    }
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp
new file mode 100644
index 0000000..2828c4f
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/assign.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard& operator=(lock_guard const&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::mutex m0;
+    std::mutex m1;
+    std::lock_guard<std::mutex> lg0(m0);
+    std::lock_guard<std::mutex> lg(m1);
+    lg = lg0;
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp
new file mode 100644
index 0000000..5c0433b
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/copy.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard(lock_guard const&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::mutex m;
+    std::lock_guard<std::mutex> lg0(m);
+    std::lock_guard<std::mutex> lg(lg0);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
new file mode 100644
index 0000000..e1e781f
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.fail.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class lock_guard;
+
+// explicit lock_guard(mutex_type& m);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    time_point t1;
+    {
+    std::lock_guard<std::mutex> lg = m;
+    t1 = Clock::now();
+    }
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
new file mode 100644
index 0000000..985af8e
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class lock_guard;
+
+// explicit lock_guard(mutex_type& m);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    time_point t1;
+    {
+    std::lock_guard<std::mutex> lg(m);
+    t1 = Clock::now();
+    }
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp
new file mode 100644
index 0000000..1482b58
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.guard/types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex>
+// class lock_guard
+// {
+// public:
+//     typedef Mutex mutex_type;
+//     ...
+// };
+
+#include <mutex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::lock_guard<std::mutex>::mutex_type,
+                   std::mutex>::value), "");
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp
new file mode 100644
index 0000000..3f3d15d
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_assign.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock& operator=(unique_lock const&) = delete;
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m0;
+std::mutex m1;
+
+int main()
+{
+    std::unique_lock<std::mutex> lk0(m0);
+    std::unique_lock<std::mutex> lk1(m1);
+    lk1 = lk0;
+    assert(lk1.mutex() == &m0);
+    assert(lk1.owns_lock() == true);
+    assert(lk0.mutex() == nullptr);
+    assert(lk0.owns_lock() == false);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp
new file mode 100644
index 0000000..11b6dc5
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/copy_ctor.fail.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(unique_lock const&) = delete;
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+    std::unique_lock<std::mutex> lk0(m);
+    std::unique_lock<std::mutex> lk = lk0;
+    assert(lk.mutex() == &m);
+    assert(lk.owns_lock() == true);
+    assert(lk0.mutex() == nullptr);
+    assert(lk0.owns_lock() == false);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp
new file mode 100644
index 0000000..c062845
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/default.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock();
+
+#include <mutex>
+#include <cassert>
+
+int main()
+{
+    std::unique_lock<std::mutex> ul;
+    assert(!ul.owns_lock());
+    assert(ul.mutex() == nullptr);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
new file mode 100644
index 0000000..d64c4b2
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_assign.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock& operator=(unique_lock&& u);
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m0;
+std::mutex m1;
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+    std::unique_lock<std::mutex> lk0(m0);
+    std::unique_lock<std::mutex> lk1(m1);
+    lk1 = std::move(lk0);
+    assert(lk1.mutex() == &m0);
+    assert(lk1.owns_lock() == true);
+    assert(lk0.mutex() == nullptr);
+    assert(lk0.owns_lock() == false);
+#endif
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
new file mode 100644
index 0000000..a4dd897
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/move_ctor.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(unique_lock&& u);
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+    std::unique_lock<std::mutex> lk0(m);
+    std::unique_lock<std::mutex> lk = std::move(lk0);
+    assert(lk.mutex() == &m);
+    assert(lk.owns_lock() == true);
+    assert(lk0.mutex() == nullptr);
+    assert(lk0.owns_lock() == false);
+#endif
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
new file mode 100644
index 0000000..0bdecbb
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// explicit unique_lock(mutex_type& m);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    time_point t1;
+    {
+    std::unique_lock<std::mutex> ul(m);
+    t1 = Clock::now();
+    }
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
new file mode 100644
index 0000000..96bc512
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_adopt_lock.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(mutex_type& m, adopt_lock_t);
+
+#include <mutex>
+#include <cassert>
+
+
+
+int main()
+{
+    std::mutex m;
+    m.lock();
+    std::unique_lock<std::mutex> lk(m, std::adopt_lock);
+    assert(lk.mutex() == &m);
+    assert(lk.owns_lock() == true);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
new file mode 100644
index 0000000..5cd591d
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_defer_lock.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(mutex_type& m, defer_lock_t);
+
+#include <mutex>
+#include <cassert>
+
+
+
+int main()
+{
+    std::mutex m;
+    std::unique_lock<std::mutex> lk(m, std::defer_lock);
+    assert(lk.mutex() == &m);
+    assert(lk.owns_lock() == false);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
new file mode 100644
index 0000000..b55404f
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// template <class Rep, class Period>
+//   unique_lock(mutex_type& m, const chrono::duration<Rep, Period>& rel_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    std::unique_lock<std::timed_mutex> lk(m, ms(300));
+    assert(lk.owns_lock() == true);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    std::unique_lock<std::timed_mutex> lk(m, ms(250));
+    assert(lk.owns_lock() == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
new file mode 100644
index 0000000..82623e5
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// template <class Clock, class Duration>
+//   unique_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    std::unique_lock<std::timed_mutex> lk(m, Clock::now() + ms(300));
+    assert(lk.owns_lock() == true);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    std::unique_lock<std::timed_mutex> lk(m, Clock::now() + ms(250));
+    assert(lk.owns_lock() == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
new file mode 100644
index 0000000..383cbf5
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_try_to_lock.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// unique_lock(mutex_type& m, try_to_lock_t);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    {
+        std::unique_lock<std::mutex> lk(m, std::try_to_lock);
+        assert(lk.owns_lock() == false);
+    }
+    {
+        std::unique_lock<std::mutex> lk(m, std::try_to_lock);
+        assert(lk.owns_lock() == false);
+    }
+    {
+        std::unique_lock<std::mutex> lk(m, std::try_to_lock);
+        assert(lk.owns_lock() == false);
+    }
+    while (true)
+    {
+        std::unique_lock<std::mutex> lk(m, std::try_to_lock);
+        if (lk.owns_lock())
+            break;
+    }
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
new file mode 100644
index 0000000..158a772
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/lock.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// void lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    std::unique_lock<std::mutex> lk(m, std::defer_lock);
+    time_point t0 = Clock::now();
+    lk.lock();
+    time_point t1 = Clock::now();
+    assert(lk.owns_lock() == true);
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+    try
+    {
+        lk.lock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EDEADLK);
+    }
+    lk.unlock();
+    lk.release();
+    try
+    {
+        lk.lock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
new file mode 100644
index 0000000..b055c8f
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// bool try_lock();
+
+#include <mutex>
+#include <cassert>
+
+bool try_lock_called = false;
+
+struct mutex
+{
+    bool try_lock()
+    {
+        try_lock_called = !try_lock_called;
+        return try_lock_called;
+    }
+    void unlock() {}
+};
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk(m, std::defer_lock);
+    assert(lk.try_lock() == true);
+    assert(try_lock_called == true);
+    assert(lk.owns_lock() == true);
+    try
+    {
+        lk.try_lock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EDEADLK);
+    }
+    lk.unlock();
+    assert(lk.try_lock() == false);
+    assert(try_lock_called == false);
+    assert(lk.owns_lock() == false);
+    lk.release();
+    try
+    {
+        lk.try_lock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
new file mode 100644
index 0000000..7ee9994
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_for.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// template <class Rep, class Period>
+//   bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+
+#include <mutex>
+#include <cassert>
+
+bool try_lock_for_called = false;
+
+typedef std::chrono::milliseconds ms;
+
+struct mutex
+{
+    template <class Rep, class Period>
+        bool try_lock_for(const std::chrono::duration<Rep, Period>& rel_time)
+    {
+        assert(rel_time == ms(5));
+        try_lock_for_called = !try_lock_for_called;
+        return try_lock_for_called;
+    }
+    void unlock() {}
+};
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk(m, std::defer_lock);
+    assert(lk.try_lock_for(ms(5)) == true);
+    assert(try_lock_for_called == true);
+    assert(lk.owns_lock() == true);
+    try
+    {
+        lk.try_lock_for(ms(5));
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EDEADLK);
+    }
+    lk.unlock();
+    assert(lk.try_lock_for(ms(5)) == false);
+    assert(try_lock_for_called == false);
+    assert(lk.owns_lock() == false);
+    lk.release();
+    try
+    {
+        lk.try_lock_for(ms(5));
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
new file mode 100644
index 0000000..2557978
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/try_lock_until.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// template <class Clock, class Duration>
+//   bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <mutex>
+#include <cassert>
+
+bool try_lock_until_called = false;
+
+struct mutex
+{
+    template <class Clock, class Duration>
+        bool try_lock_until(const std::chrono::time_point<Clock, Duration>& abs_time)
+    {
+        typedef std::chrono::milliseconds ms;
+        assert(Clock::now() - abs_time < ms(5));
+        try_lock_until_called = !try_lock_until_called;
+        return try_lock_until_called;
+    }
+    void unlock() {}
+};
+
+mutex m;
+
+int main()
+{
+    typedef std::chrono::monotonic_clock Clock;
+    std::unique_lock<mutex> lk(m, std::defer_lock);
+    assert(lk.try_lock_until(Clock::now()) == true);
+    assert(try_lock_until_called == true);
+    assert(lk.owns_lock() == true);
+    try
+    {
+        lk.try_lock_until(Clock::now());
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EDEADLK);
+    }
+    lk.unlock();
+    assert(lk.try_lock_until(Clock::now()) == false);
+    assert(try_lock_until_called == false);
+    assert(lk.owns_lock() == false);
+    lk.release();
+    try
+    {
+        lk.try_lock_until(Clock::now());
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
new file mode 100644
index 0000000..bcdb6a5
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.locking/unlock.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// void unlock();
+
+#include <mutex>
+#include <cassert>
+
+bool unlock_called = false;
+
+struct mutex
+{
+    void lock() {}
+    void unlock() {unlock_called = true;}
+};
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk(m);
+    lk.unlock();
+    assert(unlock_called == true);
+    assert(lk.owns_lock() == false);
+    try
+    {
+        lk.unlock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+    lk.release();
+    try
+    {
+        lk.unlock();
+        assert(false);
+    }
+    catch (std::system_error& e)
+    {
+        assert(e.code().value() == EPERM);
+    }
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp
new file mode 100644
index 0000000..ee9820a
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/member_swap.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// void swap(unique_lock& u);
+
+#include <mutex>
+#include <cassert>
+
+struct mutex
+{
+    void lock() {}
+    void unlock() {}
+};
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk1(m);
+    std::unique_lock<mutex> lk2;
+    lk1.swap(lk2);
+    assert(lk1.mutex() == nullptr);
+    assert(lk1.owns_lock() == false);
+    assert(lk2.mutex() == &m);
+    assert(lk2.owns_lock() == true);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp
new file mode 100644
index 0000000..1ebeb2b
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/nonmember_swap.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// template <class Mutex>
+//   void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
+
+#include <mutex>
+#include <cassert>
+
+struct mutex
+{
+    void lock() {}
+    void unlock() {}
+};
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk1(m);
+    std::unique_lock<mutex> lk2;
+    swap(lk1, lk2);
+    assert(lk1.mutex() == nullptr);
+    assert(lk1.owns_lock() == false);
+    assert(lk2.mutex() == &m);
+    assert(lk2.owns_lock() == true);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp
new file mode 100644
index 0000000..dab100d
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.mod/release.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// void swap(unique_lock& u);
+
+#include <mutex>
+#include <cassert>
+
+struct mutex
+{
+    static int lock_count;
+    static int unlock_count;
+    void lock() {++lock_count;}
+    void unlock() {++unlock_count;}
+};
+
+int mutex::lock_count = 0;
+int mutex::unlock_count = 0;
+
+mutex m;
+
+int main()
+{
+    std::unique_lock<mutex> lk(m);
+    assert(lk.mutex() == &m);
+    assert(lk.owns_lock() == true);
+    assert(mutex::lock_count == 1);
+    assert(mutex::unlock_count == 0);
+    assert(lk.release() == &m);
+    assert(lk.mutex() == nullptr);
+    assert(lk.owns_lock() == false);
+    assert(mutex::lock_count == 1);
+    assert(mutex::unlock_count == 0);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp
new file mode 100644
index 0000000..3adb313
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/mutex.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// mutex_type *mutex() const;
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+    std::unique_lock<std::mutex> lk0;
+    assert(lk0.mutex() == nullptr);
+    std::unique_lock<std::mutex> lk1(m);
+    assert(lk1.mutex() == &m);
+    lk1.unlock();
+    assert(lk1.mutex() == &m);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
new file mode 100644
index 0000000..70f8466
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/op_bool.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// explicit operator bool() const;
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+    std::unique_lock<std::mutex> lk0;
+    assert(lk0 == false);
+    std::unique_lock<std::mutex> lk1(m);
+    assert(lk1 == true);
+    lk1.unlock();
+    assert(lk1 == false);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp
new file mode 100644
index 0000000..8b0e451
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.obs/owns_lock.pass.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex> class unique_lock;
+
+// bool owns_lock() const;
+
+#include <mutex>
+#include <cassert>
+
+std::mutex m;
+
+int main()
+{
+    std::unique_lock<std::mutex> lk0;
+    assert(lk0.owns_lock() == false);
+    std::unique_lock<std::mutex> lk1(m);
+    assert(lk1.owns_lock() == true);
+    lk1.unlock();
+    assert(lk1.owns_lock() == false);
+}
diff --git a/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp b/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp
new file mode 100644
index 0000000..a8d0536
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/thread.lock.unique/types.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// template <class Mutex>
+// class unique_lock
+// {
+// public:
+//     typedef Mutex mutex_type;
+//     ...
+// };
+
+#include <mutex>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::unique_lock<std::mutex>::mutex_type,
+                   std::mutex>::value), "");
+}
diff --git a/test/thread/thread.mutex/thread.lock/types.pass.cpp b/test/thread/thread.mutex/thread.lock/types.pass.cpp
new file mode 100644
index 0000000..080f900
--- /dev/null
+++ b/test/thread/thread.mutex/thread.lock/types.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// struct defer_lock_t {};
+// struct try_to_lock_t {};
+// struct adopt_lock_t {};
+// 
+// constexpr defer_lock_t  defer_lock{};
+// constexpr try_to_lock_t try_to_lock{};
+// constexpr adopt_lock_t  adopt_lock{};
+
+#include <mutex>
+#include <type_traits>
+
+int main()
+{
+    typedef std::defer_lock_t T1;
+    typedef std::try_to_lock_t T2;
+    typedef std::adopt_lock_t T3;
+
+    T1 t1 = std::defer_lock;
+    T2 t2 = std::try_to_lock;
+    T3 t3 = std::adopt_lock;
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/assign.fail.cpp
new file mode 100644
index 0000000..cdd0c66
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// mutex& operator=(const mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::mutex m0;
+    std::mutex m1;
+    m1 = m0;
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/copy.fail.cpp
new file mode 100644
index 0000000..413a44c
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// mutex(const mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::mutex m0;
+    std::mutex m1(m0);
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/default.pass.cpp
new file mode 100644
index 0000000..9953a00
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/default.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// mutex();
+
+#include <mutex>
+
+int main()
+{
+    std::mutex m;
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/lock.pass.cpp
new file mode 100644
index 0000000..d017b68
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/lock.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// void lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+#include <iostream>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    m.lock();
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/native_handle.pass.cpp
new file mode 100644
index 0000000..bd939d0
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/native_handle.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// typedef pthread_mutex_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <mutex>
+#include <cassert>
+
+int main()
+{
+    std::mutex m;
+    pthread_mutex_t* h = m.native_handle();
+    assert(h);
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/try_lock.pass.cpp
new file mode 100644
index 0000000..0b6b935
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.class/try_lock.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class mutex;
+
+// bool try_lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    while(!m.try_lock())
+        ;
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/assign.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/assign.fail.cpp
new file mode 100644
index 0000000..1ce28f0
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// recursive_mutex& operator=(const recursive_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_mutex m0;
+    std::recursive_mutex m1;
+    m1 = m0;
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/copy.fail.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/copy.fail.cpp
new file mode 100644
index 0000000..ee2e34d
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// recursive_mutex(const recursive_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_mutex m0;
+    std::recursive_mutex m1(m0);
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/default.pass.cpp
new file mode 100644
index 0000000..c0e2df0
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/default.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// recursive_mutex();
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_mutex m;
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/lock.pass.cpp
new file mode 100644
index 0000000..d9d43e5
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/lock.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// void lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+#include <iostream>
+
+std::recursive_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    m.lock();
+    time_point t1 = Clock::now();
+    m.lock();
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/native_handle.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/native_handle.pass.cpp
new file mode 100644
index 0000000..fd975fd
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/native_handle.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// typedef pthread_mutex_t* native_handle_type;
+// native_handle_type native_handle();
+
+#include <mutex>
+#include <cassert>
+
+int main()
+{
+    std::recursive_mutex m;
+    pthread_mutex_t* h = m.native_handle();
+    assert(h);
+}
diff --git a/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/try_lock.pass.cpp
new file mode 100644
index 0000000..217934b
--- /dev/null
+++ b/test/thread/thread.mutex/thread.mutex.requirements/thread.mutex.recursive/try_lock.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_mutex;
+
+// bool try_lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::recursive_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    while(!m.try_lock())
+        ;
+    time_point t1 = Clock::now();
+    assert(m.try_lock());
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.mutex/thread.once/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp b/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
new file mode 100644
index 0000000..261960e
--- /dev/null
+++ b/test/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
@@ -0,0 +1,179 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// struct once_flag;
+
+// template<class Callable, class ...Args>
+//   void call_once(once_flag& flag, Callable func, Args&&... args);
+
+#include <mutex>
+#include <thread>
+#include <cassert>
+
+typedef std::chrono::milliseconds ms;
+
+std::once_flag flg0;
+
+int init0_called = 0;
+
+void init0()
+{
+    std::this_thread::sleep_for(ms(250));
+    ++init0_called;
+}
+
+void f0()
+{
+    std::call_once(flg0, init0);
+}
+
+std::once_flag flg3;
+
+int init3_called = 0;
+int init3_completed = 0;
+
+void init3()
+{
+    ++init3_called;
+    std::this_thread::sleep_for(ms(250));
+    if (init3_called == 1)
+        throw 1;
+    ++init3_completed;
+}
+
+void f3()
+{
+    try
+    {
+        std::call_once(flg3, init3);
+    }
+    catch (...)
+    {
+    }
+}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+struct init1
+{
+    static int called;
+
+    void operator()(int i) {called += i;}
+};
+
+int init1::called = 0;
+
+std::once_flag flg1;
+
+void f1()
+{
+    std::call_once(flg1, init1(), 1);
+}
+
+struct init2
+{
+    static int called;
+
+    void operator()(int i, int j) const {called += i + j;}
+};
+
+int init2::called = 0;
+
+std::once_flag flg2;
+
+void f2()
+{
+    std::call_once(flg2, init2(), 2, 3);
+    std::call_once(flg2, init2(), 4, 5);
+}
+
+#endif
+
+std::once_flag flg41;
+std::once_flag flg42;
+
+int init41_called = 0;
+int init42_called = 0;
+
+void init42();
+
+void init41()
+{
+    std::this_thread::sleep_for(ms(250));
+    ++init41_called;
+}
+
+void init42()
+{
+    std::this_thread::sleep_for(ms(250));
+    ++init42_called;
+}
+
+void f41()
+{
+    std::call_once(flg41, init41);
+    std::call_once(flg42, init42);
+}
+
+void f42()
+{
+    std::call_once(flg42, init42);
+    std::call_once(flg41, init41);
+}
+
+
+int main()
+{
+    // check basic functionality
+    {
+        std::thread t0(f0);
+        std::thread t1(f0);
+        t0.join();
+        t1.join();
+        assert(init0_called == 1);
+    }
+    // check basic exception safety
+    {
+        std::thread t0(f3);
+        std::thread t1(f3);
+        t0.join();
+        t1.join();
+        assert(init3_called == 2);
+        assert(init3_completed == 1);
+    }
+    // check deadlock avoidance
+    {
+        std::thread t0(f41);
+        std::thread t1(f42);
+        t0.join();
+        t1.join();
+        assert(init41_called == 1);
+        assert(init42_called == 1);
+    }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    // check functors with 1 arg
+    {
+        std::thread t0(f1);
+        std::thread t1(f1);
+        t0.join();
+        t1.join();
+        assert(init1::called == 1);
+    }
+    // check functors with 2 args
+    {
+        std::thread t0(f2);
+        std::thread t1(f2);
+        t0.join();
+        t1.join();
+        assert(init2::called == 5);
+    }
+#endif
+}
diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp
new file mode 100644
index 0000000..8722736
--- /dev/null
+++ b/test/thread/thread.mutex/thread.once/thread.once.onceflag/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// struct once_flag;
+
+// once_flag& operator=(const once_flag&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::once_flag f;
+    std::once_flag f2;
+    f2 = f;
+}
diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp
new file mode 100644
index 0000000..b731476
--- /dev/null
+++ b/test/thread/thread.mutex/thread.once/thread.once.onceflag/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// struct once_flag;
+
+// once_flag(const once_flag&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::once_flag f;
+    std::once_flag f2(f);
+}
diff --git a/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp b/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
new file mode 100644
index 0000000..1b2d172
--- /dev/null
+++ b/test/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// struct once_flag;
+
+// constexpr once_flag();
+
+#include <mutex>
+
+int main()
+{
+    std::once_flag f;
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/nothing_to_do.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp
new file mode 100644
index 0000000..7d1746a
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// timed_mutex& operator=(const timed_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::timed_mutex m0;
+    std::timed_mutex m1;
+    m1 = m0;
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp
new file mode 100644
index 0000000..04aee61
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// timed_mutex(const timed_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::timed_mutex m0;
+    std::timed_mutex m1(m0);
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
new file mode 100644
index 0000000..501f7df
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/default.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// timed_mutex();
+
+#include <mutex>
+
+int main()
+{
+    std::timed_mutex m;
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp
new file mode 100644
index 0000000..25eec67
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/lock.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// void lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+#include <iostream>
+
+std::timed_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    m.lock();
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp
new file mode 100644
index 0000000..b775aa2
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// bool try_lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::timed_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    while(!m.try_lock())
+        ;
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp
new file mode 100644
index 0000000..ea05212
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_for.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// template <class Rep, class Period>
+//     bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_for(ms(300)) == true);
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_for(ms(250)) == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp
new file mode 100644
index 0000000..78735e4
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.class/try_lock_until.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class timed_mutex;
+
+// template <class Clock, class Duration>
+//     bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_until(Clock::now() + ms(300)) == true);
+    time_point t1 = Clock::now();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_until(Clock::now() + ms(250)) == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp
new file mode 100644
index 0000000..399523e
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/assign.fail.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_timed_mutex m0;
+    std::recursive_timed_mutex m1;
+    m1 = m0;
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp
new file mode 100644
index 0000000..208c8d6
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/copy.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// recursive_timed_mutex(const recursive_timed_mutex&) = delete;
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_timed_mutex m0;
+    std::recursive_timed_mutex m1(m0);
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
new file mode 100644
index 0000000..7b0ffd2
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/default.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// recursive_timed_mutex();
+
+#include <mutex>
+
+int main()
+{
+    std::recursive_timed_mutex m;
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp
new file mode 100644
index 0000000..3caf7dd
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/lock.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// void lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+#include <iostream>
+
+std::recursive_timed_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    m.lock();
+    time_point t1 = Clock::now();
+    m.lock();
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(2500000));  // within 2.5ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp
new file mode 100644
index 0000000..95c31d7
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// bool try_lock();
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::recursive_timed_mutex m;
+
+typedef std::chrono::system_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f()
+{
+    time_point t0 = Clock::now();
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    assert(!m.try_lock());
+    while(!m.try_lock())
+        ;
+    time_point t1 = Clock::now();
+    assert(m.try_lock());
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(50000000));  // within 50ms
+}
+
+int main()
+{
+    m.lock();
+    std::thread t(f);
+    std::this_thread::sleep_for(ms(250));
+    m.unlock();
+    t.join();
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp
new file mode 100644
index 0000000..730467a
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_for.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// template <class Rep, class Period>
+//     bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::recursive_timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_for(ms(300)) == true);
+    time_point t1 = Clock::now();
+    assert(m.try_lock());
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_for(ms(250)) == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp
new file mode 100644
index 0000000..9d31bca
--- /dev/null
+++ b/test/thread/thread.mutex/thread.timedmutex.requirements/thread.timedmutex.recursive/try_lock_until.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+// class recursive_timed_mutex;
+
+// template <class Clock, class Duration>
+//     bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <mutex>
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+std::recursive_timed_mutex m;
+
+typedef std::chrono::monotonic_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef std::chrono::milliseconds ms;
+typedef std::chrono::nanoseconds ns;
+
+void f1()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_until(Clock::now() + ms(300)) == true);
+    time_point t1 = Clock::now();
+    assert(m.try_lock());
+    m.unlock();
+    m.unlock();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+void f2()
+{
+    time_point t0 = Clock::now();
+    assert(m.try_lock_until(Clock::now() + ms(250)) == false);
+    time_point t1 = Clock::now();
+    ns d = t1 - t0 - ms(250);
+    assert(d < ns(5000000));  // within 5ms
+}
+
+int main()
+{
+    {
+        m.lock();
+        std::thread t(f1);
+        std::this_thread::sleep_for(ms(250));
+        m.unlock();
+        t.join();
+    }
+    {
+        m.lock();
+        std::thread t(f2);
+        std::this_thread::sleep_for(ms(300));
+        m.unlock();
+        t.join();
+    }
+}
diff --git a/test/thread/thread.mutex/version.pass.cpp b/test/thread/thread.mutex/version.pass.cpp
new file mode 100644
index 0000000..c25e8c8
--- /dev/null
+++ b/test/thread/thread.mutex/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <mutex>
+
+#include <mutex>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}
diff --git a/test/thread/thread.req/nothing_to_do.pass.cpp b/test/thread/thread.req/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.req/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.req/thread.req.exception/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.req/thread.req.native/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.req/thread.req.paramname/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp b/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp
new file mode 100644
index 0000000..fa4d462
--- /dev/null
+++ b/test/thread/thread.req/thread.req.timing/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
new file mode 100644
index 0000000..b72590e
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.algorithm/swap.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// void swap(thread& x, thread& y);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        std::thread::id id0 = t0.get_id();
+        std::thread t1;
+        std::thread::id id1 = t1.get_id();
+        swap(t0, t1);
+        assert(t0.get_id() == id1);
+        assert(t1.get_id() == id0);
+        t1.join();
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp
new file mode 100644
index 0000000..ec8f1fb
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/copy.fail.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// thread& operator=(thread&& t);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0(G());
+        std::thread t1;
+        t1 = t0;
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
new file mode 100644
index 0000000..d7f5ad3
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.assign/move.pass.cpp
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// thread& operator=(thread&& t);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+
+    void operator()(int i, double j)
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        assert(i == 5);
+        assert(j == 5.5);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+void f1()
+{
+    std::exit(0);
+}
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+    std::set_terminate(f1);
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t0(G(), 5, 5.5);
+        std::thread::id id = t0.get_id();
+        std::thread t1;
+        t1 = std::move(t0);
+        assert(t1.get_id() == id);
+        assert(t0.get_id() == std::thread::id());
+        t1.join();
+        assert(G::n_alive == 0);
+        assert(G::op_run);
+    }
+    {
+        std::thread t0(G(), 5, 5.5);
+        std::thread::id id = t0.get_id();
+        std::thread t1;
+        t0 = std::move(t1);
+        assert(false);
+    }
+#endif
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
new file mode 100644
index 0000000..f10b25c
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
@@ -0,0 +1,130 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// template <class F, class ...Args> thread(F&& f, Args&&... args);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+unsigned throw_one = 0xFFFF;
+
+void* operator new(std::size_t s) throw(std::bad_alloc)
+{
+    if (throw_one == 0)
+        throw std::bad_alloc();
+    --throw_one;
+    return std::malloc(s);
+}
+
+void  operator delete(void* p) throw()
+{
+    std::free(p);
+}
+
+bool f_run = false;
+
+void f()
+{
+    f_run = true;
+}
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive >= 1);
+        op_run = true;
+    }
+
+    void operator()(int i, double j)
+    {
+        assert(alive_ == 1);
+        assert(n_alive >= 1);
+        assert(i == 5);
+        assert(j == 5.5);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t(f);
+        t.join();
+        assert(f_run == true);
+    }
+    f_run = false;
+    {
+        try
+        {
+            throw_one = 0;
+            std::thread t(f);
+            assert(false);
+        }
+        catch (...)
+        {
+            throw_one = 0xFFFF;
+            assert(!f_run);
+        }
+    }
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t((G()));
+        t.join();
+        assert(G::n_alive == 0);
+        assert(G::op_run);
+    }
+    G::op_run = false;
+    {
+        try
+        {
+            throw_one = 0;
+            assert(G::n_alive == 0);
+            assert(!G::op_run);
+            std::thread t((G()));
+            assert(false);
+        }
+        catch (...)
+        {
+            throw_one = 0xFFFF;
+            assert(G::n_alive == 0);
+            assert(!G::op_run);
+        }
+    }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t(G(), 5, 5.5);
+        t.join();
+        assert(G::n_alive == 0);
+        assert(G::op_run);
+    }
+#endif
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
new file mode 100644
index 0000000..3308484
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// thread(const thread&) = delete;
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+
+    void operator()(int i, double j)
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        assert(i == 5);
+        assert(j == 5.5);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t0(G(), 5, 5.5);
+        std::thread::id id = t0.get_id();
+        std::thread t1 = t0;
+        assert(t1.get_id() == id);
+        assert(t0.get_id() == std::thread::id());
+        t1.join();
+        assert(G::n_alive == 0);
+        assert(G::op_run);
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
new file mode 100644
index 0000000..352e813
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/default.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// thread();
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread t;
+    assert(t.get_id() == std::thread::id());
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
new file mode 100644
index 0000000..254cca0
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.constr/move.pass.cpp
@@ -0,0 +1,68 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// thread(thread&& t);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+
+    void operator()(int i, double j)
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        assert(i == 5);
+        assert(j == 5.5);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+#ifdef _LIBCPP_MOVE
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t0(G(), 5, 5.5);
+        std::thread::id id = t0.get_id();
+        std::thread t1 = std::move(t0);
+        assert(t1.get_id() == id);
+        assert(t0.get_id() == std::thread::id());
+        t1.join();
+        assert(G::n_alive == 0);
+        assert(G::op_run);
+    }
+#endif
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
new file mode 100644
index 0000000..d926795
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.destr/dtor.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// ~thread();
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+void f1()
+{
+    std::exit(0);
+}
+
+int main()
+{
+    std::set_terminate(f1);
+    {
+        assert(G::n_alive == 0);
+        assert(!G::op_run);
+        std::thread t((G()));
+        std::this_thread::sleep_for(std::chrono::milliseconds(250));
+    }
+    assert(false);
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
new file mode 100644
index 0000000..61a771d
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/assign.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// id& operator=(const id&) = default;
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id0;
+    std::thread::id id1;
+    id1 = id0;
+    assert(id1 == id0);
+    id1 = std::this_thread::get_id();
+    assert(id1 != id0);
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
new file mode 100644
index 0000000..5630dc9
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/copy.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// id(const id&) = default;
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id0;
+    std::thread::id id1 = id0;
+    assert(id1 == id0);
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
new file mode 100644
index 0000000..77b839a
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/default.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// id();
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id;
+    assert(id == std::thread::id());
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
new file mode 100644
index 0000000..46246a2
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/eq.pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// bool operator==(thread::id x, thread::id y);
+// bool operator!=(thread::id x, thread::id y);
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id0;
+    std::thread::id id1;
+    id1 = id0;
+    assert( (id1 == id0));
+    assert(!(id1 != id0));
+    id1 = std::this_thread::get_id();
+    assert(!(id1 == id0));
+    assert( (id1 != id0));
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
new file mode 100644
index 0000000..a98dbdc
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/lt.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// bool operator< (thread::id x, thread::id y);
+// bool operator<=(thread::id x, thread::id y);
+// bool operator> (thread::id x, thread::id y);
+// bool operator>=(thread::id x, thread::id y);
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id0;
+    std::thread::id id1;
+    std::thread::id id2 = std::this_thread::get_id();
+    assert(!(id0 <  id1));
+    assert( (id0 <= id1));
+    assert(!(id0 >  id1));
+    assert( (id0 >= id1));
+    assert( (id0 <  id2));
+    assert( (id0 <= id2));
+    assert(!(id0 >  id2));
+    assert(!(id0 >= id2));
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
new file mode 100644
index 0000000..fb0e4e9
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/stream.pass.cpp
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread::id
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>&
+// operator<<(basic_ostream<charT, traits>& out, thread::id id);
+
+#include <thread>
+#include <sstream>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id0 = std::this_thread::get_id();
+    std::ostringstream os;
+    os << id0;
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
new file mode 100644
index 0000000..054a362
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.id/thread_id.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <functional>
+
+// template <class T>
+// struct hash
+//     : public unary_function<T, size_t>
+// {
+//     size_t operator()(T val) const;
+// };
+
+// Not very portable
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id1;
+    std::thread::id id2 = std::this_thread::get_id();
+    typedef std::hash<std::thread::id> H;
+    H h;
+    assert(h(id1) != h(id2));
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
new file mode 100644
index 0000000..081a98f
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// void detach();
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        assert(t0.joinable());
+        t0.detach();
+        assert(!t0.joinable());
+        std::this_thread::sleep_for(std::chrono::milliseconds(250));
+        assert(G::op_run);
+        assert(G::n_alive == 0);
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
new file mode 100644
index 0000000..c5c7788
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/get_id.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// id get_id() const;
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        std::thread::id id0 = t0.get_id();
+        std::thread t1;
+        std::thread::id id1 = t1.get_id();
+        assert(t0.get_id() != id1);
+        assert(t1.get_id() == std::thread::id());
+        t0.join();
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
new file mode 100644
index 0000000..c890f18
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/join.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// void join();
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        assert(t0.joinable());
+        t0.join();
+        assert(!t0.joinable());
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
new file mode 100644
index 0000000..1b24796
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/joinable.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// bool joinable() const;
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        assert(t0.joinable());
+        t0.join();
+        assert(!t0.joinable());
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
new file mode 100644
index 0000000..63c879b
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// native_handle_type native_handle();
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        pthread_t pid = t0.native_handle();
+        assert(pid != 0);
+        t0.join();
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
new file mode 100644
index 0000000..61aee10
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.member/swap.pass.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// void swap(thread& t);
+
+#include <thread>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+
+class G
+{
+    int alive_;
+public:
+    static int n_alive;
+    static bool op_run;
+
+    G() : alive_(1) {++n_alive;}
+    G(const G& g) : alive_(g.alive_) {++n_alive;}
+    ~G() {alive_ = 0; --n_alive;}
+
+    void operator()()
+    {
+        assert(alive_ == 1);
+        assert(n_alive == 1);
+        op_run = true;
+    }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+    {
+        std::thread t0((G()));
+        std::thread::id id0 = t0.get_id();
+        std::thread t1;
+        std::thread::id id1 = t1.get_id();
+        t0.swap(t1);
+        assert(t0.get_id() == id1);
+        assert(t1.get_id() == id0);
+        t1.join();
+    }
+}
diff --git a/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp b/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
new file mode 100644
index 0000000..3f52060
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/thread.thread.static/hardware_concurrency.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+
+// unsigned hardware_concurrency();
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    assert(std::thread::hardware_concurrency() > 0);
+}
diff --git a/test/thread/thread.threads/thread.thread.class/types.pass.cpp b/test/thread/thread.threads/thread.thread.class/types.pass.cpp
new file mode 100644
index 0000000..b547675
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.class/types.pass.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// class thread
+// {
+// public:
+//     typedef pthread_t native_handle_type;
+//     ...
+// };
+
+#include <thread>
+#include <type_traits>
+
+int main()
+{
+    static_assert((std::is_same<std::thread::native_handle_type, pthread_t>::value), "");
+}
diff --git a/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp b/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
new file mode 100644
index 0000000..d8391a6
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.this/get_id.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// thread::id this_thread::get_id();
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::thread::id id = std::this_thread::get_id();
+    assert(id != std::thread::id());
+}
diff --git a/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
new file mode 100644
index 0000000..1340785
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// template <class Rep, class Period>
+//   void sleep_for(const chrono::duration<Rep, Period>& rel_time);
+
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef Clock::time_point time_point;
+    typedef Clock::duration duration;
+    std::chrono::milliseconds ms(500);
+    time_point t0 = Clock::now();
+    std::this_thread::sleep_for(ms);
+    time_point t1 = Clock::now();
+    std::chrono::nanoseconds ns = (t1 - t0) - ms;
+    std::chrono::nanoseconds err = ms / 100;
+    // The time slept is within 1% of 500ms
+    assert(std::abs(ns.count()) < err.count());
+}
diff --git a/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp b/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
new file mode 100644
index 0000000..c117e12
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.this/sleep_until.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// template <class Clock, class Duration>
+//   void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
+
+#include <thread>
+#include <cstdlib>
+#include <cassert>
+
+int main()
+{
+    typedef std::chrono::system_clock Clock;
+    typedef Clock::time_point time_point;
+    typedef Clock::duration duration;
+    std::chrono::milliseconds ms(500);
+    time_point t0 = Clock::now();
+    std::this_thread::sleep_until(t0 + ms);
+    time_point t1 = Clock::now();
+    std::chrono::nanoseconds ns = (t1 - t0) - ms;
+    std::chrono::nanoseconds err = ms / 100;
+    // The time slept is within 1% of 500ms
+    assert(std::abs(ns.count()) < err.count());
+}
diff --git a/test/thread/thread.threads/thread.thread.this/yield.pass.cpp b/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
new file mode 100644
index 0000000..fcbd358
--- /dev/null
+++ b/test/thread/thread.threads/thread.thread.this/yield.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+// void this_thread::yield();
+
+#include <thread>
+#include <cassert>
+
+int main()
+{
+    std::this_thread::yield();
+}
diff --git a/test/thread/thread.threads/version.pass.cpp b/test/thread/thread.threads/version.pass.cpp
new file mode 100644
index 0000000..3ce8866
--- /dev/null
+++ b/test/thread/thread.threads/version.pass.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <thread>
+
+#include <thread>
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main()
+{
+}