-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
enhancementSomething can be improvedSomething can be improved
Description
Describe the bug
Calling std::unreachable is not diagnosed in debug builds.
Expected behavior
In debug builds, I would expect calling std::unreachable to abort execution.
STL version
Additional context
This was discovered after std::terminate failed to capture undefined behavior due to a logic error. Aborting execution is compatible with undefined behavior, and it helps catch bugs. In that regard, the old assert(false)-based implementations are preferable to std::unreachable().
The original implementation (#2526) attempted to call abort in debug builds:
Line 757 in b6b9778
| _CSTD abort(); // likely to be called in debug mode, but can't be relied upon - already entered the UB territory |
This was later removed in (#5560), with no obvious explanation for the rationale.
e2115ba#diff-b40b803e74da64226183307c996e495cce0bf23a9c83d9822fea849bb99b7144L962
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementSomething can be improvedSomething can be improved