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-6790] A public default implementation of a public superprotocol's requirement in an internal subprotocol is not exported in release builds resulting in a linker error #49339

Closed
swift-ci opened this issue Jan 18, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-6790
Radar None
Original Reporter neightchan (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

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

md5: a464b5c20a9c91745e155512b5fa757a

duplicates:

  • SR-2925 Inconsistent linking in debug vs. release builds w/ public method in extension of internal protocol

Issue Description:

If a framework Framework defines a public protocol

public protocol Proto {
    func foo()
}

and an internal implementation helper protocol

protocol ConcreteProto : Proto {
}

an extension of which fulfills the requirement of the public protocol

extension ConcreteProto {

    public func foo() {
        print("hi")
    }

}

when a type in that framework conforms to the internal helper implementation

public struct Impl : ConcreteProto {
    public init() {}
}

if an attempt is made to access the protocol requirement on an instance of that implementing type Impl in a different module

// Another module
Impl().foo()

a linker error will occur in release builds:

Undefined symbols for architecture x86_64:
"__T09Framework13ConcreteProtoPAAE3fooyyF", referenced from:
_main in main.o
"__T09Framework4ImplVAA13ConcreteProtoAAWP", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@belkadan
Copy link
Contributor

Unfortunately this is not supported at the moment; it's a mistake that the compiler lets it through at all.

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

No branches or pull requests

2 participants