mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 13:35:58 +01:00
Fix thunk generation for &&-qualified methods. (#6881)
Use the object parameter type when creating a reference to the thunk parameter so that we create an xvalue rather than an lvalue for the `*this` expression in the thunk.
This commit is contained in:
@@ -500,11 +500,11 @@ static auto BuildThunkBody(clang::Sema& sema,
|
||||
// the callee. Otherwise, build a regular reference to the function.
|
||||
clang::ExprResult callee;
|
||||
if (callee_info.has_object_parameter) {
|
||||
clang::QualType object_param_type =
|
||||
cast<clang::CXXMethodDecl>(callee_info.decl)
|
||||
->getFunctionObjectParameterReferenceType();
|
||||
auto* object_param_ref =
|
||||
BuildThunkParamRef(sema, thunk_function_decl, 0,
|
||||
callee_info.has_explicit_object_parameter()
|
||||
? callee_info.decl->getParamDecl(0)->getType()
|
||||
: clang::QualType());
|
||||
BuildThunkParamRef(sema, thunk_function_decl, 0, object_param_type);
|
||||
constexpr bool IsArrow = false;
|
||||
auto object =
|
||||
sema.PerformMemberExprBaseConversion(object_param_ref, IsArrow);
|
||||
|
||||
Reference in New Issue
Block a user