Home | History | Annotate | Download | only in coroutine.handle.completion
      1 // -*- C++ -*-
      2 //===----------------------------------------------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 
     11 // UNSUPPORTED: c++98, c++03, c++11
     12 
     13 // <experimental/coroutine>
     14 
     15 // template <class Promise = void>
     16 // struct coroutine_handle;
     17 
     18 // bool done() const
     19 
     20 #include <experimental/coroutine>
     21 #include <type_traits>
     22 #include <memory>
     23 #include <utility>
     24 #include <cstdint>
     25 #include <cassert>
     26 
     27 #include "test_macros.h"
     28 
     29 namespace coro = std::experimental;
     30 
     31 template <class Promise>
     32 void do_test(coro::coroutine_handle<Promise> const& H) {
     33   // FIXME Add a runtime test
     34   {
     35     ASSERT_SAME_TYPE(decltype(H.done()), bool);
     36     LIBCPP_ASSERT_NOT_NOEXCEPT(H.done());
     37   }
     38 }
     39 
     40 int main()
     41 {
     42   do_test(coro::coroutine_handle<>{});
     43   do_test(coro::coroutine_handle<int>{});
     44 }
     45