No, it just kills the program, like a segfault in C++. Unlike Java, which throws an exception that you can catch and recover from.
> With regard to the last C++ template example, why can Swift not do this?
I'm no Swift typing expert either, but my understanding is that:
a) Swift generics are type-checked at definition time, not instantiation time as with C++. I believe other modern languages do it like Swift.
b) Swift doesn't promote types, so you can't subtract a float from a double. That rules out heterogenous types, like a float or a double. Even if both arguments are floats, the 0.1 on the right side of the < operator is a double, which can't be compared against a float.
c) Swift doesn't have template specialisation either, so we can't provide different implements, one for floats and one for doubles. If we could, we'd use 0.1f for the float case.