Better fix for all compilers
The Nvidia compiler complained about unreachable code with original throw followed by return 0. However, if the return 0 was removed, then the MSC compiler complained about function not returning value. This was due to the use of `FMT_THROW` which "tricks" the MSC compiler into thinking it is possible for the `FMT_THROW` to return. If we just use the `thow format_error(...)` here with no return, then all compilers should be able to deduce that the code will not return following the explicit throw and it should eliminate all warnings from Nvidia, MSC, and other compilers.
This commit is contained in:
parent
6a920477f9
commit
22cc84ab23
@ -45,10 +45,7 @@ class printf_precision_handler {
|
|||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||||
int operator()(T) {
|
int operator()(T) {
|
||||||
FMT_THROW(format_error("precision is not integer"));
|
throw format_error("precision is not integer");
|
||||||
#if FMT_MSC_VER
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -168,10 +165,7 @@ template <typename Char> class printf_width_handler {
|
|||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||||
unsigned operator()(T) {
|
unsigned operator()(T) {
|
||||||
FMT_THROW(format_error("width is not integer"));
|
throw format_error("width is not integer");
|
||||||
#if FMT_MSC_VER
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user