Skip to content

Commit d56c5b4

Browse files
committed
Fix bug exposed while moving to constexpr
1 parent 21500a1 commit d56c5b4

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/test_module.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,23 @@ class TestBaseType
1212
TestBaseType(int) : val(10), const_val(15), mdarray{} { }
1313
TestBaseType(int *) : val(10), const_val(15), mdarray{} { }
1414

15-
TestBaseType(const TestBaseType &) = default;
16-
virtual ~TestBaseType() {}
15+
TestBaseType(const TestBaseType &other)
16+
: val(other.val), const_val(other.const_val), const_val_ptr(&const_val),
17+
func_member(other.func_member)
18+
{
19+
}
20+
21+
TestBaseType(TestBaseType &&other)
22+
: val(other.val), const_val(other.const_val), const_val_ptr(&const_val),
23+
func_member(std::move(other.func_member))
24+
{
25+
}
26+
27+
28+
TestBaseType &operator=(TestBaseType &&) = delete;
29+
TestBaseType &operator=(const TestBaseType &) = delete;
30+
31+
virtual ~TestBaseType() = default;
1732
virtual int func() { return 0; }
1833

1934
int base_only_func() { return -9; }
@@ -36,8 +51,6 @@ class TestBaseType
3651
t_str = "42";
3752
}
3853

39-
private:
40-
TestBaseType &operator=(const TestBaseType &) = delete;
4154
};
4255

4356
class Type2
@@ -78,22 +91,14 @@ int to_int(TestEnum t)
7891
class TestDerivedType : public TestBaseType
7992
{
8093
public:
81-
~TestDerivedType() override {}
82-
TestDerivedType(const TestDerivedType &) = default;
83-
TestDerivedType() = default;
8494
virtual int func() override { return 1; }
8595
int derived_only_func() { return 19; }
8696

87-
private:
88-
TestDerivedType &operator=(const TestDerivedType &) = delete;
8997
};
9098

9199
class TestMoreDerivedType : public TestDerivedType
92100
{
93101
public:
94-
TestMoreDerivedType(const TestMoreDerivedType &) = default;
95-
TestMoreDerivedType() = default;
96-
virtual ~TestMoreDerivedType() {}
97102
};
98103

99104
std::shared_ptr<TestBaseType> derived_type_factory()

0 commit comments

Comments
 (0)