Reading through the constexpr
specifier documentation on cppreference, I've noticed that the standard says the following:
[...] the function body [of
constexpr
function] must be either deleted or defaulted or contain only the following: [...] if the function is not a constructor, exactly one return statement.
What is the motivation behind imposing such a requirement? Although I can understand that this could potentially lead to a simpler implementation of the constexpr interpreter, I do not see the reason why this limitation had to be imposed.
Both clang 15.0.0 and gcc 12.2 compile constexpr
functions with multiple return statements with no problem. Am I reading the standard wrong or was this just some "obsolete" decision that is no longer being followed?