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

[cxx-import] a Swift module that imports a C++ module and forces the client to enable interop produces unclear diagnostic #65833

Closed
Tracked by #65808
hyp opened this issue May 10, 2023 · 0 comments · Fixed by #66474
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ triage needed This issue needs more specific labels

Comments

@hyp
Copy link
Contributor

hyp commented May 10, 2023

Right now when a Swift module A enables interoperability and imports a C++ module cxxmod, and Swift module B that consumes it doesn't, the compiler will fail to compile B with the following error:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cxxmod.h"
        ^
/Users/alex/i/swift/test/Interop/SwiftToCxx/cross-module-refs/Inputs/cxxmod.h:1:1: error: unknown type name 'class'; did you mean 'Class'?
class TestMough {
^
<unknown>:0: note: 'Class' declared here
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "cxxmod.h"
        ^
/Users/alex/i/swift/test/Interop/SwiftToCxx/cross-module-refs/Inputs/cxxmod.h:1:16: error: expected ';' after top level declarator
class TestMough {
               ^
<unknown>:0: error: could not build Objective-C module 'cxxmod'

The diagnostic should be improved to be more clear that the client needs to enable interoperability.

@hyp hyp added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ triage needed This issue needs more specific labels labels May 10, 2023
@hyp hyp self-assigned this May 10, 2023
hyp added a commit to hyp/swift that referenced this issue Jun 8, 2023
…ould not be able to import modules that do enable C++ interoperability by default

A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes swiftlang#65833
Fixes swiftlang#65832
hyp added a commit to hyp/swift that referenced this issue Jun 8, 2023
…ould not be able to import modules that do enable C++ interoperability by default

A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes swiftlang#65833
Fixes swiftlang#65832
hyp added a commit to hyp/swift that referenced this issue Jun 9, 2023
…ould not be able to import modules that do enable C++ interoperability by default

A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes swiftlang#65833
Fixes swiftlang#65832
hyp added a commit to hyp/swift that referenced this issue Jun 12, 2023
…ould not be able to import modules that do enable C++ interoperability by default

A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes swiftlang#65833
Fixes swiftlang#65832
hjyamauchi pushed a commit to hjyamauchi/swift that referenced this issue Jun 28, 2023
…ould not be able to import modules that do enable C++ interoperability by default

A supplemental hidden frontend option allows advanced users to opt-out of this requirement.

Fixes swiftlang#65833
Fixes swiftlang#65832
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. c++ interop Feature: Interoperability with C++ triage needed This issue needs more specific labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant