mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 02:30:28 +00:00
Initial support for C++ function pointers (#7788)
This change introduces a new inst kind `CppFunctionPointerType`, which represents an imported C++ function pointer that can be invoked from Carbon (support for forming such a pointer from a Carbon function is in a follow-up PR). This is implemented by treating the operation of invoking a function pointer in C++ as if it were a call to an `__invoke` method on the function pointer type, and extending the existing function-import logic to support importing this fictitious method. --------- Co-authored-by: Nicholas Bishop <nbishop@nbishop.net>
This commit is contained in:
1 parent
f65572a1e6
commit
12e1afeb15
41 files changed
+2030
-200
No files matched your search
@@ -81,6 +81,9 @@ auto PerformCallToCppFunction(Context& context, SemIR::LocId loc_id,
|
||||
case CARBON_KIND(SemIR::CalleeNonFunction _): {
|
||||
CARBON_FATAL("overloads should produce functions");
|
||||
}
|
||||
case CARBON_KIND(SemIR::CalleeCppFunctionPointer _): {
|
||||
CARBON_FATAL("overloads should produce functions");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user