This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
Section: 17.14.5 [support.signal] Status: New Submitter: Hubert Tong Opened: 2026-06-10 Last modified: 2026-06-17
Priority: Not Prioritized
View all other issues in [support.signal].
View all issues with New status.
Discussion:
17.14.5 [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 17.14.5 [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.
Proposed resolution: