File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @id cpp/misra/virtual-base-class-cast-to-derived
3+ * @name RULE-8-2-1: A virtual base class shall only be cast to a derived class by means of dynamic_cast
4+ * @description Casting from a virtual base class to a derived class using anything other than
5+ * dynamic_cast causes undefined behavior.
6+ * @kind problem
7+ * @precision very-high
8+ * @problem.severity error
9+ * @tags external/misra/id/rule-8-2-1
10+ * scope/single-translation-unit
11+ * external/misra/enforcement/decidable
12+ * external/misra/obligation/required
13+ */
14+
15+ import cpp
16+ import codingstandards.cpp.misra
17+ import codingstandards.cpp.rules.pointertoavirtualbaseclasscasttoapointer.PointerToAVirtualBaseClassCastToAPointer
18+
19+ class VirtualBaseClassCastToDerivedQuery extends PointerToAVirtualBaseClassCastToAPointerSharedQuery {
20+ VirtualBaseClassCastToDerivedQuery ( ) {
21+ this = Conversions2Package:: virtualBaseClassCastToDerivedQuery ( )
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ cpp/common/test/rules/pointertoavirtualbaseclasscasttoapointer/PointerToAVirtualBaseClassCastToAPointer.ql
You can’t perform that action at this time.
0 commit comments