Skip to content

[cxx-interop] Reference to type metadata pointer for imported c++ class can be improperly referenced in C++ import header #80538

Closed
@ADKaster

Description

@ADKaster

Description

Not sure how to reduce this one, my college try of ~1h didn't seem to reproduce the issue.

As noted in #80291 (comment), When the issue with the import header is worked around with -enable-library-evolution -enable-experimental-feature AssumeResilientCxxTypes, a new issue showed up

Reproduction

git clone [email protected]:ADKaster/ladybird-browser.git
cd ladybird-browser
git checkout 683f4ed9c63a9c4af9374d1ef52e3469848efa79
swiftly install --use  main-snapshot-2025-04-02
cmake --preset default \
  -DCMAKE_C_COMPILER=$(swiftly use --print-location)/usr/bin/clang \
  -DCMAKE_CXX_COMPILER=$(swiftly use --print-location)/usr/bin/clang++ \
  -DENABLE_SWIFT=ON
ninja -C Build/release LibWeb
[3273/3377] Building CXX object Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/Parser/HTMLParser.cpp.o
FAILED: Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/Parser/HTMLParser.cpp.o
/usr/bin/ccache /home/andrew/.local/share/swiftly/toolchains/main-snapshot-2025-04-02/usr/bin/clang++ -DENABLE_COMPILETIME_FORMAT_CHECK -DLIBWEB_USE_SWIFT -DLibWeb_EXPORTS -DSK_CODEC_DECODES_BMP -DSK_CODEC_DECODES_GIF -DSK_CODEC_DECODES_ICO -DSK_CODEC_DECODES_JPEG -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_RAW -DSK_CODEC_DECODES_WBMP -DSK_CODEC_DECODES_WEBP -DSK_DISABLE_TRACING -DSK_ENABLE_AVX512_OPTS -DSK_ENABLE_PRECOMPILE -DSK_FONTMGR_ANDROID_AVAILABLE -DSK_FONTMGR_FONTCONFIG_AVAILABLE -DSK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE -DSK_FONTMGR_FREETYPE_EMBEDDED_AVAILABLE -DSK_FONTMGR_FREETYPE_EMPTY_AVAILABLE -DSK_GAMMA_APPLY_TO_A8 -DSK_GANESH -DSK_GL -DSK_HAS_WUFFS_LIBRARY -DSK_R32_SHIFT=16 -DSK_SUPPORT_PDF -DSK_TYPEFACE_FACTORY_FREETYPE -DSK_USE_PERFETTO -DSK_USE_VMA -DSK_VULKAN -DSK_XML -DUSE_FONTCONFIG=1 -DUSE_VULKAN=1 -D_FILE_OFFSET_BITS=64 -I/home/andrew/ladybird-org/ladybird-browser -I/home/andrew/ladybird-org/ladybird-browser/Services -I/home/andrew/ladybird-org/ladybird-browser/Libraries -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Services -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries -I/home/andrew/.local/share/swiftly/toolchains/main-snapshot-2025-04-02/usr/include -I/home/andrew/ladybird-org/ladybird-browser/Meta/Lagom/../.. -I/home/andrew/ladybird-org/ladybird-browser/Meta/Lagom/../../Libraries -I/home/andrew/ladybird-org/ladybird-browser/Meta/Lagom/../../Services -I/home/andrew/ladybird-org/ladybird-browser/Build/release -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries/LibWeb/include -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/AK/include -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries/LibCore/include -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries/LibGfx/include -I/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries/LibGC/include -isystem /home/andrew/ladybird-org/ladybird-browser/Build/release/vcpkg_installed/x64-linux-dynamic/include -isystem /home/andrew/ladybird-org/ladybird-browser/Build/release/vcpkg_installed/x64-linux-dynamic/include/skia -O2 -g -DNDEBUG -std=c++23 -fPIC -fcolor-diagnostics -Wall -Wextra -fno-exceptions -ffp-contract=off -Wcast-qual -Wformat=2 -Wimplicit-fallthrough -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wsuggest-override -Wno-invalid-offsetof -Wno-unknown-warning-option -Wno-unused-command-line-argument -Werror -fconstexpr-steps=16777216 -Wmissing-prototypes -Wno-implicit-const-int-float-conversion -Wno-user-defined-literals -Wno-unqualified-std-cast-call -fno-semantic-interposition -fvisibility-inlines-hidden -fstack-protector-strong -fstrict-flex-arrays=2 -Wno-maybe-uninitialized -Wno-shorten-64-to-32 -fsigned-char -ggnu-pubnames -fPIC -O2 -g1 -Wno-overloaded-virtual -MD -MT Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/Parser/HTMLParser.cpp.o -MF Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/Parser/HTMLParser.cpp.o.d -o Lagom/Libraries/LibWeb/CMakeFiles/LibWeb.dir/HTML/Parser/HTMLParser.cpp.o -c /home/andrew/ladybird-org/ladybird-browser/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
In file included from /home/andrew/ladybird-org/ladybird-browser/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp:53:
/home/andrew/ladybird-org/ladybird-browser/Build/release/Lagom/Libraries/LibWeb/include/LibWeb-Swift.h:5857:12: error: use of undeclared identifier '__CellNested'
 5857 |     return __CellNested::_impl::$sSo2GCO4CellV7VisitorVMa(0)._0;
      |            ^
1 error generated.

$sSo2GCO4CellV7VisitorVMa corresponds to

$ ~/demumble/demumble \$sSo2GCO4CellV7VisitorVMa
type metadata accessor for __C.GC.Cell.Visitor

Expected behavior

Build with no warnings or errors

Environment

Swift version 6.2-dev (LLVM 86709865028dc89, Swift 2e6d7f7)
Target: x86_64-unknown-linux-gnu
Build config: +assertions

swiftly main-snapshot-2025-04-02 on Ubuntu 24.04

Additional information

No response

Metadata

Metadata

Assignees

Labels

FrontendArea → compiler: FrontendbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++swift to c++Feature → c++ interop: swift to c++

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions