Commit 5a4ff29
authored
[cxx-interop] Forbid C++ function template instantiation with Swift types (#77430)
Instantiating C++ function templates with Swift types is not currently supported, but the Swift compiler attempts to do so. Sometimes this leads to a compiler crash; other times it leads to a runtime crash. This patch turns those crashes into compiler errors.
At the call site of a C++ function template, the Swift compiler must convert Swift types deduced by the Swift type checker back into Clang types, which are then used to instantiate the C++ function template. Prior to this patch, this conversion was performed by ClangTypeConverter::convert(), which converts unsupported Swift types. This patch factors out some reusable parts of convert() and uses them in a new ClangTypeConverter::convertTemplateArgument() method that only converts supported template argument types. In the future, this method can be elaborated to support instantiating C++ templates with more types.
rdar://1126929401 parent d1d2411 commit 5a4ff29
File tree
4 files changed
+330
-98
lines changed- lib/AST
- test/Interop/Cxx/templates
- Inputs
4 files changed
+330
-98
lines changed
0 commit comments