1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: libcpp-has-no-threads, c++98, c++03
16 // void promise::set_value_at_thread_exit(R&& r);
22 void func(std::promise<std::unique_ptr<int>> p)
24 p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5)));
30 std::promise<std::unique_ptr<int>> p;
31 std::future<std::unique_ptr<int>> f = p.get_future();
32 std::thread(func, std::move(p)).detach();
33 assert(*f.get() == 5);