File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
test/Interop/SwiftToCxx/functions Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2069,9 +2069,10 @@ class DeclAndTypePrinter::Implementation
20692069 if (outputLang == OutputLanguageMode::Cxx) {
20702070 if (!SD->isInstanceMember ())
20712071 return ;
2072- auto *getter = SD->getOpaqueAccessor (AccessorKind::Get);
2073- printAbstractFunctionAsMethod (getter, false ,
2074- /* isNSUIntegerSubscript=*/ false , SD);
2072+ // TODO: support read accessors.
2073+ if (auto *getter = SD->getOpaqueAccessor (AccessorKind::Get))
2074+ printAbstractFunctionAsMethod (getter, false ,
2075+ /* isNSUIntegerSubscript=*/ false , SD);
20752076 return ;
20762077 }
20772078 assert (SD->isInstanceMember () && " static subscripts not supported" );
Original file line number Diff line number Diff line change @@ -25,6 +25,19 @@ public struct IntBox {
2525 }
2626}
2727
28+ public struct CustomArray < Element> where Element : ~ Copyable {
29+ private var buffer : UnsafeMutableBufferPointer < Element >
30+
31+ public subscript( index: Int ) -> Element {
32+ _read {
33+ yield buffer [ index]
34+ }
35+ nonmutating _modify {
36+ yield & buffer[ index]
37+ }
38+ }
39+ }
40+
2841// CHECK: #if __cplusplus >= 202302L
2942// CHECK-NEXT: SWIFT_INLINE_THUNK int operator [](int x, int _2) const SWIFT_SYMBOL("s:9Operators6IntBoxVys5Int32VAE_AEtcig");
3043// CHECK-NEXT: #endif // #if __cplusplus >= 202302L
You can’t perform that action at this time.
0 commit comments