MISRA Discussion Forums
Rule 6.9.2: Are non-top level users of basic types permitted in an alias? - 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++:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=188)
+---- Forum: 4.6 Basic concepts (https://forum.misra.org.uk/forumdisplay.php?fid=192)
+---- Thread: Rule 6.9.2: Are non-top level users of basic types permitted in an alias? (/showthread.php?tid=1754)



Rule 6.9.2: Are non-top level users of basic types permitted in an alias? - gdavis - 09-10-2025

Hi,

The first exception for Rule 6.9.2 permits the use of a basic type to define a type alias.  I guess the wording may be more broad than intended.  For example,is the following permitted?

Code:
#include <list>
typedef std::list<int> int_list;

Thank you!


RE: Rule 6.9.2: Are non-top level users of basic types permitted in an alias? - misra cpp - 10-10-2025

The short answer is 'Yes',  your example is compliant (but its possible you'll get violations when you try to put objects into or take them out of a int_list).

This is a rule we are planning to review for the next version