File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -2291,9 +2291,10 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
2291
2291
return nullptr ;
2292
2292
}
2293
2293
2294
- paramTy = refType->getPointeeType ();
2295
- if (!paramTy.isConstQualified ())
2296
- isInOut = true ;
2294
+ paramTy = refType->getPointeeType ();
2295
+ if (isa<clang::LValueReferenceType>(paramTy) && !paramTy.isConstQualified ()) {
2296
+ isInOut = true ;
2297
+ }
2297
2298
}
2298
2299
2299
2300
if (!swiftParamTy) {
Original file line number Diff line number Diff line change @@ -13,10 +13,9 @@ var StdIteratorTestSuite = TestSuite("StdIterator")
13
13
14
14
StdIteratorTestSuite . test ( " init " ) {
15
15
var vector = Vector ( )
16
- var _1 : CInt = 1
17
16
//There seems to be an issue when importing this method, where the const_ref is mapped with
18
17
//the correct typealias to be able to pass immutable values. related to: https://github.com/apple/swift/pull/41611
19
- vector. push_back ( & _1 )
18
+ vector. push_back ( 1 )
20
19
//ideally we should call vector.begin(), however we need to prevent a copy of self before vector.begin() is invoked
21
20
//current workaround is to use beginMutating()
22
21
let it = vector. beginMutating ( )
@@ -25,10 +24,9 @@ StdIteratorTestSuite.test("init") {
25
24
26
25
StdIteratorTestSuite . test ( " advance " ) {
27
26
var vector = Vector ( )
28
- var _1 : CInt = 1 , _2 : CInt = 2 , _3 : CInt = 3
29
- vector. push_back ( & _1)
30
- vector. push_back ( & _2)
31
- vector. push_back ( & _3)
27
+ vector. push_back ( 1 )
28
+ vector. push_back ( 2 )
29
+ vector. push_back ( 3 )
32
30
var it = vector. beginMutating ( )
33
31
std. __1. advance ( & it, 2 )
34
32
expectEqual ( it [ 0 ] , 3 )
Original file line number Diff line number Diff line change @@ -24,18 +24,16 @@ StdVectorTestSuite.test("init") {
24
24
25
25
StdVectorTestSuite . test ( " push back " ) {
26
26
var v = Vector ( )
27
- var _42 : CInt = 42
28
- v. push_back ( & _42)
27
+ v. push_back ( 42 )
29
28
expectEqual ( v. size ( ) , 1 )
30
29
expectFalse ( v. empty ( ) )
31
30
expectEqual ( v [ 0 ] , 42 )
32
31
}
33
32
34
33
func fill( vector v: inout Vector ) {
35
- var _1 : CInt = 1 , _2 : CInt = 2 , _3 : CInt = 3
36
- v. push_back ( & _1)
37
- v. push_back ( & _2)
38
- v. push_back ( & _3)
34
+ v. push_back ( 1 )
35
+ v. push_back ( 2 )
36
+ v. push_back ( 3 )
39
37
}
40
38
41
39
// TODO: in some configurations the stdlib emits a "initializeWithCopy" where the arguments
You can’t perform that action at this time.
0 commit comments