From 8ecdfb718b7f4e5cd11166262117a386ec2a9450 Mon Sep 17 00:00:00 2001 From: Cheng Date: Sun, 29 Dec 2024 23:56:30 +0900 Subject: [PATCH] Fix export.cpp compilation with MSVC (#1737) --- mlx/export.cpp | 18 +++++++----------- tests/export_import_tests.cpp | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/mlx/export.cpp b/mlx/export.cpp index 377c6c601..743d20409 100644 --- a/mlx/export.cpp +++ b/mlx/export.cpp @@ -9,17 +9,13 @@ #define TOSTRING(x) STRINGIFY(x) // clang-format off -#define SERIALIZE_PRIMITIVE(primitive, keys...) \ - { \ - #primitive, { \ - [](Writer& os, const Primitive& p) { \ - serialize_primitive(os, p); \ - }, \ - [](Reader& is, Stream s) { \ - return deserialize_primitive(is, s); \ - }, \ - {keys} \ - } \ +#define SERIALIZE_PRIMITIVE(primitive, ...) \ + { \ + #primitive, { \ + serialize_primitive, \ + deserialize_primitive, \ + {__VA_ARGS__} \ + } \ } // clang-format on diff --git a/tests/export_import_tests.cpp b/tests/export_import_tests.cpp index 41c7ade02..83ee1e590 100644 --- a/tests/export_import_tests.cpp +++ b/tests/export_import_tests.cpp @@ -13,7 +13,7 @@ using namespace mlx::core; namespace { std::string get_temp_file(const std::string& name) { - return std::filesystem::temp_directory_path().append(name); + return std::filesystem::temp_directory_path().append(name).string(); } } // namespace