C++ interoperability is broken (Windows platform)

static_assert(false) is a new feature in C++23. paper: P2593R1
However, Microsoft-STL simply used it without language version checking.
This is causing problems.

EDIT: This has been reported as a defect and retroactively applied to existing C++. (not MS's fault)
It seems to be unavailable until the Clang compiler for Swift is upgraded.

2 Likes

Thanks for the insight!

Is there a possibility that one of the Swift 6 versions may see a clang upgrade (at least for windows)? It's beginning to look more and more necessary for Windows Swift/C++ interop to work at all.

From that well-written linked paper above, :laughing: it's important to have a good laugh, as infuriating as things may seem at times:

Thanks to all the people over the years to whom I’ve had to explain why static_assert(false); doesn’t work and what they have to write instead for not immediately destroying their computers and switching to Rust.

Thanks again. :smile:

How do I do that? Or is it already clear that this won't help?
Tried adding -Xcc -std=c++20 without success.

Support for static_assert(false) is not available in the older clang. We have backported this to the 5.10 release and I put up a change for the current stable branch at [Clang] Implement CWG2518 - static_assert(false) by compnerd ¡ Pull Request #9200 ¡ swiftlang/llvm-project ¡ GitHub. The change should be part of the next rebranch already. Once PR9200 is merged and a stable toolchain following that is released, this issue should be resolved.

4 Likes

I love everything you’ve been doing for Swift on Windows, you’ve been such an asset to the Swift community.

I just wanted to ask, is there a way to use your fixed Swift version in GitHub actions via compnerd/gha-setup-swift@main?

1 Like

Thank you! :blue_heart:

I'm not sure I understand the question. That action should be usable already, is something broken? If you are simply enquiring if the action is maintained, then, yes, that action is maintained (and patches to improve it are welcome!) and we do also use it at The Browser Company, so there is more than just a single person invested in it.

Sorry, I was not clear on my question, what I had meant to ask --

Is there a specific branch and tag we can use in the interim, until your revision to support static_assert(false) is backported into the Swift 5.10 release?

Since the following fails at static_assert(false) on windows-latest until your revision is backported:

steps:
  - uses: compnerd/gha-setup-swift@main
    with:
      branch: swift-5.10-release
      tag: 5.10-RELEASE

Thanks again!

Oh, I see. I don't think that there is a build that has it available. The extension does support use of a GH release as well though, so if/when a build is available from the TBC CI, you would be able to use that I suppose, but otherwise, we would need to wait for an official release from swift.org.

1 Like