From 589b93de45aa0c6f93db9dba46c3f6e143abc043 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 25 Feb 2017 18:37:06 +0100 Subject: [PATCH] Add default copy constructor to SystemError (#475) * Add default copy constructor to SystemError * Add FMT_DEFAULTED_COPY_CTOR macro --- fmt/format.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fmt/format.h b/fmt/format.h index 4ba63b58..6a0837f5 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -246,6 +246,20 @@ typedef __int64 intmax_t; TypeName& operator=(const TypeName&) #endif +#ifndef FMT_USE_DEFAULTED_FUNCTIONS +# define FMT_USE_DEFAULTED_FUNCTIONS 0 +#endif + +#ifndef FMT_DEFAULTED_COPY_CTOR +# if FMT_USE_DEFAULTED_FUNCTIONS || FMT_HAS_FEATURE(cxx_defaulted_functions) || \ + (FMT_GCC_VERSION >= 404 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1800 +# define FMT_DEFAULTED_COPY_CTOR(TypeName) \ + TypeName(const TypeName&) = default; +# else +# define FMT_DEFAULTED_COPY_CTOR(TypeName) +# endif +#endif + #ifndef FMT_USE_USER_DEFINED_LITERALS // All compilers which support UDLs also support variadic templates. This // makes the fmt::literals implementation easier. However, an explicit check @@ -2405,6 +2419,7 @@ class SystemError : public internal::RuntimeError { SystemError(int error_code, CStringRef message) { init(error_code, message, ArgList()); } + FMT_DEFAULTED_COPY_CTOR(SystemError) FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef) FMT_API ~SystemError() FMT_DTOR_NOEXCEPT;