boostorg / leaf

Lightweight Error Augmentation Framework
Boost Software License 1.0
312 stars 48 forks source link

Fix: Return rvalue-ref to stored_ in rref-qualified deref-operators #32

Closed vector-of-bool closed 2 years ago

vector-of-bool commented 2 years ago

result::value() correctly returns std::move(stored_), but operator* simply returns value(), which will always call the lref-qualified value(), and incorrectly attempt to bind the returned (lvalue reference) to an rvalue reference.

This change calls move(*this) for an rvalue call to value()

zajo commented 2 years ago

Thank you! I should add unit tests for this.