AutosarC++17_10-A5.1.4

A lambda expression object shall not outlive any of its reference-captured objects

Required inputs: IR

Possible Messages

Key

Text

Severity

Disabled

lambda_outlives_object

Lambda expression object outlives reference-captured object ‘{}’.

None

False

Options

allow_function_reference_parameter_capture

allow_function_reference_parameter_capture : bool = False

Whether reference-capturing a reference parameter of an enclosing function scope should be accepted.
 

allow_longer_living_local

allow_longer_living_local : bool = False

Whether reference-capturing a longer-living local variable should be accepted.
 

consider_constructors_as_capturing

consider_constructors_as_capturing : bool = False

Whether passing a lambda into a constructor should be considered as capturing the lambda. If the constructed object outlives one of the reference-captured objects, a message is issued. If set to false, passing the lambda into a constructor call has no effect on the analysis.