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(
23462346 return None;
23472347 } else if (isa<clang::ReferenceType>(paramTy) &&
23482348 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+
23492355 auto templateParamType =
23502356 cast<clang::TemplateTypeParmType>(paramTy->getPointeeType ());
23512357 swiftParamTy = findGenericTypeInGenericDecls (
Original file line number Diff line number Diff line change 11// RUN: rm -rf %t
22// RUN: split-file %s %t
3+ // RUN: %target-swift-frontend -typecheck -verify -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop
34// RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
45
56//--- Inputs/module.modulemap
@@ -12,13 +13,20 @@ module Test {
1213
1314void acceptRValueRef( int &&) ;
1415
16+ template < class T>
17+ void notStdMove( T &&) ;
18+
1519//--- test.swift
1620
1721import Test
1822
1923public func test( ) {
2024 var x : CInt = 2
21- acceptRValueRef ( x)
25+ acceptRValueRef ( x) // expected-error {{cannot find 'acceptRValueRef' in scope}}
2226 // CHECK: note: function 'acceptRValueRef' unavailable (cannot import)
2327 // 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
2432}
Original file line number Diff line number Diff line change 2020
2121// CHECK: func lvalueReference<T>(_ ref: inout T)
2222// CHECK: func constLvalueReference<T>(_: T)
23- // CHECK: func forwardingReference<T>(_: inout T)
2423// CHECK: func PointerTemplateParameter<T>(_: UnsafeMutablePointer<T>)
2524
2625// CHECK: enum Orbiters {
You can’t perform that action at this time.
0 commit comments