|
3 | 3 | // RUN: %FileCheck %s < %t/operators.h
|
4 | 4 |
|
5 | 5 | // RUN: %check-interop-cxx-header-in-clang(%t/operators.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
|
| 6 | +// RUN: %check-interop-cxx-header-in-clang(%t/operators.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++23) |
6 | 7 |
|
7 | 8 | // CHECK-LABEL: namespace Operators SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Operators") {
|
8 | 9 |
|
|
12 | 13 |
|
13 | 14 | // CHECK: }
|
14 | 15 |
|
15 |
| -public struct IntBox { var x: CInt } |
| 16 | +public struct IntBox { |
| 17 | + var x: CInt |
| 18 | + |
| 19 | + public subscript(x: CInt) -> CInt { |
| 20 | + return x |
| 21 | + } |
| 22 | + |
| 23 | + public subscript(x: CInt, _: CInt) -> CInt { |
| 24 | + return x |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +// CHECK: #if __cplusplus >= 202302L |
| 29 | +// CHECK-NEXT: SWIFT_INLINE_THUNK int operator [](int x, int _2) const SWIFT_SYMBOL("s:9Operators6IntBoxVys5Int32VAE_AEtcig"); |
| 30 | +// CHECK-NEXT: #endif // #if __cplusplus >= 202302L |
16 | 31 |
|
17 | 32 | public func -(lhs: IntBox, rhs: IntBox) -> CInt {
|
18 | 33 | return lhs.x - rhs.x
|
19 | 34 | }
|
20 | 35 |
|
21 | 36 | // CHECK: SWIFT_INLINE_THUNK int operator-(const IntBox& lhs, const IntBox& rhs) noexcept SWIFT_SYMBOL("s:9Operators1soiys5Int32VAA6IntBoxV_AFtF") SWIFT_WARN_UNUSED_RESULT {
|
22 |
| -// CHECK: return _impl::$s9Operators1soiys5Int32VAA6IntBoxV_AFtF(_impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(lhs)), _impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(rhs))); |
23 |
| -// CHECK: } |
| 37 | +// CHECK-NEXT: return _impl::$s9Operators1soiys5Int32VAA6IntBoxV_AFtF(_impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(lhs)), _impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(rhs))); |
| 38 | +// CHECK-NEXT: } |
24 | 39 |
|
25 | 40 | public func ==(lhs: IntBox, rhs: IntBox) -> Bool {
|
26 | 41 | return lhs.x == rhs.x
|
27 | 42 | }
|
28 | 43 |
|
29 | 44 | // CHECK: SWIFT_INLINE_THUNK bool operator==(const IntBox& lhs, const IntBox& rhs) noexcept SWIFT_SYMBOL("s:9Operators2eeoiySbAA6IntBoxV_ADtF") SWIFT_WARN_UNUSED_RESULT {
|
30 |
| -// CHECK: return _impl::$s9Operators2eeoiySbAA6IntBoxV_ADtF(_impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(lhs)), _impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(rhs))); |
31 |
| -// CHECK: } |
| 45 | +// CHECK-NEXT: return _impl::$s9Operators2eeoiySbAA6IntBoxV_ADtF(_impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(lhs)), _impl::swift_interop_passDirect_Operators_uint32_t_0_4(_impl::_impl_IntBox::getOpaquePointer(rhs))); |
| 46 | +// CHECK-NEXT: } |
0 commit comments