https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110578
Bug ID: 110578
Summary: Support dynamic_cast within the analyzer
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: vultkayn at gcc dot gnu.org
Target Milestone: ---
Created attachment 55491
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55491&action=edit
First draft of a test case for dynamic_cast
In the attached file you will find a first draft of test cases toward
supporting dynamic_cast in the analyzer. We [the analyzer] have already gained
RTTI capabilities thanks to PR97114, so supporting dynamic_cast no longer feels
that far away.
Test cases currently failing have been marked 'xfail'.
I didn't add any test case about dynamic_cast failure given reference to types,
but rather stuck to pointers, since we don't support exceptions whatsoever.
"If the cast fails and target-type is a reference type, it throws an
exception
that matches a handler of type std::bad_cast."
https://en.cppreference.com/w/cpp/language/dynamic_cast
What are your thoughts on these tests ? Do they feel complete enough for a
first implementation
of dynamic_cast into the analyzer ?