AutosarC++19_03-A4.5.1

Expressions with type enum or enum class shall not be used as operands to built-in and overloaded operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=

Required inputs: IR

Possible Messages

Key

Text

Severity

Disabled

enum_operand_outside_comparison

Use of enum operand in arithmetic or similar context

None

False

Options

allow_bitmask_type

allow_bitmask_type : bool = True

If set to true, allow enum/enum class as operands to arithmetic operators if they satisfy the "BitmaskType" concept. Note: The Axivion Suite does not detect if a class actually satisfy the "BitmaskType" concept, please refer to the option fully_qualified_bitmask_types.
 

fully_qualified_bitmask_types

fully_qualified_bitmask_types

Type: set[bauhaus.analysis.config.QualifiedName]

Default: {'std::_Codecvt_mode', 'std::_Iosb::_Fmtflags', 'std::_Iosb::_Iostate', 'std::_Iosb::_Openmode', 'std::ctype_base::mask', 'std::filesystem::copy_options', 'std::filesystem::directory_options', 'std::filesystem::perms', 'std::ios_base::fmtflags', 'std::ios_base::iostate', 'std::ios_base::openmode', 'std::launch', 'std::regex_constants::match_flag_type', 'std::regex_constants::syntax_option_type', 'std::regex_traits::char_class_type'}

A set of fully qualified types that satisfy the "BitmaskType" concept. This has no effect if allow_bitmask_type is not enabled.
 

report_use_in_operator_calls

report_use_in_operator_calls : bool = True

Whether enum arguments in calls to forbidden overloaded operators should be reported.