[swift-users] Initializer inheritance doesn't work with generic class?

Joe Groff jgroff at apple.com
Mon May 16 11:55:41 CDT 2016


This is a known bug. I think Slava's currently working on fixing it.
> On May 15, 2016, at 2:41 PM, Neil Faiman via swift-users <swift-users at swift.org> wrote:
> 
> Here is another, more blatant example of the failure to inherit initializers from a generic base class:
> 
>    class Concrete {
>        init(value: Int) {}
>    }
> 
>    class ConcreteSub : Concrete {
>    }
> 
>    class Generic<T> {
>        init(value: T) {}
>    }
> 
>    class GenericSub : Generic<Int> {
>    }
> 
>    let concrete = ConcreteSub(value: 1)
>    let generic = GenericSub(value: 1)
> 
> error: 'GenericSub' cannot be constructed because it has no accessible initializers
>    let generic = GenericSub(value: 1)
>                  ^
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list