summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-10 11:50:40 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-15 12:37:43 +0200
commit19b5520abfb5f66d4b83c7a18cc72d68673d098a (patch)
tree7a34e4fee3d4355966bd39011cfa53374abdc7ac /src/corelib/tools/qhash.h
parenteb201a57dbeff93d788546e61b193dcf4f4258b9 (diff)
Work around compiler problems on MSVC 16.6.X
The compiler apparently doesn't resolve the emplace overload correctly to the rvalue version, leading to infinite recursion in the overload that takes a const Key & as argument. Take a copy to make it explicit. Change-Id: I22039d6ca1e2176c81e51b181c72f511dab662f7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r--src/corelib/tools/qhash.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 8825372c03..eacc373ee3 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -1121,7 +1121,8 @@ public:
template <typename ...Args>
iterator emplace(const Key &key, Args &&... args)
{
- return emplace(Key(key), std::forward<Args>(args)...);
+ Key copy = key; // Needs to be explicit for MSVC 2019
+ return emplace(std::move(copy), std::forward<Args>(args)...);
}
template <typename ...Args>