-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix to compile with Visual C++ and /Zc:implicitNoexcept-. #85
base: develop
Are you sure you want to change the base?
Conversation
Why would anyone want destructors to not be noexcept by default? |
it's to be compatible with old, broken versions of MSVC. |
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? |
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 |
Notice how the json motivation kinda came and went. |
Our code is really not portable, very Windows-specific, fairly hopelessly so, and likely will remain that way for a very long time. |
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. |
Isn't it the other way around? This tries to make the exception specification always the same? |
Not unless we use it everywhere in boost. |
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. |
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. |
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 |
Rude/lazy question: Was CI working before my change? Can we PR a nop/whitespace/comment change and see how it does? |
If we are talking about the same warnings/errors, this does appear to be a preexisting condition. |
@jaykrell CI is working again, if you rebase it'll run everything now. |
1 similar comment
@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
a3368d3
Compare
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.