mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-02 07:01:58 +01:00
Add defaulted copy and move operations to format_error and system_error (#1347)
* Avoid weak vtables by providing a private virtual member function * Add warning Wweak-vtables to clang when FMT_PEDANTIC is on * Add defaulted copy and move operations to format_error and system_error Compiler generated copy operations are deprecated and move operations are not generated altogether. * Add warning Wdeprecated to clang when FMT_PEDANTIC is on
This commit is contained in:
committed by
Victor Zverovich
parent
b732f28c00
commit
96f91428c6
@@ -127,8 +127,13 @@ TEST(BufferTest, Ctor) {
|
||||
struct dying_buffer : test_buffer<int> {
|
||||
MOCK_METHOD0(die, void());
|
||||
~dying_buffer() { die(); }
|
||||
|
||||
private:
|
||||
virtual void avoid_weak_vtable();
|
||||
};
|
||||
|
||||
void dying_buffer::avoid_weak_vtable() {}
|
||||
|
||||
TEST(BufferTest, VirtualDtor) {
|
||||
typedef StrictMock<dying_buffer> stict_mock_buffer;
|
||||
stict_mock_buffer* mock_buffer = new stict_mock_buffer();
|
||||
|
||||
@@ -14,8 +14,13 @@
|
||||
class assertion_failure : public std::logic_error {
|
||||
public:
|
||||
explicit assertion_failure(const char* message) : std::logic_error(message) {}
|
||||
|
||||
private:
|
||||
virtual void avoid_weak_vtable();
|
||||
};
|
||||
|
||||
void assertion_failure::avoid_weak_vtable() {}
|
||||
|
||||
#define FMT_ASSERT(condition, message) \
|
||||
if (!(condition)) throw assertion_failure(message);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user