[llvm] [DenseMap] Fix build failure in lookup_or (PR #142268)
Aaron Puchert via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 2 08:43:20 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 {
----------------
aaronpuchert wrote:
With `U` being a template parameter, this is no longer an rvalue reference but a [universal/forwarding reference](https://www.cppreference.com/w/cpp/language/reference.html#Forwarding_references). Such a reference can bind to lvalues, in which case `U` will be derived as lvalue reference type using [reference collapsing](https://www.cppreference.com/w/cpp/language/reference.html#Reference_collapsing). So this should work.
To be honest, I have no idea what the default argument does, since it seems like this should always be deduced.
https://github.com/llvm/llvm-project/pull/142268
More information about the llvm-commits
mailing list