[test] Allow non-libc++ coroutine_handle::done to strengthen noexcept

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Casey Carter
2017-06-01 22:40:16 +00:00
parent 974e519e85
commit 2e612e1621
4 changed files with 6 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ void do_test(coro::coroutine_handle<Promise> const& H) {
// FIXME Add a runtime test // FIXME Add a runtime test
{ {
ASSERT_SAME_TYPE(decltype(H.done()), bool); ASSERT_SAME_TYPE(decltype(H.done()), bool);
ASSERT_NOT_NOEXCEPT(H.done()); LIBCPP_ASSERT_NOT_NOEXCEPT(H.done());
} }
} }

View File

@@ -23,7 +23,7 @@ struct coro_t {
} }
suspend_never initial_suspend() { return {}; } suspend_never initial_suspend() { return {}; }
suspend_never final_suspend() { return {}; } suspend_never final_suspend() { return {}; }
void return_void(){} void return_void() {}
static void unhandled_exception() {} static void unhandled_exception() {}
}; };
}; };
@@ -37,7 +37,7 @@ struct B {
struct A { struct A {
~A(){} ~A() {}
bool await_ready() { return true; } bool await_ready() { return true; }
int await_resume() { return 42; } int await_resume() { return 42; }
template <typename F> void await_suspend(F) {} template <typename F> void await_suspend(F) {}

View File

@@ -25,7 +25,7 @@ struct coro_t {
} }
suspend_never initial_suspend() { return {}; } suspend_never initial_suspend() { return {}; }
suspend_never final_suspend() { return {}; } suspend_never final_suspend() { return {}; }
void return_void(){} void return_void() {}
void unhandled_exception() {} void unhandled_exception() {}
}; };
coro_t(coroutine_handle<promise_type> hh) : h(hh) {} coro_t(coroutine_handle<promise_type> hh) : h(hh) {}

View File

@@ -68,10 +68,10 @@ private:
std::vector<int> yielded_values = {}; std::vector<int> yielded_values = {};
int yield(int x) { yielded_values.push_back(x); return x + 1; } int yield(int x) { yielded_values.push_back(x); return x + 1; }
float fyield(int x) { yielded_values.push_back(x); return x + 2; } float fyield(int x) { yielded_values.push_back(x); return static_cast<float>(x + 2); }
void Do1(func<int> f) { yield(f()); } void Do1(func<int> f) { yield(f()); }
void Do2(func<double> f) { yield(f()); } void Do2(func<double> f) { yield(static_cast<int>(f())); }
int main() { int main() {
Do1([] { return yield(43); }); Do1([] { return yield(43); });