mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Fix calls to functions with const T&& parameters. (#7208)
This also fixes passing a value expression to a forwarding reference, since we currently deduce a `const T&&` parameter in that case. We were accidentally looking at the type of the thunk parameter (which is never an rvalue reference) rather than the type of the callee parameter.
This commit is contained in:
@@ -497,7 +497,7 @@ static auto BuildThunkParamRef(
|
||||
// Cast to an xvalue when using pass-by-`var` or when initializing an rvalue
|
||||
// reference (which might be passed by value if it's const-qualified).
|
||||
if (passing_mode == SemIR::ClangDeclSignature::PassingMode::ByVar ||
|
||||
thunk_param->getType()->isRValueReferenceType()) {
|
||||
(!type.isNull() && type->isRValueReferenceType())) {
|
||||
call_arg = clang::ImplicitCastExpr::Create(
|
||||
sema.getASTContext(), call_arg->getType(), clang::CK_NoOp, call_arg,
|
||||
nullptr, clang::ExprValueKind::VK_XValue, clang::FPOptionsOverride());
|
||||
|
||||
Reference in New Issue
Block a user