Skip to content

Commit

Permalink
[CSApply] Variadics: Emit LoadExpr for when base of .element is l…
Browse files Browse the repository at this point in the history
…-value
  • Loading branch information
xedin committed Mar 11, 2023
1 parent b42bb3f commit 25ad330
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Sema/CSApply.cpp
Expand Up @@ -3415,6 +3415,14 @@ namespace {
}

case OverloadChoiceKind::MaterializePack: {
auto baseTy = solution.getResolvedType(base);

// Load the base tuple if necessary, materialization
// operates on r-value types only.
if (baseTy->is<LValueType>())
base = coerceToType(base, baseTy->getRValueType(),
cs.getConstraintLocator(base));

auto packType = solution.getResolvedType(expr);
return cs.cacheType(
MaterializePackExpr::create(cs.getASTContext(),
Expand Down

0 comments on commit 25ad330

Please sign in to comment.