Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5195,7 +5195,7 @@ TinyPtrVector<ValueDecl *> CXXNamespaceMemberLookup::evaluate(
return result;
}

static const llvm::StringMap<std::vector<int>> STLConditionalEscapableParams{
static const llvm::StringMap<std::vector<int>> STLConditionalParams{
{"basic_string", {0}},
{"vector", {0}},
{"array", {0}},
Expand Down Expand Up @@ -5271,10 +5271,10 @@ ClangTypeEscapability::evaluate(Evaluator &evaluator,
return CxxEscapability::Escapable;
auto injectedStlAnnotation =
recordDecl->isInStdNamespace()
? STLConditionalEscapableParams.find(recordDecl->getName())
: STLConditionalEscapableParams.end();
? STLConditionalParams.find(recordDecl->getName())
: STLConditionalParams.end();
bool hasInjectedSTLAnnotation =
injectedStlAnnotation != STLConditionalEscapableParams.end();
injectedStlAnnotation != STLConditionalParams.end();
auto conditionalParams = getConditionalEscapableAttrParams(recordDecl);
if (!conditionalParams.empty() || hasInjectedSTLAnnotation) {
auto specDecl = cast<clang::ClassTemplateSpecializationDecl>(recordDecl);
Expand Down Expand Up @@ -8227,6 +8227,7 @@ CxxValueSemantics::evaluate(Evaluator &evaluator,
CxxValueSemanticsDescriptor desc) const {

const auto *type = desc.type;
auto *importerImpl = desc.importerImpl;

auto desugared = type->getUnqualifiedDesugaredType();
const auto *recordType = desugared->getAs<clang::RecordType>();
Expand All @@ -8238,7 +8239,7 @@ CxxValueSemantics::evaluate(Evaluator &evaluator,
// When a reference type is copied, the pointer’s value is copied rather than
// the object’s storage. This means reference types can be imported as
// copyable to Swift, even when they are non-copyable in C++.
if (recordHasReferenceSemantics(recordDecl, desc.importerImpl))
if (recordHasReferenceSemantics(recordDecl, importerImpl))
return CxxValueSemanticsKind::Copyable;

if (recordDecl->isInStdNamespace()) {
Expand All @@ -8247,10 +8248,40 @@ CxxValueSemantics::evaluate(Evaluator &evaluator,
if (recordDecl->getIdentifier() &&
recordDecl->getName() == "_Optional_construct_base")
return CxxValueSemanticsKind::Copyable;

auto injectedStlAnnotation =
STLConditionalParams.find(recordDecl->getName());

if (injectedStlAnnotation != STLConditionalParams.end()) {
auto specDecl = cast<clang::ClassTemplateSpecializationDecl>(recordDecl);
auto &argList = specDecl->getTemplateArgs();
for (auto argToCheck : injectedStlAnnotation->second) {
auto arg = argList[argToCheck];
llvm::SmallVector<clang::TemplateArgument, 1> nonPackArgs;
if (arg.getKind() == clang::TemplateArgument::Pack) {
auto pack = arg.getPackAsArray();
nonPackArgs.assign(pack.begin(), pack.end());
} else
nonPackArgs.push_back(arg);
for (auto nonPackArg : nonPackArgs) {

auto argValueSemantics = evaluateOrDefault(
evaluator,
CxxValueSemantics(
{nonPackArg.getAsType()->getUnqualifiedDesugaredType(),
desc.importerImpl}),
{});
if (argValueSemantics != CxxValueSemanticsKind::Copyable)
return argValueSemantics;
}
}

return CxxValueSemanticsKind::Copyable;
}
}

const auto cxxRecordDecl = dyn_cast<clang::CXXRecordDecl>(recordDecl);
if (!cxxRecordDecl) {
if (!cxxRecordDecl || !cxxRecordDecl->isCompleteDefinition()) {
if (hasNonCopyableAttr(recordDecl))
return CxxValueSemanticsKind::MoveOnly;
return CxxValueSemanticsKind::Copyable;
Expand Down
8 changes: 2 additions & 6 deletions test/Interop/Cxx/class/noncopyable-typechecker.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend -cxx-interoperability-mode=default -typecheck -verify - -I %t/Inputs %t/test.swift
// RUN: %target-swift-frontend -cxx-interoperability-mode=default -typecheck -verify -I %t/Inputs %t/test.swift
// RUN: %target-swift-frontend -cxx-interoperability-mode=default -Xcc -std=c++20 -verify-additional-prefix cpp20- -D CPP20 -typecheck -verify -I %t/Inputs %t/test.swift

//--- Inputs/module.modulemap
Expand Down Expand Up @@ -45,17 +45,14 @@ using NonCopyableRequires = RequiresCopyableT<NonCopyable>;
import Test
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}
// expected-note@-1 {{'where T: Copyable' is implicit here}}
// expected-cpp20-note@-2 {{'where T: Copyable' is implicit here}}
func takeCopyable<T: Copyable>(_ x: T) {} // expected-note * {{'where T: Copyable' is implicit here}}

func userDefinedTypes() {
let nCop = NonCopyable()
takeCopyable(nCop) // expected-error {{global function 'takeCopyable' requires that 'NonCopyable' conform to 'Copyable'}}

let ownsT = OwnsNonCopyable()
takeCopyable(ownsT) // no error, OwnsNonCopyable imported as Copyable

}

#if CPP20
Expand All @@ -64,4 +61,3 @@ func useOfRequires() {
takeCopyable(nCop) // expected-cpp20-error {{global function 'takeCopyable' requires that 'NonCopyableRequires' (aka 'RequiresCopyableT<NonCopyable>') conform to 'Copyable'}}
}
#endif

10 changes: 10 additions & 0 deletions test/Interop/Cxx/stdlib/Inputs/std-map.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ inline UnorderedMap initUnorderedMap() { return {{1, 3}, {3, 3}, {2, 2}}; }
inline Map initEmptyMap() { return {}; }
inline UnorderedMap initEmptyUnorderedMap() { return {}; }

struct NonCopyable {
NonCopyable() = default;
NonCopyable(const NonCopyable &other) = delete;
NonCopyable(NonCopyable &&other) = default;
~NonCopyable() {}
};

using MapNonCopyableKey = std::map<NonCopyable, int>;
using MapNonCopyableValue = std::map<int, NonCopyable>;

#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_MAP_H
9 changes: 9 additions & 0 deletions test/Interop/Cxx/stdlib/Inputs/std-set.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ inline SetOfCInt initSetOfCInt() { return {1, 5, 3}; }
inline UnorderedSetOfCInt initUnorderedSetOfCInt() { return {2, 4, 6}; }
inline MultisetOfCInt initMultisetOfCInt() { return {2, 2, 4, 6}; }

struct NonCopyable {
NonCopyable() = default;
NonCopyable(const NonCopyable &other) = delete;
NonCopyable(NonCopyable &&other) = default;
~NonCopyable() {}
};

using SetOfNonCopyable = std::set<NonCopyable>;

#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SET_H
8 changes: 8 additions & 0 deletions test/Interop/Cxx/stdlib/Inputs/std-unique-ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <memory>
#include <string>
#include <vector>

struct NonCopyable {
NonCopyable(int x) : x(x) {}
Expand All @@ -26,6 +27,13 @@ struct NonCopyableDerived: public NonCopyable {
inline std::shared_ptr<NonCopyable> getNonCopyableSharedPtr() { return std::make_shared<NonCopyableDerived>(42); }
inline std::unique_ptr<NonCopyable> getNonCopyableUniquePtr() { return std::make_unique<NonCopyableDerived>(42); }

inline std::vector<std::unique_ptr<NonCopyable>>
getVectorNonCopyableUniquePtr() {
std::vector<std::unique_ptr<NonCopyable>> vec;
vec.emplace_back();
return vec;
}

std::unique_ptr<int> makeInt() {
return std::make_unique<int>(42);
}
Expand Down
12 changes: 11 additions & 1 deletion test/Interop/Cxx/stdlib/Inputs/std-vector.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H
#define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H

#include <vector>
#include <string>
#include <vector>

using Vector = std::vector<int>;
using VectorOfString = std::vector<std::string>;
Expand Down Expand Up @@ -30,4 +30,14 @@ __attribute__((swift_attr("release:immortal"))) ImmortalRef {
};
using VectorOfImmortalRefPtr = std::vector<ImmortalRef *>;

struct NonCopyable {
NonCopyable() = default;
NonCopyable(const NonCopyable &other) = delete;
NonCopyable(NonCopyable &&other) = default;
~NonCopyable() {}
};

using VectorOfNonCopyable = std::vector<NonCopyable>;
using VectorOfPointer = std::vector<NonCopyable *>;

#endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_VECTOR_H
16 changes: 16 additions & 0 deletions test/Interop/Cxx/stdlib/use-std-map-typechecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe it is more elegant to do these tests via -verify. But I don't have strong feelings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with -verify is that afaik there's no equivalent to {{.*}}. The alternative is to include only part of the message, which can be either, for instance, global function 'takeCopyable' requires that 'MapNonCopyableKey' or conform to 'Copyable' but not both parts.

I'd also prefer to use -verify, so please let me know if you see any way around this!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In clang's implementation of -verify you can use regexes like expected-error-re{{foo .* bar}}. Perhaps we ought to add that to Swift also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that'd be useful!


import StdMap
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}

let mapNonCopyableKey = MapNonCopyableKey()
takeCopyable(mapNonCopyableKey)
// CHECK: error: global function 'takeCopyable' requires that 'MapNonCopyableKey' {{.*}} conform to 'Copyable'
// CHECK: note: 'where T: Copyable' is implicit here

let mapNonCopyableValue = MapNonCopyableValue()
takeCopyable(mapNonCopyableValue)
// CHECK: error: global function 'takeCopyable' requires that 'MapNonCopyableValue' {{.*}} conform to 'Copyable'
// CHECK: note: 'where T: Copyable' is implicit here
11 changes: 11 additions & 0 deletions test/Interop/Cxx/stdlib/use-std-optional-typechecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s

import StdOptional
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}

let nonNilOptNonCopyable = getNonNilOptionalHasDeletedCopyCtor()
takeCopyable(nonNilOptNonCopyable)
// CHECK: error: global function 'takeCopyable' requires that 'StdOptionalHasDeletedCopyCtor' {{.*}} conform to 'Copyable'
// CHECK: note: 'where T: Copyable' is implicit here
11 changes: 11 additions & 0 deletions test/Interop/Cxx/stdlib/use-std-set-typechecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s

import StdSet
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}

let setNonCopyable = SetOfNonCopyable()
takeCopyable(setNonCopyable)
// CHECK: error: global function 'takeCopyable' requires that 'SetOfNonCopyable' {{.*}} conform to 'Copyable'
// CHECK: note: 'where T: Copyable' is implicit here
12 changes: 12 additions & 0 deletions test/Interop/Cxx/stdlib/use-std-unique-ptr-typechecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s

// UNSUPPORTED: OS=windows-msvc

import StdUniquePtr
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}

let vecUniquePtr = getVectorNonCopyableUniquePtr()
takeCopyable(vecUniquePtr)
// CHECK: error: global function 'takeCopyable' requires that 'std{{.*}}vector{{.*}}unique_ptr{{.*}}NonCopyable{{.*}}' conform to 'Copyable'
21 changes: 21 additions & 0 deletions test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: not %target-swift-frontend %s -typecheck -I %S/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s

import StdVector
import CxxStdlib

func takeCopyable<T: Copyable>(_ x: T) {}
func takeCxxVector<V: CxxVector>(_ v: V) {}

let vecNC = VectorOfNonCopyable()
takeCopyable(vecNC)
// CHECK: error: global function 'takeCopyable' requires that 'VectorOfNonCopyable' {{.*}} conform to 'Copyable'
// CHECK: note: 'where T: Copyable' is implicit here

takeCxxVector(vecNC)
// CHECK: error: global function 'takeCxxVector' requires that 'VectorOfNonCopyable' {{.*}} conform to 'CxxVector'
// CHECK: note: where 'V' = 'VectorOfNonCopyable' {{.*}}

let vecPointer = VectorOfPointer()
takeCopyable(vecPointer)
takeCxxVector(vecPointer)
// CHECK-NOT: error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@susmonteiro, this last line of this new test is failing for Android armv7 alone, though it passes for Android AArch64 and x86_64:

2025-09-28T16:12:16.3425383Z FAIL: Swift(android-armv7) :: Interop/Cxx/stdlib/use-std-vector-typechecker.swift (4714 of 19859)
2025-09-28T16:12:16.3431078Z ******************** TEST 'Swift(android-armv7) :: Interop/Cxx/stdlib/use-std-vector-typechecker.swift' FAILED ********************
2025-09-28T16:12:16.3459417Z Exit Code: 1
2025-09-28T16:12:16.3459809Z 
2025-09-28T16:12:16.3460010Z Command Output (stderr):
2025-09-28T16:12:16.3467419Z --
2025-09-28T16:12:16.3494220Z RUN: at line 1: not /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/bin/swift-frontend -target armv7-unknown-linux-android -sdk /home/build-user/build/ndk/android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot -resource-dir /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/lib/swift -module-cache-path /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/swift-test-results/armv7-unknown-linux-androideabi/clang-module-cache -swift-version 4  -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'StdlibDeploymentTarget 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'StdlibDeploymentTarget 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'StdlibDeploymentTarget 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'StdlibDeploymentTarget 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'StdlibDeploymentTarget 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'StdlibDeploymentTarget 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'StdlibDeploymentTarget 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'StdlibDeploymentTarget 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'StdlibDeploymentTarget 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'StdlibDeploymentTarget 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'StdlibDeploymentTarget 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'StdlibDeploymentTarget 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'StdlibDeploymentTarget 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'StdlibDeploymentTarget 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'StdlibDeploymentTarget 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftStdlib 6.3:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'StdlibDeploymentTarget 6.3:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0' -typo-correction-limit 10  /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift -typecheck -I /source/swift-project/swift/test/Interop/Cxx/stdlib/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | /usr/bin/python3.12 /source/swift-project/swift/utils/PathSanitizingFileCheck --allow-unused-prefixes --sanitize BUILD_DIR=/home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64 --sanitize SOURCE_DIR=/source/swift-project/swift --ignore-runtime-warnings --use-filecheck /home/build-user/build/swift-project/Ninja-Release/llvm-linux-x86_64/bin/FileCheck   /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift
2025-09-28T16:12:16.3555401Z + not /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/bin/swift-frontend -target armv7-unknown-linux-android -sdk /home/build-user/build/ndk/android-ndk-r27d/toolchains/llvm/prebuilt/linux-x86_64/sysroot -resource-dir /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/lib/swift -module-cache-path /home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64/swift-test-results/armv7-unknown-linux-androideabi/clang-module-cache -swift-version 4 -define-availability 'SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'StdlibDeploymentTarget 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999' -define-availability 'SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'StdlibDeploymentTarget 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2' -define-availability 'SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'StdlibDeploymentTarget 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0' -define-availability 'SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'StdlibDeploymentTarget 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4' -define-availability 'SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'StdlibDeploymentTarget 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0' -define-availability 'SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'StdlibDeploymentTarget 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5' -define-availability 'SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'StdlibDeploymentTarget 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0' -define-availability 'SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'StdlibDeploymentTarget 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4' -define-availability 'SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'StdlibDeploymentTarget 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0' -define-availability 'SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'StdlibDeploymentTarget 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4' -define-availability 'SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'StdlibDeploymentTarget 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0' -define-availability 'SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'StdlibDeploymentTarget 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1' -define-availability 'SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'StdlibDeploymentTarget 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0' -define-availability 'SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'StdlibDeploymentTarget 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4' -define-availability 'SwiftStdlib 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'StdlibDeploymentTarget 6.2:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftStdlib 6.3:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'StdlibDeploymentTarget 6.3:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999' -define-availability 'SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0' -define-availability 'SwiftCompatibilitySpan 6.2:macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0' -typo-correction-limit 10 /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift -typecheck -I /source/swift-project/swift/test/Interop/Cxx/stdlib/Inputs -cxx-interoperability-mode=default -diagnostic-style llvm
2025-09-28T16:12:16.3591738Z + /usr/bin/python3.12 /source/swift-project/swift/utils/PathSanitizingFileCheck --allow-unused-prefixes --sanitize BUILD_DIR=/home/build-user/build/swift-project/Ninja-Release/swift-linux-x86_64 --sanitize SOURCE_DIR=/source/swift-project/swift --ignore-runtime-warnings --use-filecheck /home/build-user/build/swift-project/Ninja-Release/llvm-linux-x86_64/bin/FileCheck /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift
2025-09-28T16:12:16.3597560Z /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift:21:15: error: CHECK-NOT: excluded string found in input
2025-09-28T16:12:16.3611721Z // CHECK-NOT: error
2025-09-28T16:12:16.3627213Z               ^
2025-09-28T16:12:16.3628270Z <stdin>:13:75: note: found here
2025-09-28T16:12:16.3634306Z SOURCE_DIR/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift:20:1: error: global function 'takeCxxVector' requires that 'VectorOfPointer' (aka 'std.__ndk1.vector<UnsafeMutablePointer<NonCopyable>, std.__ndk1.allocator<UnsafeMutablePointer<NonCopyable>>>') conform to 'CxxVector'
2025-09-28T16:12:16.3640413Z                                                                           ^~~~~
2025-09-28T16:12:16.3640986Z 
2025-09-28T16:12:16.3641211Z Input file: <stdin>
2025-09-28T16:12:16.3645414Z Check file: /source/swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift
2025-09-28T16:12:16.3646246Z 
2025-09-28T16:12:16.3646654Z -dump-input=help explains the following input dump.
2025-09-28T16:12:16.3651553Z 
2025-09-28T16:12:16.3651763Z Input was:
2025-09-28T16:12:16.3655477Z <<<<<<
2025-09-28T16:12:16.3655927Z         .
2025-09-28T16:12:16.3659985Z         .
2025-09-28T16:12:16.3664337Z         .
2025-09-28T16:12:16.3665247Z         8: takeCxxVector(vecNC)  
2025-09-28T16:12:16.3669333Z         9: ^ 
2025-09-28T16:12:16.3674408Z        10: SOURCE_DIR/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift:7:6: note: where 'V' = 'VectorOfNonCopyable' (aka 'std.__ndk1.vector<NonCopyable, std.__ndk1.allocator<NonCopyable>>') 
2025-09-28T16:12:16.3676268Z        11: func takeCxxVector<V: CxxVector>(_ v: V) {}  
2025-09-28T16:12:16.3680935Z        12:  ^ 
2025-09-28T16:12:16.3684420Z        13: SOURCE_DIR/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift:20:1: error: global function 'takeCxxVector' requires that 'VectorOfPointer' (aka 'std.__ndk1.vector<UnsafeMutablePointer<NonCopyable>, std.__ndk1.allocator<UnsafeMutablePointer<NonCopyable>>>') conform to 'CxxVector' 
2025-09-28T16:12:16.3687195Z not:21                                                                               !~~~~                                                                                                                                                                                                                error: no match expected
2025-09-28T16:12:16.3689033Z        14: takeCxxVector(vecPointer) 
2025-09-28T16:12:16.3697027Z        15: ^ 
2025-09-28T16:12:16.3698773Z        16: SOURCE_DIR/test/Interop/Cxx/stdlib/use-std-vector-typechecker.swift:7:6: note: where 'V' = 'VectorOfPointer' (aka 'std.__ndk1.vector<UnsafeMutablePointer<NonCopyable>, std.__ndk1.allocator<UnsafeMutablePointer<NonCopyable>>>') 
2025-09-28T16:12:16.3704517Z        17: func takeCxxVector<V: CxxVector>(_ v: V) {}  
2025-09-28T16:12:16.3705161Z        18:  ^ 

I know there are 32-bit Apple CI that eventually run on all commits, do they work fine? Wondering if this failure is surfacing on all 32-bit CI or just Android armv7, let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabled the test in #84608

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this failure is surfacing on all 32-bit CI or just Android armv7, let me know what you think.

I'll investigate