libstdc++-v3/testsuite/20_util/reference_wrapper/invoke-noexcept.cc
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // C++11 20.8.3.4 reference_wrapper invocation [refwrap.invoke] |
| 4 | |
| 5 | #include <functional> |
| 6 | |
| 7 | struct F |
| 8 | { |
| 9 | int operator()() noexcept(true) { return 1; } |
| 10 | int operator()() const noexcept(false) { return 2; } |
| 11 | }; |
| 12 | |
| 13 | F f; |
| 14 | static_assert( noexcept(std::ref(f)()) ); |
| 15 | static_assert( ! noexcept(std::cref(f)()) ); |