13
13
// RUN: %check-generic-interop-cxx-header-in-clang(%t/generics.h)
14
14
15
15
public struct GenericPair < T, T2> {
16
- let x : T
17
- let y : T2
16
+ var x : T
17
+ var y : T2
18
18
}
19
19
20
20
public func makeGenericPair< T, T1> ( _ x: T , _ y: T1 ) -> GenericPair < T , T1 > {
@@ -29,6 +29,15 @@ public func passThroughGenericPair<T1, T>(_ x: GenericPair<T1, T>, _ y: T) -> G
29
29
return GenericPair < T1 , T > ( x: x. x, y: y)
30
30
}
31
31
32
+ public func inoutGenericPair< T1, T> ( _ x: inout GenericPair < T1 , T > , _ y: T1 ) {
33
+ x. x = y
34
+ }
35
+
36
+ // CHECK: SWIFT_EXTERN void $s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // inoutGenericPair(_:_:)
37
+ // CHECK-NEXT: SWIFT_EXTERN void $s8Generics15makeGenericPairyAA0cD0Vyxq_Gx_q_tr0_lF(SWIFT_INDIRECT_RESULT void * _Nonnull, const void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // makeGenericPair(_:_:)
38
+ // CHECK-NEXT: SWIFT_EXTERN void $s8Generics22passThroughGenericPairyAA0dE0Vyxq_GAE_q_tr0_lF(SWIFT_INDIRECT_RESULT void * _Nonnull, const void * _Nonnull x, const void * _Nonnull y, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // passThroughGenericPair(_:_:)
39
+ // CHECK-NEXT: SWIFT_EXTERN void $s8Generics15takeGenericPairyyAA0cD0Vyxq_Gr0_lF(const void * _Nonnull x, void * _Nonnull , void * _Nonnull ) SWIFT_NOEXCEPT SWIFT_CALL; // takeGenericPair(_:)
40
+
32
41
// CHECK: template<class T_0_0, class T_0_1>
33
42
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
34
43
// CHECK-NEXT: class _impl_GenericPair;
@@ -65,7 +74,13 @@ public func passThroughGenericPair<T1, T>(_ x: GenericPair<T1, T>, _ y: T) -> G
65
74
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0> && swift::isUsableInGenericContext<T_0_1>
66
75
// CHECK-NEXT: class GenericPair;
67
76
// CHECK-EMPTY:
68
- // CHECK-NEXT: template<class T, class T1>
77
+ // CHECK-NEXT: template<class T1, class T>
78
+ // CHECK-NEXT: requires swift::isUsableInGenericContext<T1> && swift::isUsableInGenericContext<T>
79
+ // CHECK-NEXT: inline void inoutGenericPair(GenericPair<T1, T>& x, const T1 & y) noexcept {
80
+ // CHECK-NEXT: return _impl::$s8Generics16inoutGenericPairyyAA0cD0Vyxq_Gz_xtr0_lF(_impl::_impl_GenericPair<T1, T>::getOpaquePointer(x), swift::_impl::getOpaquePointer(y), swift::getTypeMetadata<T1>(), swift::getTypeMetadata<T>());
81
+ // CHECK-NEXT: }
82
+
83
+ // CHECK: template<class T, class T1>
69
84
// CHECK-NEXT: requires swift::isUsableInGenericContext<T> && swift::isUsableInGenericContext<T1>
70
85
// CHECK-NEXT: inline GenericPair<T, T1> makeGenericPair(const T & x, const T1 & y) noexcept SWIFT_WARN_UNUSED_RESULT {
71
86
// CHECK-NEXT: return _impl::_impl_GenericPair<T, T1>::returnNewValue([&](void * _Nonnull result) {
0 commit comments