Currently funciton lookup in the expression evaluator fails to disambiguate member functions the are overloaded on lvalue/rvalue reference-qualifiers. This happens because we unconditionally set a `FunctionPrototype`s `ExtProtoInfo::RefQualifier` to `RQ_None`. We lose the ref-qualifiers in the synthesized AST and `clang::Sema` fails to pick a correct overload candidate. DWARF emits information about a function's ref-qualifiers in the form of a boolean `DW_AT_rvalue_reference` (for rvalues) and `DW_AT_reference` (for lvalues). This patch sets the `FunctionPrototype::ExtProtoInfo::RefQualifier` based on the DWARF attributes above. **Testing** * Added API test llvm/llvm-project issue #57866 Differential Revision: https://reviews.llvm.org/D134661
20 lines
408 B
C++
20 lines
408 B
C++
#include <cstdint>
|
|
#include <cstdio>
|
|
|
|
struct Foo {
|
|
uint32_t func() const & { return 0; }
|
|
int64_t func() const && { return 1; }
|
|
uint32_t func() & { return 2; }
|
|
int64_t func() && { return 3; }
|
|
};
|
|
|
|
int main() {
|
|
Foo foo;
|
|
const Foo const_foo;
|
|
auto res = foo.func() + const_foo.func() + Foo{}.func() +
|
|
static_cast<Foo const &&>(Foo{}).func();
|
|
|
|
std::puts("Break here");
|
|
return res;
|
|
}
|