expected
expected copied to clipboard
Fix Test failing on GCC and Clang
I hope this change resolves the error:
- val() = std::move(temp);
+ new (valptr()) T(std::move(temp));
FIX: https://github.com/TartanLlama/expected/issues/65
This fixed a crash in -O3 builds for us when a std::shared_ptr was the expected type. I'm... really, really not sure why that is... it looks like maybe the implementation of the assignment operator was decrementing the ref count down to zero in the shared_ptr's destructor, freeing the underlying object, then trying to re-increment the ref count?
In any case, thanks @ObiWahn!
@TartanLlama what is required to get this merged? Do you want me to revert the whitespace changes?