Skip to content

Commit 460716a

Browse files
committed
Keep defaulted destructors inline
applies to exception classes in case of msvc only
1 parent 84a36b9 commit 460716a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/fmt/format-inl.h

+2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref) {
201201
#endif
202202
} // namespace detail
203203

204+
#if !FMT_MSC_VER
204205
FMT_API FMT_FUNC format_error::~format_error() FMT_NOEXCEPT = default;
205206
FMT_API FMT_FUNC system_error::~system_error() FMT_NOEXCEPT = default;
207+
#endif
206208

207209
FMT_FUNC void system_error::init(int err_code, string_view format_str,
208210
format_args args) {

include/fmt/format.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777
# define FMT_GCC_VISIBILITY_HIDDEN
7878
#endif
7979

80+
#ifdef _MSC_VER
81+
# define FMT_MSC_DEFAULT = default
82+
#else
83+
# define FMT_MSC_DEFAULT
84+
#endif
85+
8086
#if __cplusplus == 201103L || __cplusplus == 201402L
8187
# if defined(__INTEL_COMPILER) || defined(__PGI)
8288
# define FMT_FALLTHROUGH
@@ -865,7 +871,7 @@ class FMT_API format_error : public std::runtime_error {
865871
format_error& operator=(const format_error&) = default;
866872
format_error(format_error&&) = default;
867873
format_error& operator=(format_error&&) = default;
868-
~format_error() FMT_NOEXCEPT FMT_OVERRIDE;
874+
~format_error() FMT_NOEXCEPT FMT_OVERRIDE FMT_MSC_DEFAULT;
869875
};
870876

871877
FMT_MODULE_EXPORT_END
@@ -3302,7 +3308,7 @@ class FMT_API system_error : public std::runtime_error {
33023308
system_error& operator=(const system_error&) = default;
33033309
system_error(system_error&&) = default;
33043310
system_error& operator=(system_error&&) = default;
3305-
~system_error() FMT_NOEXCEPT FMT_OVERRIDE;
3311+
~system_error() FMT_NOEXCEPT FMT_OVERRIDE FMT_MSC_DEFAULT;
33063312

33073313
int error_code() const { return error_code_; }
33083314
};

0 commit comments

Comments
 (0)