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

Interop: Use of c++20 type char8_t confuses the swift compiler and Xcode #68726

Open
ADKaster opened this issue Sep 23, 2023 · 0 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++

Comments

@ADKaster
Copy link

Description

An imported cxx module (clang module) with a struct that uses the type char8_t has its char8_t member dropped on the floor.

Steps to reproduce

In this fork of the swift-cmake-examples:

https://github.com/ADKaster/swift-cmake-examples/tree/xcode-15/Interop

I have a CMake project that uses c++20, sets the interop flag to true, has a C++20-only feature in the C++ component (a char8_t member).

When I generate an Xcode project

cmake -S Interop -B Xcode -GXcode

and open that Xcode project in Xcode Version 15.0 (15A240d), I can set the interop mode to C++, and set the C++ language standard to C++20 (or gnu++20), and the project builds.

cmake --build Xcode

or

Build in Xcode GUI

Expected behavior

Building and running the project gives an executable E that when run, prints Version(major: 1, minor: 0, patch: 0)

However, there are two bugs instead:

  1. the major version is dropped on the floor
swift-cmake-examples/Interop$ ./Xcode/Sources/Swift/Executable/Debug/E
Version(minor: 0, patch: 0)
  1. Xcode cannot parse the native module when ctrl+clicking on the module:
image image image

Environment

  • Swift compiler version info: swift-driver version:

1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx13.0

  • Xcode version info:

Xcode 15.0
Build version 15A240d

  • Deployment target: macOS 13.0 (running 13.6)

I reported this on apple developer a few months ago but didn't get a reply that actually helped.

https://developer.apple.com/forums/thread/735186

@ADKaster ADKaster added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Sep 23, 2023
@hborla hborla added c++ interop Feature: Interoperability with C++ and removed triage needed This issue needs more specific labels labels 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

2 participants