gitwtfhub

wtf is swift-cxx-link-bug-repro?

mrousavy/swift-cxx-link-bug-repro — explained in plain English

Analysis updated 2026-08-04 · repo last pushed 2026-04-28

2MakefileAudience · developerComplexity · 1/5MaintainedSetup · easy

TL;DR

A minimal test project that reproduces a Swift compiler bug where Swift fails to link C++20 struct equality checks. It exists to help the Swift team diagnose and fix the cross-language build failure.

Mindmap

mindmap
  root((repo))
    What it does
      Reproduces Swift bug
      Shows C++20 link failure
      Includes workaround
    Tech stack
      Swift
      C++20
      Makefile
    Use cases
      File Swift bug report
      Test cross-language builds
      Reference workaround
    Audience
      Swift compiler team
      React Native devs
      C++ bridge developers
    Context
      Affects VisionCamera
      Not a usable tool
      Diagnostic only

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Reproduce the Swift C++20 equality linking bug to confirm you are hitting the same issue.

REASON 2

Reference the included workaround to fix build failures when bridging Swift with modern C++20 structs.

REASON 3

Provide a minimal test case to the Swift compiler team when reporting related cross-language issues.

What's in the stack?

SwiftC++20Makefile

How it stacks up

mrousavy/swift-cxx-link-bug-reprojacob-matthew-cook/distributionnetbirdio/freebsd-ports
Stars231
LanguageMakefileMakefileMakefile
Last pushed2026-04-282026-03-15
MaintenanceMaintainedMaintained
Setup difficultyeasyhardmoderate
Complexity1/54/53/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Requires a Swift toolchain and a C++20-capable compiler to reproduce the bug, but the project itself is a minimal Makefile-based test case.

No license information is provided in this repository, as it is a bug reproduction rather than a usable library.

Wtf does this do

This repository is a bug report, not a usable tool. It exists to demonstrate a specific flaw in how Swift interacts with C++ code, filed as an issue against the Swift compiler itself. The author created it to give the Swift team a minimal, easy-to-test example of a problem that causes projects to fail when they try to mix the two languages. The problem happens when Swift tries to compare two C++ objects for equality. C++20 introduced a clean, standard way to write equality checks inside a struct definition. However, when Swift code tries to use that standard equality check, the build process breaks because the final linking step cannot find the underlying comparison code. The project simply will not build, even though the C++ code is perfectly valid and follows modern conventions. The repository includes a small test case that triggers the failure, along with a documented workaround. This matters to developers building cross-language features, especially in the React Native ecosystem. The author specifically mentions that this bug affects react-native-vision-camera, a popular camera library, as well as code generators that automatically create C++ structs. Anyone writing Swift code that bridges into modern C++20 libraries could run into this build failure without warning. The workaround involves writing the equality check in a slightly different, older C++ style rather than the clean modern default. That fixes the build, but it is a friction point for developers who expect their modern, standards-compliant C++ to work seamlessly with Swift. The project itself is just a diagnostic tool, not something you would build upon.

Yoink these prompts

Prompt 1
I'm hitting a Swift linker error when trying to use C++20 struct equality checks from Swift. Walk me through the workaround where I write the equality operator in the older C++ style instead of the modern default.
Prompt 2
Help me set up a minimal Swift + C++20 project that reproduces a linker failure when Swift tries to call a C++20 defaulted equality operator on a struct.
Prompt 3
I'm working on a React Native library that bridges Swift to C++20 code and my builds fail at the link step when comparing C++ structs. How do I identify if this is the same bug and apply the workaround?

Frequently asked questions

wtf is swift-cxx-link-bug-repro?

A minimal test project that reproduces a Swift compiler bug where Swift fails to link C++20 struct equality checks. It exists to help the Swift team diagnose and fix the cross-language build failure.

What language is swift-cxx-link-bug-repro written in?

Mainly Makefile. The stack also includes Swift, C++20, Makefile.

Is swift-cxx-link-bug-repro actively maintained?

Maintained — commit in last 6 months (last push 2026-04-28).

What license does swift-cxx-link-bug-repro use?

No license information is provided in this repository, as it is a bug reproduction rather than a usable library.

How hard is swift-cxx-link-bug-repro to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is swift-cxx-link-bug-repro for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.