diff options
Diffstat (limited to 'src/corelib')
| -rw-r--r-- | src/corelib/tools/qarraydataops.h | 4 | ||||
| -rw-r--r-- | src/corelib/tools/qhash.h | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 9e205815c7a..f1771c70d56 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -941,7 +941,9 @@ public: } } - if constexpr (!std::is_nothrow_constructible_v<T, decltype(std::invoke(proj, *first))>) { + if constexpr (!std::is_nothrow_constructible_v<T, decltype(std::invoke(proj, *first))> + || !std::is_nothrow_invocable_v<Projection, decltype(*first)>) + { // If construction can throw, and we have freeSpaceAtBegin(), // it's easiest to just clear the container and start fresh. // The alternative would be to keep track of two active, disjoint ranges. diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 76729917f6b..6509048da0c 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -23,7 +23,13 @@ QT_BEGIN_NAMESPACE struct QHashDummyValue { - bool operator==(const QHashDummyValue &) const noexcept { return true; } + explicit QHashDummyValue() = default; + friend constexpr bool operator==(QHashDummyValue, QHashDummyValue) noexcept { return true; } +#ifndef __cpp_impl_three_way_comparison + friend constexpr bool operator!=(QHashDummyValue, QHashDummyValue) noexcept { return false; } +#endif + friend constexpr size_t qHash(QHashDummyValue) noexcept = delete; + friend constexpr size_t qHash(QHashDummyValue, size_t) noexcept = delete; }; namespace QHashPrivate { |
