summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-09-06 03:03:15 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-09-06 03:03:15 +0000
commitac00212f16ed8c798a12b19b8621263ed8c80e2a (patch)
treead201873104d25aa63efc972c08ef95a665bb9e4
parent62d0a5e7d36e4e0595aff41b3d56d0317b1c8e5f (diff)
downloadbcm5719-llvm-ac00212f16ed8c798a12b19b8621263ed8c80e2a.tar.gz
bcm5719-llvm-ac00212f16ed8c798a12b19b8621263ed8c80e2a.zip
Fix DensetSet::insert_as() for MSVC2015 (NFC)
The latest MSVC update apparently resolve the call from the const ref variant to itself, leading to an infinite recursion. It is not clear to me why the r-value overload is not selected. `ValueT` is a pointer type, and the functional-style cast in the call `insert_as(ValueT(V), LookupKey);` should result in a r-value ref. A bug in MSVC? Differential Revision: https://reviews.llvm.org/D23956 llvm-svn: 280685
-rw-r--r--llvm/include/llvm/ADT/DenseSet.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/DenseSet.h b/llvm/include/llvm/ADT/DenseSet.h
index ddded85414e..8280f6fea55 100644
--- a/llvm/include/llvm/ADT/DenseSet.h
+++ b/llvm/include/llvm/ADT/DenseSet.h
@@ -168,12 +168,11 @@ public:
template <typename LookupKeyT>
std::pair<iterator, bool> insert_as(const ValueT &V,
const LookupKeyT &LookupKey) {
- return insert_as(ValueT(V), LookupKey);
+ return TheMap.insert_as({V, detail::DenseSetEmpty()}, LookupKey);
}
template <typename LookupKeyT>
std::pair<iterator, bool> insert_as(ValueT &&V, const LookupKeyT &LookupKey) {
- detail::DenseSetEmpty Empty;
- return TheMap.insert_as(std::make_pair(std::move(V), Empty), LookupKey);
+ return TheMap.insert_as({std::move(V), detail::DenseSetEmpty()}, LookupKey);
}
// Range insertion of values.
OpenPOWER on IntegriCloud