Skip to content

Commit 42eccac

Browse files
authored
Fix clang warning about ignoring __declspec(dllexport) on basic_data<void> template instantitation definition (fmtlib#2220)
1 parent aec5043 commit 42eccac

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

include/fmt/core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@
223223
#ifndef FMT_EXTERN_TEMPLATE_API
224224
# define FMT_EXTERN_TEMPLATE_API
225225
#endif
226-
#ifndef FMT_INSTANTIATION_DEF_API
227-
# define FMT_INSTANTIATION_DEF_API FMT_API
226+
#ifndef FMT_INSTANTIATION_DECL_API
227+
# define FMT_INSTANTIATION_DECL_API FMT_API
228228
#endif
229229

230230
#ifndef FMT_HEADER_ONLY

include/fmt/format.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,7 @@ FMT_INLINE uint16_t bsr2log10(int bsr) {
995995
return data[bsr];
996996
}
997997

998-
#ifndef FMT_EXPORTED
999-
FMT_EXTERN template struct basic_data<void>;
1000-
#endif
998+
FMT_EXTERN template struct FMT_INSTANTIATION_DECL_API basic_data<void>;
1001999

10021000
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
10031001
struct data : basic_data<> {};

src/format.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ vformat_to(buffer<char>&, string_view,
5555
type_identity_t<char>>>);
5656
} // namespace detail
5757

58-
template struct FMT_INSTANTIATION_DEF_API detail::basic_data<void>;
58+
// Clang doesn't allow dllexport on template instantiation definitions (LLVM
59+
// D61118).
60+
template struct detail::basic_data<void>;
5961

6062
// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
6163
int (*instantiate_format_float)(double, int, detail::float_specs,

0 commit comments

Comments
 (0)