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
Check the result of a dynamic_cast. #6143
Conversation
This was caught by coverity.
*data.mapping_q1_data, | ||
output_data); | ||
const auto *data = dynamic_cast<const InternalData *>(&internal_data); | ||
if (data != nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it should work
if (const auto *data = dynamic_cast<const InternalData *>(&internal_data) )
{
...
}
Hm, I find this obfuscating. There is no Is the problem that coverity can't look through what we do in our |
As far as I see, |
You're right: 1465505 is indeed for transform. I misread Coverity's report since these blocks are superficially similar. @bangerth Unfortunately |
We can't do what you suggest -- we have a bunch of tests that require that we return from a failed I don't recall, though -- can a |
Yes, it is allowed to |
@bangerth The C++ standard draft [1] explicitly lists an example of a no-return function that throws an error. (Stack unwinding in case of an exception is not the same as returning from a call.) |
So could we put that attribute at the right place? When the assertion fails, it calls
which either ends up in The first of these functions, The second of these functions,
So this function may return, and consequently,
so when called from |
This was caught by coverity.