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

Enabling C++ Interoperability breaks Swift code #72620

Open
wAuner opened this issue Mar 27, 2024 · 0 comments
Open

Enabling C++ Interoperability breaks Swift code #72620

wAuner opened this issue Mar 27, 2024 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++

Comments

@wAuner
Copy link

wAuner commented Mar 27, 2024

Description

When I enable C++ interoperability on my framework target, the Swift code (see below) in my framework breaks and no longer compiles. Setting the interoperability back to C lets me compile the code again.

Reproduction

  1. create an Xcode project (tested with 15.3 and Sonoma 14.4) with a framework target
  2. add a Swift source file with this example code
import Foundation

public func readPlist() {
   let plistData = try! Data(contentsOf: URL(string:"/tmp/some.plist")!)
   let plist = try! PropertyListSerialization.propertyList(from: plistData, options: .mutableContainersAndLeaves, format: nil) as? [String: Any]
}
  1. this compiles without errors, but when I set C++ interoperability to C++, it no longer comiles and gives the following warning:
    CleanShot 2024-03-27 at 15 00 30@2x

Expected behavior

Successful compilation should not depend on interoperability setting.

Environment

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Additional information

No response

@wAuner wAuner added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 27, 2024
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 2, 2024
@egorzhdan egorzhdan self-assigned this Apr 2, 2024
@hborla hborla removed the triage needed This issue needs more specific labels label Apr 27, 2024
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++
Projects
None yet
Development

No branches or pull requests

3 participants