gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept.C
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | template<class T> |
| 4 | struct is_funny { |
| 5 | static constexpr bool value = false; |
| 6 | }; |
| 7 | |
| 8 | template<class T> |
| 9 | constexpr T value(T t) noexcept(is_funny<T>::value) { return t; } // Line 7 |
| 10 | |
| 11 | constexpr bool ok = noexcept(value(42)); |
| 12 | |
| 13 | // We used to treat a call to a constexpr function as noexcept if |
| 14 | // the call was a constant expression. We no longer do since |
| 15 | // c++/87603. |
| 16 | static_assert(!ok, "Assertion failure"); |