Created on 2026-06-10.00:00:00 last changed 2 weeks ago
[support.signal] paragraph 2 specifies that a signal handler invocation has undefined behaviour if it includes an evaluation that is not signal-safe.
Such an included evaluation (consistent with CWG's understanding; see CWG 3162) may occur within a manifestly constant-evaluated context, in which case, the specified undefined behaviour is gratuitous. [Example from Jens Maurer:] The issue here is:
constexpr int f()
{
try { throw 0; } catch (...) {} // not signal-safe [support.signal] bullets 3.4 and 3.5
return 0;
}
void handler(int) // signal handler
{
constexpr int x = f(); // ok?
}
The evaluation of "handler" includes the evaluation of `f`, which is not signal-safe. But that's not really a good state of affairs, because the constant evaluation of `f` certainly has no runtime impact on the signal handler.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-06-10 00:00:00 | admin | create | |