-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strengthen exception specifications for stream types #3314
Strengthen exception specifications for stream types #3314
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the noexcept on osfx, this looks good; I can't guarantee I didn't miss something, though, since it's quite a lot of code...
@strega-nil-ms FYI, I pushed a conflict-free merge with |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for strengthening the STL! 🦾 🏋️ 📈 |
This PR partially addresses #3278, but also strengthens exception specifications for some other functions. References to working draft are also updated to WG21-N4928.
Move assignment operators and
swap
functions are generally marked withnoexcept
. But I think move assignment operators ofbasic_filebuf
andbasic_(i|o)fstream
shouldn't benoexcept
, because they callbasic_filebuf::close
which may in turn call virtual functions that are possibly overridden. In other words, exception may be thrown from these move assignment operators.basic_syncbuf
's should neither benoexcept
due to LWG-3498.Many move constructors remain non-
noexcept
, because they need to copy-construct abasic_streambuf
, and hence need to dynamically allocate storage forlocale
. Maybe we should fix this in vNext.Currently EDG wrongly calculates
std::is_nothrow_move_assignable_v<std::osyncstream>
andstd::is_nothrow_move_assignable_v<std::wosyncstream>
asfalse
, so these twostatic_assert
s are skipped for EDG.