diff --git a/src/corelib/kernel/qjnitypes.h b/src/corelib/kernel/qjnitypes.h index 4556dfa0a9a..d717c0c0d25 100644 --- a/src/corelib/kernel/qjnitypes.h +++ b/src/corelib/kernel/qjnitypes.h @@ -220,12 +220,14 @@ static constexpr auto makeTupleFromArgs(Ret (*)(JNIEnv *, jclass, Args...), va_l return makeTupleFromArgsHelper(args); } -// Get the return type of a function point -template -auto nativeFunctionReturnType(Ret(*function)(Args...)) +template +struct NativeFunctionReturnType {}; + +template +struct NativeFunctionReturnType { - return function(std::declval()...); -} + using type = Ret; +}; } // namespace Detail } // namespace QtJniMethods @@ -236,7 +238,7 @@ auto nativeFunctionReturnType(Ret(*function)(Args...)) // the actual function with. This then takes care of implicit conversions, // e.g. a jobject becomes a QJniObject. #define Q_DECLARE_JNI_NATIVE_METHOD_HELPER(Method) \ -static decltype(QtJniMethods::Detail::nativeFunctionReturnType(Method)) \ +static QtJniMethods::Detail::NativeFunctionReturnType::type \ va_##Method(JNIEnv *env, jclass thiz, ...) \ { \ va_list args; \