Skip to content

Commit 0838bd6

Browse files
authored
[DenseMap] Fix MSVC buildbot failure in lookup_or (#142268)
4bf67cd ([DenseMap] Fix constness issues with lookup_or) introduced a buildbot failure: https://lab.llvm.org/buildbot/#/builders/63/builds/6559 The patch deviates from the spec and MSVC complains, where it doesn't bind an lvalue to an rvalue reference. Fix it by qualifying the argument of lookup_or with remove_cv_t. Proof: https://godbolt.org/z/sjTvGMbce
1 parent 75c3ff8 commit 0838bd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ class DenseMapBase : public DebugEpochBase {
220220
// Return the entry with the specified key, or \p Default. This variant is
221221
// useful, because `lookup` cannot be used with non-default-constructible
222222
// values.
223-
ValueT lookup_or(const_arg_type_t<KeyT> Val, ValueT &&Default) const {
223+
template <typename U = std::remove_cv_t<ValueT>>
224+
ValueT lookup_or(const_arg_type_t<KeyT> Val, U &&Default) const {
224225
if (const BucketT *Bucket = doFind(Val))
225226
return Bucket->getSecond();
226227
return Default;

0 commit comments

Comments
 (0)