C++: Void versus [[Noreturn]]
quuxplusone.github.io
quuxplusone.github.io
This is also why there's very little point to introspecting the presence of this annotation or even overloading based on this annotation.
Discussing whether a function which always terminates "returns" or "not-returns" an int is as useful as discussing whether a function which is never executed returns an int. The semantic analysis is rather clear in both cases.
https://doc.rust-lang.org/std/primitive.never.html
There is no way where you can say: this function returns a string and is no-return.
FreePascal has the same issue with the warning in divide2 and it also has a noreturn attribute. So can you be tempted to add the attribute and it get rids of the warning. But it is wrong.
In FreePascal noreturn means that the function does not return, i.e. the execution does not leave the scope. An exception would leave the function, so it is not allowed.
Noreturn functions can only have an infinite loop or kill the process