Skip to content

Commit d38067c

Browse files
committed
[cxx-interop] Instantiate the std::function constructor with a const pointer argument
We were trying to instantiate a constructor for `std::function` from a C function pointer with a non-const function pointer type. That worked well on most platforms, where `std::function` defines a single constructor for const and non-const function pointers, but failed on UBI 9. This fixes a test (`Interop/Cxx/stdlib/use-std-function.swift`) on UBI Linux. rdar://118026392
1 parent 7c16527 commit d38067c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ClangImporter/ClangDerivedConformances.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ void swift::conformToCxxFunctionIfNeeded(
10581058

10591059
auto funcPointerType = clangCtx.getPointerType(clangCtx.getFunctionType(
10601060
operatorCallDecl->getReturnType(), operatorCallParamTypes,
1061-
clang::FunctionProtoType::ExtProtoInfo()));
1061+
clang::FunctionProtoType::ExtProtoInfo())).withConst();
10621062

10631063
// Create a fake variable with a function type that matches the type of
10641064
// `operator()`.

0 commit comments

Comments
 (0)