From d56c5b489b3394eb3feee9c3334405423e4e07fe Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Tue, 22 Aug 2017 16:15:25 -0600 Subject: [PATCH] Fix bug exposed while moving to constexpr --- src/test_module.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/test_module.cpp b/src/test_module.cpp index 90a1154a..4216ee5b 100644 --- a/src/test_module.cpp +++ b/src/test_module.cpp @@ -12,8 +12,23 @@ class TestBaseType TestBaseType(int) : val(10), const_val(15), mdarray{} { } TestBaseType(int *) : val(10), const_val(15), mdarray{} { } - TestBaseType(const TestBaseType &) = default; - virtual ~TestBaseType() {} + TestBaseType(const TestBaseType &other) + : val(other.val), const_val(other.const_val), const_val_ptr(&const_val), + func_member(other.func_member) + { + } + + TestBaseType(TestBaseType &&other) + : val(other.val), const_val(other.const_val), const_val_ptr(&const_val), + func_member(std::move(other.func_member)) + { + } + + + TestBaseType &operator=(TestBaseType &&) = delete; + TestBaseType &operator=(const TestBaseType &) = delete; + + virtual ~TestBaseType() = default; virtual int func() { return 0; } int base_only_func() { return -9; } @@ -36,8 +51,6 @@ class TestBaseType t_str = "42"; } - private: - TestBaseType &operator=(const TestBaseType &) = delete; }; class Type2 @@ -78,22 +91,14 @@ int to_int(TestEnum t) class TestDerivedType : public TestBaseType { public: - ~TestDerivedType() override {} - TestDerivedType(const TestDerivedType &) = default; - TestDerivedType() = default; virtual int func() override { return 1; } int derived_only_func() { return 19; } - private: - TestDerivedType &operator=(const TestDerivedType &) = delete; }; class TestMoreDerivedType : public TestDerivedType { public: - TestMoreDerivedType(const TestMoreDerivedType &) = default; - TestMoreDerivedType() = default; - virtual ~TestMoreDerivedType() {} }; std::shared_ptr derived_type_factory()