| 1 |
// PR c++/121325 |
| 2 |
// { dg-do compile { target c++26 } } |
| 3 |
|
| 4 |
void f(auto... a) requires requires { []<int i = 0> noexcept(noexcept(a...[i])) { }(); } {} |
| 5 |
void g(auto... a) requires requires { []<int i = 0> { static_assert(noexcept(a...[i])); }(); } {} |
| 6 |
|
| 7 |
void |
| 8 |
h () |
| 9 |
{ |
| 10 |
f (0); |
| 11 |
g (0); |
| 12 |
} |
| 13 |
|
| 14 |
void foo () {} |
| 15 |
void bar () noexcept {} |
| 16 |
template<bool B> |
| 17 |
void baz () noexcept(B) {} |
| 18 |
|
| 19 |
template<typename... Ts> |
| 20 |
void |
| 21 |
x (Ts... ts) noexcept (noexcept (ts...[0]())) |
| 22 |
{ |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
y () |
| 27 |
{ |
| 28 |
static_assert (!noexcept (x (foo))); |
| 29 |
static_assert (noexcept (x (bar))); |
| 30 |
static_assert (noexcept (x (baz<true>))); |
| 31 |
static_assert (!noexcept (x (baz<false>))); |
| 32 |
} |