Skip to content

Commit bc0dc75

Browse files
authored
Merge pull request #78683 from porglezomp-misc/6.1-workaround-simd-quatf
🍒6.1 [cxx-interop] Workaround name lookup issues with namespace simd
2 parents 0565209 + 90d0306 commit bc0dc75

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,14 @@ namespace {
11551155
decl->getOwningModule() &&
11561156
decl->getOwningModule()->getTopLevelModuleName() == "os")
11571157
return nullptr;
1158+
// Workaround for simd module declaring `namespace simd` on Darwin,
1159+
// causing name lookup issues. That namespace declares C++ overlays of
1160+
// types that are already refined for Swift, so let's not import the
1161+
// namespace (rdar://143007477).
1162+
if (decl->getIdentifier() && decl->getName() == "simd" &&
1163+
decl->getOwningModule() &&
1164+
decl->getOwningModule()->getTopLevelModuleName() == "simd")
1165+
return nullptr;
11581166
// If this is a top-level namespace, don't put it in the module we're
11591167
// importing, put it in the "__ObjC" module that is implicitly imported.
11601168
if (!decl->getParent()->isNamespace())
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default %s
2+
3+
// REQUIRES: objc_interop
4+
// REQUIRES: VENDOR=apple
5+
6+
import simd
7+
8+
var _: simd.simd_quatf! = nil

0 commit comments

Comments
 (0)