Andrzej Krzemienski wrote:
niedz., 7 kwi 2019 o 14:10 Peter Dimov via Boost
napisaĆ(a): Bjorn Reese wrote:
The destructor should be marked as noexcept.
Destructors are noexcept by default.
Actually, that is not the case. The noexcept property of a destructor without explicit noexcept annotation is determined by inspecting noexcept property of destructors of non-static data members of the class and its base classes. Since these subobjects are private implementation of your class, and we are not aware of how their destructors are implemented, we cannot determine whether variant's destructor is noexcept or not.
This is an interesting point. However, the standard doesn't mark the destructors as noexcept, and I'm not sure I see why this same logic doesn't apply to it. http://eel.is/c++draft/variant.dtor http://eel.is/c++draft/optional.dtor http://eel.is/c++draft/any.cons#23 http://eel.is/c++draft/unique.ptr.single.dtor