mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is required to make the compiler distinguish between instantiations of `std::function`. Previously, when generating a Swift type name for a `std::function` instantiation, we would always emit `_` as the template parameter. If someone referenced two different instantiations of `std::function` in a Swift module, they would get mangled with the same name, triggering linker errors later. rdar://103979602
22 lines
866 B
C++
22 lines
866 B
C++
#ifndef TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_WITH_FUNCTION_ARGUMENT_H
|
|
#define TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_WITH_FUNCTION_ARGUMENT_H
|
|
|
|
template <typename Fn>
|
|
class function_wrapper;
|
|
|
|
template <typename Ret, typename... Params>
|
|
class function_wrapper<Ret(Params...)> {
|
|
Ret (*fn)(Params... params) = nullptr;
|
|
};
|
|
|
|
typedef function_wrapper<bool(bool)> FuncBoolToBool;
|
|
typedef function_wrapper<bool()> FuncVoidToBool;
|
|
typedef function_wrapper<void(bool)> FuncBoolToVoid;
|
|
typedef function_wrapper<void()> FuncVoidToVoid;
|
|
typedef function_wrapper<int(int)> FuncIntToInt;
|
|
typedef function_wrapper<int(int, int)> FuncIntIntToInt;
|
|
typedef function_wrapper<void(int, int)> FuncIntIntToVoid;
|
|
typedef function_wrapper<void(int, int, bool)> FuncIntIntBoolToVoid;
|
|
|
|
#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_WITH_FUNCTION_ARGUMENT_H
|