Inconsistent Warning on Throwing in Switch Cases

The compiler correctly detects that the throw statement requires no return but then inconsistently reports a warning complaining about missing return statement at the end of non-void function when the throw is hidden in another function.

The warning is correct in that the throw is in a different scoping unit hence in the “throw_error” case, there isn’t a return from the default case. Either ignore the warning or add a “return 0” after the switch statement.

Note that the warning is consistent with other compilers. Spot checking, it appears the only compilers not to issue the warning is Intel and Clang. Both appear to treat “to_string” as a void routine where the warning doesn’t apply.


Alright. I see. Thanks. Apologies for the false issue.