[swift-users] 'inout Data' is not convertible to 'Data'

Rick Mann rmann at latencyzero.com
Mon Apr 24 16:21:01 CDT 2017


Oh wow, it's the debugLog() call! If that's inside the block, it fails to compile.

> On Apr 24, 2017, at 14:18 , Rick Mann via swift-users <swift-users at swift.org> wrote:
> 
> I could swear this was compiling a couple days ago, as I was making the call inside the block and dealing with issues around that.
> 
> Can anyone explain what's going on here?
> 
> class
> MyClass
> {
>    func
>    execute()
>    {
>        self.dataBuffer = Data(capacity: lgsImageDataSize)
> 
>        self.dataBuffer?.withUnsafeMutableBytes
>        ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
>        error: 'inout Data' is not convertible to 'Data'
> 
>        { (inBuffer) -> Void in
>            some_call(inBuffer)
>            debugLog("some_call() called")
>        }
>    }
> 
>    var             dataBuffer:     Data?
> }
> 
> some_call() is a C function that looks like this:
> 
> 	some_result*	some_call(void* data);
> 
> The generated interface in Xcode looks like:
> 
> 	public func some_call(_ data: UnsafeMutableRawPointer!) -> OpaquePointer!
> 
> I tried commenting out the call to some_call(), but I still get the error.
> 
> -- 
> Rick Mann
> rmann at latencyzero.com
> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users


-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list