Uh oh!
There was an error while loading. Please reload this page.
Fix to compile with Visual C++ and /Zc:implicitNoexcept-. - #85
Conversation
mclow
commented
Oct 21, 2021
Why would anyone want destructors to not be noexcept by default? |
mclow
commented
Oct 21, 2021
it's to be compatible with old, broken versions of MSVC. |
jaykrell
commented
Oct 21, 2021
Why is the compiler option available? We believe we have code that depends on the old behavior. I can make up code that depends on it, at least, but not necessarily that matches real world code (imagine there is a higher level catch, that cleans up thread locals or terminates the thread, or something, with very careful management of resources). Boost should not legislate or stand in the way here? |
jaykrell
commented
Oct 21, 2021
Honestly I am a bit unsure, but this where we are. |
I think I answered that. Because an old version of MSVC implemented this (incorrect, or if you prefer a non-pejorative description - nonstandard) behavior.
I'm sure you can; but if you want to write portable code, you should mark those destructors with
Sure it does - in a minor way. Some of our classes will have implicitly generated destructors, (whose exception specification will change from compiler to compiler, because of this MSVC misfeature), while others (such as |
jaykrell
commented
Oct 21, 2021
Notice how the json motivation kinda came and went. |
jaykrell
commented
Oct 21, 2021
Our code is really not portable, very Windows-specific, fairly hopelessly so, and likely will remain that way for a very long time. |
mclow
commented
Oct 21, 2021
I did notice that. But by that time Peter had landed the patch, and so ASIO has this in it.
I'm not saying "No, I won't land this patch", but I'm trying to understand the necessity, and figure out what the best way to resolve this problem. It may seem that I'm saying "Well, the best way is for you to fix your code and stop using this dumb compiler 'feature'", but that's really not what I'm saying. |
jaykrell
commented
Oct 21, 2021
Isn't it the other way around? This tries to make the exception specification always the same? |
mclow
commented
Oct 21, 2021
Not unless we use it everywhere in boost. |
jaykrell
commented
Oct 21, 2021
Yeah, I kinda admitted that. My PRs only cover what I hit in our code. Selfish. Or a starting point. :) I mean, sprinkling noexcept on all destructors..isn't actually correct, I guess? |
Right..there is a sort of transitiveness of noexcept(false) so sprinkling noexcept has to be mindful of the base, members, etc., else could get it wrong. |
mclow
commented
Oct 21, 2021
Looks like "Environment: FLAVOR=Visual Studio 2019, APPVEYOR_BUILD_WORKER_IMAGE=Visual Studio 2019, B2_ADDRESS_MODEL=address-model=64, B2_CXXFLAGS=cxxflags=-permissive-, B2_CXXSTD=latest, B2_TOOLSET=msvc-14.2" didn't like your change, even though all the other ones did. |
jaykrell
commented
Oct 21, 2021
https://ci.appveyor.com/project/jeking3/format-bhjc4/builds/41225712/job/p0rc2y68a1xtdh6q Huh, that is close to what we are using, except we don't use |
jaykrell
commented
Oct 21, 2021
Rude/lazy question: Was CI working before my change? Can we PR a nop/whitespace/comment change and see how it does? |
jaykrell
commented
Oct 21, 2021
If we are talking about the same warnings/errors, this does appear to be a preexisting condition. |
jeking3
commented
Feb 18, 2022
@jaykrell CI is working again, if you rebase it'll run everything now. |
1 similar comment
jeking3
commented
May 16, 2024
@jaykrell CI is working again, if you rebase it'll run everything now. |
/Zc:implicitNoexcept-. 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.: boostorg/json#636 And proposed here: boostorg/iostreams#136 I grant there there could be more of this. These two are just enough for our codebase.
fd3543a to
a3368d3Compare
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.:
boostorg/json#636
And proposed here by me:
boostorg/iostreams#136
I grant there there could be more of this.
These two are just enough for our codebase.