File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -1268,6 +1268,17 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
1268
1268
if (auto *term = dyn_cast<OwnershipForwardingTermInst>(i)) {
1269
1269
checkOwnershipForwardingTermInst (term);
1270
1270
}
1271
+
1272
+ // Address-only values are potentially move-only, and unmovable if they are
1273
+ // borrowed. Ensure that guaranteed address-only values are forwarded with
1274
+ // the same representation. Non-destructive projection is
1275
+ // allowed. Aggregation and destructive disaggregation is not allowed.
1276
+ if (ownership == OwnershipKind::Guaranteed
1277
+ && OwnershipForwardingMixin::isAddressOnly (i)) {
1278
+ require (OwnershipForwardingMixin::hasSameRepresentation (i),
1279
+ " Forwarding a guaranteed address-only value requires the same "
1280
+ " representation since no move or copy is allowed." );
1281
+ }
1271
1282
}
1272
1283
1273
1284
void checkDebugVariable (SILInstruction *inst) {
You can’t perform that action at this time.
0 commit comments