iostreams icon indicating copy to clipboard operation
iostreams copied to clipboard

Fix to compile with Visual C++ and /Zc:implicitNoexcept-.

Open jaykrell opened this issue 3 years ago • 9 comments

Otherwise gets: Error C2694 'override': overriding virtual function has less restrictive exception specification than base class virtual member function 'base'

Similar changes are being made e.g.: https://github.com/boostorg/json/pull/636

See also, similar from me: https://github.com/boostorg/format/pull/85

jaykrell avatar Oct 21 '21 01:10 jaykrell

This PR doesn't look correct, because it uses noexcept and override unconditionally. This will cause errors for C++03 and on MSVC versions earlier than 2015 (or 2013, I don't remember which version introduced noexcept.)

These need to be BOOST_NOEXCEPT and BOOST_OVERRIDE, respectively. Perhaps just BOOST_NOEXCEPT, because override isn't necessary here.

pdimov avatar Oct 21 '21 02:10 pdimov

Ok. Serious question then: instead of = default should I use { }? Or is that going to "too old" compiler?

jaykrell avatar Oct 21 '21 02:10 jaykrell

Since you specifically said C++03 I suspect I should go with { }.

jaykrell avatar Oct 21 '21 02:10 jaykrell

Since you specifically said C++03 I suspect I should go with { }.

How about BOOST_DEFAULTED_FUNCTION? (see https://www.boost.org/doc/libs/1_77_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_allow_use_of_c__11_features_with_c__03_compilers)

mclow avatar Oct 21 '21 02:10 mclow

I think you should squash the 3 commits into a single one, as it's not desirable to have not-quite-correct versions in the history. Note: I am not speaking with any particular authority, just making a drive-by comment...

rdoeffinger avatar Feb 01 '22 12:02 rdoeffinger

I think you should squash the 3 commits into a single one, as it's not desirable to have not-quite-correct versions in the history. Note: I am not speaking with any particular authority, just making a drive-by comment...

I agree, but, is it approved othewise? That can be done upon commit in the GitHub gui, including editing the commit message.

Opinions vary and are strong about PR workflow. I've seen people, reviewing my code, request strongly never to rebase a PR, as it makes the PR harder to read. Even if then squash upon commit is the only choice.

jaykrell avatar Feb 02 '22 03:02 jaykrell

This looks OK to me.

mclow avatar Feb 02 '22 04:02 mclow

@mclow I squashed and rebased, ok? (Is squash really required? A lot of repositories are configured to do that upon commit, not optionally. Imho that is 99% the right policy. Unless maybe CI runs and passes at each commit, and users and reviewers agree the history reads ok/better with multiple commits. But I've never seen this.)

jaykrell avatar Jul 12 '24 22:07 jaykrell

Closing/reopening to retrigger CI.

pdimov avatar Jul 13 '24 06:07 pdimov