QTypeRevision: Disallow floats and doubles as arguments
Previously those would be implicitly casted to qint8, with interesting results. Change-Id: I145a737a7ef7a6f5212461b9f6a1fcb5d7780558 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
8b64327217
commit
94c04c3e54
@ -47,6 +47,7 @@
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qmetatype.h>
|
||||
#include <QtCore/qtypeinfo.h>
|
||||
#include <limits>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -334,11 +335,11 @@ public:
|
||||
template<typename Integer, if_valid_segment_type<Integer> = true>
|
||||
static constexpr bool isValidSegment(Integer segment)
|
||||
{
|
||||
return segment >= Integer(0) && segment < Integer(SegmentUnknown);
|
||||
return segment >= Integer(0)
|
||||
&& (std::numeric_limits<Integer>::max() < Integer(SegmentUnknown)
|
||||
|| segment < Integer(SegmentUnknown));
|
||||
}
|
||||
|
||||
static constexpr bool isValidSegment(qint8 segment) { return segment >= 0; }
|
||||
|
||||
template<typename Major, typename Minor,
|
||||
if_valid_segment_type<Major> = true,
|
||||
if_valid_segment_type<Minor> = true>
|
||||
|
Loading…
x
Reference in New Issue
Block a user