diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index a31a5858d2489..ae91fe04fb822 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -5322,6 +5322,14 @@ ClangTypeEscapability::evaluate(Evaluator &evaluator, ClangTypeEscapability({elemTy, desc.impl, desc.annotationOnly}), CxxEscapability::Unknown); } + if (const auto *vecTy = desugared->getAs()) { + return evaluateOrDefault( + evaluator, + ClangTypeEscapability( + {vecTy->getElementType()->getUnqualifiedDesugaredType(), desc.impl, + desc.annotationOnly}), + CxxEscapability::Unknown); + } // Base cases if (desugared->isAnyPointerType() || desugared->isBlockPointerType() || diff --git a/test/Interop/Cxx/class/safe-interop-mode-darwin.swift b/test/Interop/Cxx/class/safe-interop-mode-darwin.swift new file mode 100644 index 0000000000000..6f7de581e863c --- /dev/null +++ b/test/Interop/Cxx/class/safe-interop-mode-darwin.swift @@ -0,0 +1,34 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: %target-swift-frontend -typecheck -verify -I %swift_src_root/lib/ClangImporter/SwiftBridging -Xcc -std=c++20 -I %t/Inputs %t/test.swift -strict-memory-safety -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 + +// REQUIRES: objc_interop +// REQUIRES: swift_feature_LifetimeDependence +// REQUIRES: OS=macosx + +//--- Inputs/module.modulemap +module Test { + header "nonescapable.h" + requires cplusplus +} + +//--- Inputs/nonescapable.h +#pragma once + +#include +#include + +using VecOfSimd = std::vector; +using MySimd = simd::float3; + +//--- test.swift +import Test +import CxxStdlib + +func simdConsideredSafe(x : MySimd) { + let _ = x +} + +func simdVecConsideredSafe(x : VecOfSimd) { + let _ = x +} \ No newline at end of file