Add a test to make sure we're doing the right thing for throwing exceptions from deferred functions. This is LWG issue #2186. No change to the library needed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204678 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/thread/futures/futures.async/async.pass.cpp b/test/thread/futures/futures.async/async.pass.cpp
index 697eb08..f67abe4 100644
--- a/test/thread/futures/futures.async/async.pass.cpp
+++ b/test/thread/futures/futures.async/async.pass.cpp
@@ -55,6 +55,12 @@
return std::move(p);
}
+void f5(int i)
+{
+ std::this_thread::sleep_for(ms(200));
+ throw i;
+}
+
int main()
{
{
@@ -174,4 +180,17 @@
Clock::time_point t1 = Clock::now();
assert(t1-t0 < ms(100));
}
+
+ {
+ std::future<void> f = std::async(f5, 3);
+ std::this_thread::sleep_for(ms(300));
+ try { f.get(); assert (false); } catch ( int ex ) {}
+ }
+
+ {
+ std::future<void> f = std::async(std::launch::deferred, f5, 3);
+ std::this_thread::sleep_for(ms(300));
+ try { f.get(); assert (false); } catch ( int ex ) {}
+ }
+
}
diff --git a/www/cxx1y_status.html b/www/cxx1y_status.html
index 04c3730..8335a5f 100644
--- a/www/cxx1y_status.html
+++ b/www/cxx1y_status.html
@@ -266,7 +266,7 @@
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2359">2359</a></td><td>How does regex_constants::nosubs affect basic_regex::mark_count()?</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360">2360</a></td><td>reverse_iterator::operator*() is unimplementable</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2104">2104</a></td><td>unique_lock move-assignment should not be noexcept</td><td>Issaquah</td><td>Complete</td></tr>
- <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2186">2186</a></td><td>Incomplete action on async/launch::deferred</td><td>Issaquah</td><td></td></tr>
+ <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2186">2186</a></td><td>Incomplete action on async/launch::deferred</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2075">2075</a></td><td>Progress guarantees, lock-free property, and scheduling assumptions</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2288">2288</a></td><td>Inconsistent requirements for shared mutexes</td><td>Issaquah</td><td>Complete</td></tr>
<!-- <tr><td></td><td></td><td></td><td></td></tr> -->