mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Solve Visual C++ warning C4805 on getAsInteger<bool>.
Fix http://llvm.org/PR21158 by adding a cast to unsigned long long, so the comparison would be between two unsigned long longs instead of bool and unsigned long long. if (getAsUnsignedInteger(*this, Radix, ULLVal) || static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) llvm-svn: 219065
This commit is contained in:
parent
7db3ef45b9
commit
d58cb7b41a
@ -347,8 +347,11 @@ namespace llvm {
|
|||||||
typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type
|
typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type
|
||||||
getAsInteger(unsigned Radix, T &Result) const {
|
getAsInteger(unsigned Radix, T &Result) const {
|
||||||
unsigned long long ULLVal;
|
unsigned long long ULLVal;
|
||||||
|
// The additional cast to unsigned long long is required to avoid the
|
||||||
|
// Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type
|
||||||
|
// 'unsigned __int64' when instantiating getAsInteger with T = bool.
|
||||||
if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
|
if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
|
||||||
static_cast<T>(ULLVal) != ULLVal)
|
static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal)
|
||||||
return true;
|
return true;
|
||||||
Result = ULLVal;
|
Result = ULLVal;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user