File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,20 @@ ${SelfName}TestSuite.test("withMemoryReboundSE0333") {
498
498
}
499
499
}
500
500
501
+ ${SelfName}TestSuite.test("withMemoryReboundSE0333.capacity1") {
502
+ let mutablePtr = UnsafeMutablePointer<(Int,Bool,UInt8)>.allocate(capacity: 1)
503
+ defer { mutablePtr.deallocate() }
504
+ let ptr = ${SelfName}<(Int, Bool, UInt8)>(mutablePtr)
505
+ // test rebinding to a shorter type with the same alignment
506
+ ptr.withMemoryRebound(to: (Int, Bool).self, capacity: 1) {
507
+ // Make sure the closure argument is a ${SelfName}
508
+ let ptrT: ${SelfName}<(Int, Bool)> = $0
509
+ // and that the element is (Int, Bool).
510
+ let mutablePtrT = UnsafeMutablePointer(mutating: ptrT)
511
+ expectType((Int, Bool).self, &mutablePtrT.pointee)
512
+ }
513
+ }
514
+
501
515
% end
502
516
503
517
runAllTests()
You can’t perform that action at this time.
0 commit comments