diff --git a/change/react-native-windows-39577653-1e51-4a5f-899b-b34e2da6d70f.json b/change/react-native-windows-39577653-1e51-4a5f-899b-b34e2da6d70f.json new file mode 100644 index 00000000000..f19cec5485f --- /dev/null +++ b/change/react-native-windows-39577653-1e51-4a5f-899b-b34e2da6d70f.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "C++ 20: Fix \"Explicit template specialization cannot have a storage class\"", + "packageName": "react-native-windows", + "email": "ngerlem@fb.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h index 77cd04a5233..cff77c5c1d2 100644 --- a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h +++ b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h @@ -356,6 +356,21 @@ struct MethodSignatureMatchResult { bool IsSucceeded; }; +template +constexpr bool MatchInputArg() noexcept { + return std::is_same_v; +} + +template <> +constexpr bool MatchInputArg() noexcept { + return true; +} + +template <> +constexpr bool MatchInputArg() noexcept { + return true; +} + template struct MethodSignature { using Result = TResult; @@ -375,21 +390,6 @@ struct MethodSignature { } } - template - static constexpr bool MatchInputArg() noexcept { - return std::is_same_v; - } - - template <> - static constexpr bool MatchInputArg() noexcept { - return true; - } - - template <> - static constexpr bool MatchInputArg() noexcept { - return true; - } - template static constexpr bool MatchInputArgs(std::index_sequence) noexcept { return (MatchInputArg, std::tuple_element_t>() && ...);