[llvm] [DenseMap] Work around a MSVC bug in lookup_or (PR #142268)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat May 31 14:59:52 PDT 2025


================
@@ -226,6 +226,12 @@ class DenseMapBase : public DebugEpochBase {
     return Default;
   }
 
+  ValueT lookup_or(const_arg_type_t<KeyT> Val, const ValueT &Default) const {
----------------
kazutakahirata wrote:

Sorry, I may have misguided you in an earlier PR of yours.  Would you mind trying something like this?  I've taken this from `std::optional::value_or`.

```suggestion
  template <typename U = std::remove_cv_t<ValueT> >
  ValueT lookup_or(const_arg_type_t<KeyT> Val, U &&Default) const {
```


https://github.com/llvm/llvm-project/pull/142268


More information about the llvm-commits mailing list