Skip to content

Commit a663966

Browse files
committed
Fix a bug in expandTypeIntoNodeProjectionPaths. This is exposed by the bug fixed in
a630f59. Existing tests ensure correctness.
1 parent d93e489 commit a663966

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/SIL/Projection.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,16 @@ ProjectionPath::expandTypeIntoNodeProjectionPaths(SILType B, SILModule *Mod,
729729
continue;
730730
}
731731

732-
// Keep the intermediate nodes as well.
733-
Paths.push_back(std::move(PP.getValue()));
732+
// Keep the intermediate nodes as well.
733+
//
734+
// std::move clears the passed ProjectionPath. Give it a temporarily
735+
// created ProjectionPath for now.
736+
//
737+
// TODO: this can be simplified once we reduce the size of the projection
738+
// path and make them copyable.
739+
ProjectionPath T;
740+
T.append(PP.getValue());
741+
Paths.push_back(std::move(T));
734742

735743
// Keep expanding the location.
736744
for (auto &P : Projections) {

0 commit comments

Comments
 (0)