You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
takesPtr(UnsafePointer(str)) // expected-warning {{initialization of 'UnsafePointer<UInt8>' results in a dangling pointer}}
12
16
// expected-note @-1 {{implicit argument conversion from 'String' to 'UnsafePointer<UInt8>' produces a pointer valid only for the duration of the call to 'init(_:)'}}
13
17
// expected-note@-2 {{use the 'withCString' method on String in order to explicitly convert argument to pointer valid for a defined scope}}
18
+
19
+
vari=0
20
+
vard=0.0
21
+
vararr=[1,2,3]
22
+
23
+
// SR-9090: Allow double optional promotion for pointer conversions.
24
+
takesDoubleOptionalPtr(&arr)
25
+
takesDoubleOptionalPtr(arr)
26
+
takesDoubleOptionalPtr(str)
27
+
takesMutableDoubleOptionalPtr(&i)
28
+
takesMutableDoubleOptionalPtr(&arr)
29
+
takesMutableDoubleOptionalTypedPtr(&d)
30
+
31
+
takesDoubleOptionalPtr(i) // expected-error {{cannot convert value of type 'Int' to expected argument type 'UnsafeRawPointer??'}}
32
+
takesMutableDoubleOptionalPtr(arr) // expected-error {{cannot convert value of type '[Int]' to expected argument type 'UnsafeMutableRawPointer??'}}
33
+
34
+
// FIXME(SR-12382): Poor diagnostic.
35
+
takesMutableDoubleOptionalTypedPtr(&i) // expected-error {{type of expression is ambiguous without more context}}
0 commit comments