gcc/testsuite/g++.dg/cpp0x/constexpr-105321.C
raw| 1 | // PR c++/105321 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | bool handle_error(); |
| 5 | |
| 6 | constexpr int echo(int value, bool yes = true) noexcept |
| 7 | { |
| 8 | return (yes || handle_error()), value; |
| 9 | } |
| 10 | |
| 11 | static_assert(echo(10) == 10, ""); |
| 12 | |
| 13 | constexpr int echo2(int value, bool no = false) noexcept |
| 14 | { |
| 15 | return (!no || handle_error()), value; |
| 16 | } |
| 17 | |
| 18 | static_assert(echo2(10) == 10, ""); |