On Windows in C++ interop mode, the generated C++ header includes internal
types
#78152
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
When building a target in C++ interop mode on Windows, and generating a Clang header, we expect that only public members will be exposed in the header. It appears that in some circumstances, internal members will also be exposed, causing any compilation including the header to fail.
Reproduction
Consider a target being built for using in a C++ project:
With a type...
And elsewhere...
On macOS, as expected, our C++ header is generated without any declaration of or reference to
Fred
, per the C++ interoperability documentation stating that only public symbols are exposed via the C++ header.On Windows, we see
Bar
and its methodqux
are declared as expected. We also see a reference toFred
, as...using Fred=Fred;
Visible in the wider context of various
Bar
declaration, in the public members section:Expected behavior
We expect
Fred
to be absent from the generated header.Environment
Swift version 6.1-dev (LLVM f4b733c38006ec1, Swift 5c7509bef50dbd7)
Additional information
Thank you everyone working on Swift / Windows C++ interoperability... You are enabling wonderful things!
The text was updated successfully, but these errors were encountered: