ned14 / status-code

Proposed SG14 status_code for the C++ standard
Other
66 stars 13 forks source link

Additional move-constructor call in status_code.message() #30

Closed Tradias closed 3 years ago

Tradias commented 4 years ago

In MSVC the ternary operator in status_code.hpp:445

  string_ref message() const noexcept { return this->_domain ? string_ref(this->domain()._do_message(*this)) : string_ref("(empty)"); 

causes an additional call to the move-constructor (and therefore destructor) of string_ref. See https://godbolt.org/z/1vW4WY

ned14 commented 3 years ago

Thanks for the bug report!