[swift-users] Is this a compiler bug?

Howard Lovatt howard.lovatt at gmail.com
Mon Sep 4 20:54:59 CDT 2017


Hi All,

Is this a compiler bug?

struct Box<T> {
    var value: T
    init(_ value: T) { self.value = value }
    /// Unboxing operator.
    static func >> <T>(left: Box<T>, right: inout T?) {
        right = left.value
    }
}

var u: String?
let b = Box("Test")
b >> &u // ERROR: Cannot convert value of type 'Box<String>' to expected
argument type 'Box<_>'

Am I missing something?

Thanks in advance for any help,
  -- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170905/404fe8e4/attachment.html>


More information about the swift-users mailing list