From 42eccac45459b4a4068488d4c89ae115c53f9f28 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Mon, 12 Apr 2021 23:31:44 +0700 Subject: [PATCH] Fix clang warning about ignoring __declspec(dllexport) on basic_data template instantitation definition (#2220) --- include/fmt/core.h | 4 ++-- include/fmt/format.h | 4 +--- src/format.cc | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 086a2deb..4145bd9e 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -223,8 +223,8 @@ #ifndef FMT_EXTERN_TEMPLATE_API # define FMT_EXTERN_TEMPLATE_API #endif -#ifndef FMT_INSTANTIATION_DEF_API -# define FMT_INSTANTIATION_DEF_API FMT_API +#ifndef FMT_INSTANTIATION_DECL_API +# define FMT_INSTANTIATION_DECL_API FMT_API #endif #ifndef FMT_HEADER_ONLY diff --git a/include/fmt/format.h b/include/fmt/format.h index 890ecb16..32b42dd5 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -995,9 +995,7 @@ FMT_INLINE uint16_t bsr2log10(int bsr) { return data[bsr]; } -#ifndef FMT_EXPORTED -FMT_EXTERN template struct basic_data; -#endif +FMT_EXTERN template struct FMT_INSTANTIATION_DECL_API basic_data; // This is a struct rather than an alias to avoid shadowing warnings in gcc. struct data : basic_data<> {}; diff --git a/src/format.cc b/src/format.cc index 6141d964..e67a9a84 100644 --- a/src/format.cc +++ b/src/format.cc @@ -55,7 +55,9 @@ vformat_to(buffer&, string_view, type_identity_t>>); } // namespace detail -template struct FMT_INSTANTIATION_DEF_API detail::basic_data; +// Clang doesn't allow dllexport on template instantiation definitions (LLVM +// D61118). +template struct detail::basic_data; // Workaround a bug in MSVC2013 that prevents instantiation of format_float. int (*instantiate_format_float)(double, int, detail::float_specs,