diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-11-15 17:15:56 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-11-23 09:24:40 +0000 |
commit | a32424b46cd3ef6fd8d644354e3cec434d5ab951 (patch) | |
tree | 9a40b9e0d0430cac01ab15b8b9863ecf6fe8212f /src/corelib | |
parent | be94fc445a664fa10ce5ff5ea1e4fbe7d23585e7 (diff) |
AreArgumentsNarrowedBase: Correct logic for narrowing connect() casts
The prior test deemed there to be narrowing if source and destination
integral-or-enum types didn't have the same signedness; but all values
of an unsigned source type can be represented in a larger signed
destination type, so there is no narrowing in this case.
Updated QObject test-case to match.
Change-Id: I517a5997adcad70e185d7469a8d26788e463cb75
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qobjectdefs_impl.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index e94e713e1f..79c9c8303e 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -229,8 +229,14 @@ namespace QtPrivate { (std::is_floating_point<From>::value && std::is_integral<To>::value) || (std::is_floating_point<From>::value && std::is_floating_point<To>::value && sizeof(From) > sizeof(To)) || ((std::is_integral<From>::value || std::is_enum<From>::value) && std::is_floating_point<To>::value) || - (std::is_integral<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || std::is_signed<From>::value != std::is_signed<To>::value)) || - (std::is_enum<From>::value && std::is_integral<To>::value && (sizeof(From) > sizeof(To) || IsEnumUnderlyingTypeSigned<From>::value != std::is_signed<To>::value)) + (std::is_integral<From>::value && std::is_integral<To>::value + && (sizeof(From) > sizeof(To) + || (std::is_signed<From>::value ? !std::is_signed<To>::value + : (std::is_signed<To>::value && sizeof(From) == sizeof(To))))) || + (std::is_enum<From>::value && std::is_integral<To>::value + && (sizeof(From) > sizeof(To) + || (IsEnumUnderlyingTypeSigned<From>::value ? !std::is_signed<To>::value + : (std::is_signed<To>::value && sizeof(From) == sizeof(To))))) > { }; |