In your code it's not possible for the function to fall off the end.
However, the compiler is not required to accurately diagnose whether a function can get to the end or not. In general, to do so would require solving the halting problem.
Instead, as a practical measure, your compiler is doing some basic checks and warning because it sees the if ( first > last ) return false;
, it didn't do enough code analysis to determine that this branch can never be reached unless first > last
.
To suppress this warning you could just remove the line if ( first > last )
. BTW this is a warning, not an error; so it should not prevent your compilation.