Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3295

LLVM Crash using AutoreleasingUnsafeMutablePointer<Bool?>?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
      None

      Description

      The following code crashes LLVM, paste that into a Playground:

      import Foundation
      
      extension Scanner
      {
      	func scanBool(_ result: AutoreleasingUnsafeMutablePointer<Bool?>?) -> Bool
      	{
      		result?.pointee = true
      		return true
      	}
      }
      
      let scanner = Scanner(string: "foo")
      var b: Bool?
      scanner.scanBool(&b)
      

      You get "LLDB RPC server has crashed." I've attached a crash report.

      Workaround: If I change the thing to an NSNumber? it works. Also changing the parameter to an inout works too, although then you lose the ability to specify nil as receiving variable.

      The same crash occurs when passing a swift struct. So apparently there is a problem converting certain swift types into AutoreleasingUnsafeMutablePointers.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            cocoanetics Oliver Drobnik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: