5-2-2: why only virtual base class??? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.5 Expressions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=134) +---- Thread: 5-2-2: why only virtual base class??? (/showthread.php?tid=1395) |
5-2-2: why only virtual base class??? - dg1980 - 22-01-2018 Hi, the code below crashes as a result of the undefined behavior referenced in this rule. Yet, no virtual base class is used as stated in the headline, the text and the example. So, i think it could mislead any static analysis tool vendor when implementing this rule. Code: namespace nMISRA Re: 5-2-2: why only virtual base class??? - misra cpp - 17-04-2018 Rule 5-2-2 is there specifically to catch undefined behaviour with virtual bases. However, your example violates a different rule: 5-2-3 We are considering changes to 5-2-2 for the next version |