Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-1801] Segmentation fault 11 when using a convenience initializer #44410

Closed
swift-ci opened this issue Jun 17, 2016 · 4 comments
Closed

[SR-1801] Segmentation fault 11 when using a convenience initializer #44410

swift-ci opened this issue Jun 17, 2016 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1801
Radar None
Original Reporter stemichels (JIRA User)
Type Bug
Status Resolved
Resolution Won't Do

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, ClangImporter, CompilerCrash
Assignee None
Priority Medium

md5: cd100a3312808a32594e2ea190d24e06

Issue Description:

I get a crash if i try to compile the following code

import Foundation
import CoreGraphics

public extension CGPath {
    public convenience init(roundedRect rect: CGRect, corner: CGSize) {
        self.init(roundedRect: rect, cornerWidth: corner.width, cornerHeight: corner.height, transform: nil)
    }
}

Output:
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)

Version:
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)

@belkadan
Copy link
Contributor

cc @milseman

@swift-ci
Copy link
Collaborator Author

Comment by Stephan Michels (JIRA)

Now, I don't any longer segmentation fault, but I still can't create an convenience constructor:

error: BadAccessPlayground.playground:13:24: error: convenience initializers are not supported in extensions of CF types
public convenience init(roundedRect rect: CGRect, corner: CGSize) {

@slavapestov
Copy link
Member

This is correct. We have no way to compile such an initializer.

@belkadan
Copy link
Contributor

Specifically, convenience initializers can be inherited, and your new one can't be in a safe way. The feature we need here is what we call "factory initializers" inside the compiler. (It's not out of the question, either! Just still needs some design.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants