-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during executionruntimeThe Swift RuntimeThe Swift Runtime
Description
Previous ID | SR-4611 |
Radar | None |
Original Reporter | mlwoollard (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Duplicate |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, RunTimeCrash, Runtime |
Assignee | None |
Priority | Medium |
md5: cae105004f0afe8b0cad98e9ecd852b9
duplicates:
- SR-5650 Remove parent field from type metadata
relates to:
- SR-3779 Program with struct nested in generic struct crashes because of “cyclic metadata dependency”
- SR-5432 Using nested type as a superclass generic parameter leads to a crash
Issue Description:
The following code compiles without warning but when run crashes instantiating Subclass instance, prior to entering Subclass.init. Would appear to be due to having nested struct A defined within Subclass and this being used as generic parameter. Refactoring struct A so its not nested and no crash. If this is not valid to use nested type as generic parameter like this should not the compiler give an error? If it is valid code the runtime crash should be fixed.
$ swiftc --version
Apple Swift version 3.1 (swiftlang-802.0.51 clang-802.0.41)
class Base<T> {}
class Subclass: Base<Subclass.A> {
struct A {}
override init() {
super.init()
}
}
let _ = Subclass()
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during executionBug → crash: Swift code crashed during executionruntimeThe Swift RuntimeThe Swift Runtime