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
4 changes: 4 additions & 0 deletions lib/ClangImporter/ImportName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,10 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
if (!swift3OrLaterName && isa<clang::CXXMethodDecl>(D)) {
return ImportedName();
}
// If this function uses C++23 deducing this, bail.
if (auto functionDecl = dyn_cast<clang::FunctionDecl>(D))
if (functionDecl->hasCXXExplicitFunctionObjectParameter())
return {};

// Dig out the definition, if there is one.
if (auto def = getDefinitionForClangTypeDecl(D)) {
Expand Down
4 changes: 4 additions & 0 deletions test/Interop/Cxx/class/method/Inputs/deducing-this.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct HasDeducingThis {
int value;
int deducingRef(this HasDeducingThis &self) { return self.value; }
};
5 changes: 5 additions & 0 deletions test/Interop/Cxx/class/method/Inputs/module.modulemap
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module DeducingThis {
header "deducing-this.h"
requires cplusplus23
}

module Methods {
header "methods.h"
requires cplusplus
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %target-swift-ide-test -print-module -module-to-print=DeducingThis -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++23 | %FileCheck %s

// This mostly ensures that we don't import deducing this method with an incorrect signature.

// CHECK: struct HasDeducingThis {
// CHECK-NOT: deducingRef