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.

llvm-svn: 204678
This commit is contained in:
Marshall Clow 2014-03-24 22:25:24 +00:00
parent cb39943f6f
commit 4fdb070817
2 changed files with 20 additions and 1 deletions

View File

@ -55,6 +55,12 @@ std::unique_ptr<int> f4(std::unique_ptr<int>&& p)
return std::move(p);
}
void f5(int i)
{
std::this_thread::sleep_for(ms(200));
throw i;
}
int main()
{
{
@ -174,4 +180,17 @@ int main()
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 ) {}
}
}

View File

@ -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> -->