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-10965] Fatal error: Use of unimplemented initializer 'init(i:)' for class 'test.B' #53354

Open
swift-ci opened this issue Jun 18, 2019 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10965
Radar None
Original Reporter alexdemagalhaes (JIRA User)
Type Bug
Environment

Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.4)

Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)

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

md5: 1e60e6dc163cf00ca3e5073e64ea6893

Issue Description:

The following script crashes when creating an instance of B:

#!/usr/bin/swift

class A {
    private let i: Int

    private init(i: Int) {
        self.i = i
    }
}

extension A {
    convenience init() {
        self.init(i: 0)
    }
}

class B: A { }

B()

It's crashing on both Swift 4.2.1 and Swift 5.0.1. On Swift 5, the output I'm getting is:

./test.swift:19:1: warning: result of 'A' initializer is unused
B()
^~~
./test.swift: 17: 7: Fatal error: Use of unimplemented initializer 'init(i:)' for class 'test.B'
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret ./test.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name test 
0  swift                    0x000000010f399ee3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010f3996bc SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff67a82b5d _sigtramp + 29
3  libdyld.dylib            0x00007fff67882047 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 143
4  libdyld.dylib            0x00000001115f1213 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 2849436251
5  libdyld.dylib            0x00000001115f115c dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 2849436068
6  libdyld.dylib            0x00000001115f1030 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 2849435768
7  swift                    0x000000010bc3138d llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 365
8  swift                    0x000000010bc37762 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 1090
9  swift                    0x000000010b200831 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 58929
10 swift                    0x000000010b1ee92e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
11 swift                    0x000000010b18c9ce main + 1246
12 libdyld.dylib            0x00007fff678973d5 start + 1
Illegal instruction: 4

Making A's init non-private fixes the issue. I couldn't find any existing reported bugs with exactly this same issue.

@belkadan
Copy link
Contributor

@slavapestov, looks like your #25137 changes the behavior here. What do you want to do with this bug?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

2 participants