gcc/testsuite/g++.dg/cpp0x/noexcept84.C
raw| 1 | // PR c++/114114 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<bool B> |
| 5 | constexpr void |
| 6 | test () |
| 7 | { |
| 8 | constexpr bool is_yes = B; |
| 9 | struct S { |
| 10 | constexpr S() noexcept(is_yes) { } |
| 11 | }; |
| 12 | S s; |
| 13 | } |
| 14 | |
| 15 | constexpr bool foo() { return true; } |
| 16 | |
| 17 | template<typename T> |
| 18 | constexpr void |
| 19 | test2 () |
| 20 | { |
| 21 | constexpr T (*pfn)() = &foo; |
| 22 | struct S { |
| 23 | constexpr S() noexcept(pfn()) { } |
| 24 | }; |
| 25 | S s; |
| 26 | } |
| 27 | |
| 28 | int main() |
| 29 | { |
| 30 | test<true>(); |
| 31 | test2<bool>(); |
| 32 | } |