-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
!!! BREAKING CHANGE !!! - catch exceptions as const reference in <LEVEL>_THROWS_AS #81
Comments
hmmm - both boost.test and googletest add I'll have to think about this - I'm not yet comfortable to change this since it would be a breaking change. |
than catch is broken and google and boost test not. |
I decided to merge this - it's in the dev branch - but I cannot say when it'll go in master... |
@a4z @onqtam @horenmar Just to have the information at hand here. Please note that Catch wants or wanted to provide flexibility, that is, the behaviour is intended and not inherently broken per se. The doc explains: Expects that an exception of the specified type is thrown during evaluation of the expression. Note that the exception type is used verbatim and you should include (const) reference. |
I just looked at my docs and remembered making this decision explicitly in the past... but now I got swayed over to the other camp... I really cannot decide what the right way to go is... |
... Connecting to Phil. |
I apologize for using the word broken for catch, it was maybe to strong? (I am not native English speaker) are there test cases for the edge case where defaulting const& would break things? |
@a4z Catch's |
Freedom to shoot yourself in the foot is what C++ is all about, right? |
well, @martinmoene , I see i like this, prom a pragmatic view: Sitting with 20 embedded devs, 7 hate the 21 century, 7 don't care as long as nothing changes, 3 would like to move forward but have already resigned , and the rest would like to introduce todays development practices. like meaning full unit tests and BDD testing. But however, adding a patch to my package build is also a solution, and what whatever argument s used to continue with this obviously less intuitive and born out of a workaround way, it do not have to follow it anyway ;-) |
catch exceptions as const reference,
static code analyzers do not like it different, this is also according to all C++ guidelines.
(MFC might make it different, but the exception from the rule should not be generalize to all use cases)
CHECK_THROWS_AS (foo, const ExceptionType&) ;
is definitly not as nice and expressive as
CHECK_THROWS_AS (foo, ExceptionType) ;
The text was updated successfully, but these errors were encountered: