Depends on D84190
I don't think this needs to be templated; it can just use the same prototype it did before this patch (using unsigned directly).
Once the template is gone from the unsigned overload above, I wonder if we can use !std::is_convertible<T, unsigned> here, and let the unsigned overload directly catch any enums that aren't strongly typed.
I can remove it. I originally put it in there to be symmetrical with the template below.
Unfortunately, std::is_convertible<T, unsigned>::value == false when T is an enum class (and it's the same for std::is_constructible<unsigned, T>::value): https://godbolt.org/z/Pvsr7v.
I didn't find any type trait in the standard library that would have the same semantics as static_cast<unsigned, T>, but we could use something like this: https://godbolt.org/z/738dhe.