Xcode 7.0: Swift subclass of generic superclass doesn't automatically inherit initializer

Originator:kylealanhale
Number:rdar://22802130 Date Originated:22-Sep-2015 09:53 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.0 (7A220)
Classification:Other Bug Reproducible:Always
 
Summary:
When subclassing a generic superclass, automatic initializer inheritance does not occur.

Steps to Reproduce:
Create a generic class with an initializer
Subclass it
Attempt to initialize subclass

Expected Results:
Subclass automatically inherits initializer and instantiates

Actual Results:
Compiler error: “…cannot be constructed because it has no accessible initializers”

Comments

Another repro

I stumbled upon this when subclassing with a generic argument from a non-generic class. I've also found that the error only occurs if the designated initializer takes any arguments.

Example:

   class A {
       init(someData: AnyObject) {}
   }

class B<T> : A { }

class C { func someFunction() { var objB = B<Int>(5) } // error }

By johnhammerlund at March 8, 2016, 11:32 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!