File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2346,6 +2346,12 @@ ClangImporter::Implementation::importParameterType(
2346
2346
return None;
2347
2347
} else if (isa<clang::ReferenceType>(paramTy) &&
2348
2348
isa<clang::TemplateTypeParmType>(paramTy->getPointeeType ())) {
2349
+ // We don't support rvalue reference / universal perfect ref, bail.
2350
+ if (paramTy->isRValueReferenceType ()) {
2351
+ addImportDiagnosticFn (Diagnostic (diag::rvalue_ref_params_not_imported));
2352
+ return None;
2353
+ }
2354
+
2349
2355
auto templateParamType =
2350
2356
cast<clang::TemplateTypeParmType>(paramTy->getPointeeType ());
2351
2357
swiftParamTy = findGenericTypeInGenericDecls (
Original file line number Diff line number Diff line change 1
1
// RUN: rm -rf %t
2
2
// RUN: split-file %s %t
3
+ // RUN: %target-swift-frontend -typecheck -verify -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop
3
4
// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
4
5
5
6
//--- Inputs/module.modulemap
@@ -12,13 +13,20 @@ module Test {
12
13
13
14
void acceptRValueRef( int &&) ;
14
15
16
+ template < class T>
17
+ void notStdMove( T &&) ;
18
+
15
19
//--- test.swift
16
20
17
21
import Test
18
22
19
23
public func test( ) {
20
24
var x : CInt = 2
21
- acceptRValueRef ( x)
25
+ acceptRValueRef ( x) // expected-error {{cannot find 'acceptRValueRef' in scope}}
22
26
// CHECK: note: function 'acceptRValueRef' unavailable (cannot import)
23
27
// CHECK: note: C++ functions with rvalue reference parameters are unavailable in Swift
28
+
29
+ notStdMove ( x) // expected-error {{cannot find 'notStdMove' in scope}}
30
+ // CHECK: note: function 'notStdMove' unavailable (cannot import)
31
+ // CHECK: note: C++ functions with rvalue reference parameters are unavailable in Swift
24
32
}
Original file line number Diff line number Diff line change 20
20
21
21
// CHECK: func lvalueReference<T>(_ ref: inout T)
22
22
// CHECK: func constLvalueReference<T>(_: T)
23
- // CHECK: func forwardingReference<T>(_: inout T)
24
23
// CHECK: func PointerTemplateParameter<T>(_: UnsafeMutablePointer<T>)
25
24
26
25
// CHECK: enum Orbiters {
You can’t perform that action at this time.
0 commit comments