Skip to content

Commit 9856c1d

Browse files
author
Gabor Horvath
committed
[cxx-interop] Check the safety of C++ template arguments
Swift imports template specializations as a standalone type (not as an instantiation of a generic) so unsafety is not propagated from the template arguments to the specialization. This PR propagates this information explicitly.
1 parent abcdd1f commit 9856c1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/Interop/Cxx/class/safe-interop-mode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ func useCfType(x: CFArray) {
8888
func useString(x: std.string) {
8989
}
9090

91-
// expected-warning@+1{{global function 'useVecOfPtr' involves unsafe code; use '@unsafe' to indicate that its use is not memory-safe}}
91+
// expected-warning@+1{{global function 'useVecOfPtr' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}
9292
func useVecOfPtr(x: VecOfPtr) { // expected-note{{reference to unsafe type alias 'VecOfPtr'}}
9393
}
9494

9595
func useVecOfInt(x: VecOfInt) {
9696
}
9797

98-
// expected-warning@+1{{global function 'useCppSpan' involves unsafe code; use '@unsafe' to indicate that its use is not memory-safe}}
98+
// expected-warning@+1{{global function 'useCppSpan' has an interface that is not memory-safe; use '@unsafe' to indicate that its use is unsafe}}
9999
func useCppSpan(x: SpanOfInt) { // expected-note{{reference to unsafe type alias 'SpanOfInt'}}
100100
}
101101

0 commit comments

Comments
 (0)