Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++inlining and the as-if ruleSingle-choice MCQ

A compiler inlines a small function and, as a result, proves a downstream branch is always taken and deletes the other arm. The deleted arm contained a call to `std::abort()`. Is this legal, and what principle governs it?

inline bool always() { return true; } int pick(int x) { if (always()) return x + 1; else std::abort(); // deleted after inlining? }