diff options
author | Murray Cumming <murrayc@murrayc.com> | 2019-10-27 14:26:18 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2019-10-29 11:00:20 +0100 |
commit | 17498119027f9b80788298937fc41df689e93974 (patch) | |
tree | aea7c2443604570d20e70630f0e56ffb95d1910d | |
parent | fcdc822dba6b0ba440bc47ac9928da3c2217dfa7 (diff) | |
download | sigc++-17498119027f9b80788298937fc41df689e93974.tar.gz |
test_limit_reference: Avoid virtual-move-assign warning
"= delete" Bases's move operations because the defaulted one
would call non-trivial assignment operators in the virtual bases.
This avoids this compiler warning, at least with g++ 9.2:
test_limit_reference.cc:12:7: error: defaulted move assignment for ‘{anonymous}::Base’ calls a non-trivial move assignment operator for virtual base ‘sigc::trackable’ [-Werror=virtual-move-assign]
12 | class Base : virtual public sigc::trackable
| ^~~~
test_limit_reference.cc:22:7: error: defaulted move assignment for ‘{anonymous}::Derived’ calls a non-trivial move assignment operator for virtual base ‘{anonymous}::Base’ [-Werror=virtual-move-assign]
22 | class Derived : virtual public Base, public Base2
It would be nice if this test had a comment saying what it is testing.
-rw-r--r-- | tests/test_limit_reference.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_limit_reference.cc b/tests/test_limit_reference.cc index 5a7a8aa..8d1340d 100644 --- a/tests/test_limit_reference.cc +++ b/tests/test_limit_reference.cc @@ -11,6 +11,11 @@ std::ostringstream result_stream; class Base : virtual public sigc::trackable { +public: + Base() {} + + Base(Base&& src) = delete; + Base& operator=(Base&& src) = delete; }; class Base2 |