3 ms·
> If the function had a "noreturn" qualifier, or an "else" that could tell the compiler that hitting the if statement will mean that the dereference never happe
by MauranKilom 6y ago
> If the function had a "noreturn" qualifier, or an "else" that could tell the compiler that hitting the if statement will mean that the dereference never happens, then the compiler would not break this code.
If the compiler can't prove that the function returns, it's not allowed to assume that it does.
I challenge you to cook up an example on godbolt.org that shows the behavior you claim. But take note of the difference between
https://godbolt.org/z/sWYEYc https://godbolt.org/z/sWYEYc
and
https://godbolt.org/z/3E7hbz https://godbolt.org/z/3E7hbz