libstdc++-v3/testsuite/30_threads/promise/members/set_exception_neg.cc
raw| 1 | // { dg-options "-D_GLIBCXX_ASSERTIONS" } |
| 2 | // { dg-do run { xfail *-*-* } } |
| 3 | // { dg-additional-options "-pthread" { target pthread } } |
| 4 | // { dg-require-effective-target c++11 } |
| 5 | // { dg-require-gthreads "" } |
| 6 | |
| 7 | // LWG 2276. Missing requirement on std::promise::set_exception |
| 8 | |
| 9 | #include <future> |
| 10 | |
| 11 | int main() |
| 12 | { |
| 13 | std::promise<void> prom; |
| 14 | auto f = prom.get_future(); |
| 15 | std::exception_ptr p; |
| 16 | prom.set_exception(p); // Preconditions: p is not null |
| 17 | f.get(); |
| 18 | } |