diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-07-26 15:53:16 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2021-07-27 15:07:39 +0200 |
commit | 4679209120f02f2d2dc6a4e7a3129f3501c6024a (patch) | |
tree | a4764a5791825ef466a4d315dcfad18208c6e39a /src/corelib/time/qcalendar.h | |
parent | 0235c0217883bc9d0ca83c7533e9c0286901bb3c (diff) |
QCalendar: Make SystemId constructors with one argument explicit
This avoids unwanted type conversions.
Pick-to: 6.2
Change-Id: Ie57e80da615c6bc162224fa3816fc21a47ab4b00
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/time/qcalendar.h')
-rw-r--r-- | src/corelib/time/qcalendar.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/time/qcalendar.h b/src/corelib/time/qcalendar.h index a723209a1c..cdfed467ae 100644 --- a/src/corelib/time/qcalendar.h +++ b/src/corelib/time/qcalendar.h @@ -135,8 +135,9 @@ public: const size_t id; friend class QCalendarBackend; constexpr bool isInEnum() const { return id <= size_t(QCalendar::System::Last); } - constexpr SystemId(QCalendar::System e) : id(size_t(e)) {} - constexpr SystemId(size_t i) : id(i) {} + constexpr explicit SystemId(QCalendar::System e) : id(size_t(e)) { } + constexpr explicit SystemId(size_t i) : id(i) { } + public: constexpr SystemId() : id(~size_t(0)) {} constexpr size_t index() const noexcept { return id; } |