diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index 5d48d165b2a33..aad546c6cf053 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -2564,7 +2564,7 @@ void IRGenModule::emitSILFunction(SILFunction *f) { return; // Type metadata for foreign references is not yet supported on Windows. Bug #76168. - if (Context.LangOpts.EnableCXXInterop && + if (Context.LangOpts.EnableCXXInterop && !Context.LangOpts.hasFeature(Feature::Embedded) && f->getLinkage() == SILLinkage::Public && !Context.LangOpts.Target.isOSWindows()) noteUseOfMetadataByCXXInterop(IRGen, f, TypeExpansionContext(*f)); diff --git a/test/embedded/cxx-no-metadata.swift b/test/embedded/cxx-no-metadata.swift new file mode 100644 index 0000000000000..9fe31b91487d3 --- /dev/null +++ b/test/embedded/cxx-no-metadata.swift @@ -0,0 +1,30 @@ +// RUN: %empty-directory(%t) +// RUN: %{python} %utils/split_file.py -o %t %s + +// RUN: %target-swift-frontend -I %t %t/Main.swift -enable-experimental-feature Embedded -cxx-interoperability-mode=default -c -o %t/a.o -Rmodule-loading + +// REQUIRES: swift_in_compiler +// REQUIRES: OS=macosx || OS=linux-gnu +// REQUIRES: swift_feature_Embedded + +// BEGIN header.h + +// C++ +struct CxxStruct { + int field; +}; + +// BEGIN module.modulemap + +module MyModule { + header "header.h" +} + +// BEGIN Main.swift + +import MyModule + +public func foo(ptr: UnsafeMutablePointer?) { +} + +foo(ptr: nil)