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
Avoid const_cast in operator<<(cms::Exception, ...) #23801
Avoid const_cast in operator<<(cms::Exception, ...) #23801
Conversation
…rence with const_cast overloads
The code-checks are being triggered in jenkins. |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-23801/5494 |
A new Pull Request was created by @pieterdavid (Pieter David) for master. It involves the following packages: FWCore/Utilities @cmsbuild, @smuzaffar, @Dr15Jones can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
The tests are being triggered in jenkins. |
@pieterdavid thanks for the pull request! |
+1 |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2) |
please test |
The tests are being triggered in jenkins. |
+1 |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
While looking at the static analyzer warnings of some code that I recently modified, I noticed that there are quite some from calling
operator<<
with a temporarycms::Exception
. This picks the by-const-ref overload, which casts the const away (causing the warning) and calls the non-const version - I guess it is actually there only because the non-const version cannot be used on a temporarycms::Exception
.Using a universal reference instead should work for both (non-const) lvalue and rvalue references, I think, hence this PR, but please someone more expert on C++ check if the changes make sense.