Skip to content

M0-1-2 - A3-1-5 - A4-5-1 - M0-1-1 : Poor lambda support #605

Open
@nbusser

Description

@nbusser

Affected rules

  • M0-1-2
  • A3-1-5
  • A4-5-1
  • M0-1-1

Description

Using lambda expression trigger various side effects alerts.

Example

A3-1-5

const auto lambda = []() -> void {} // Trigger A3-1-5

A4-5-1

enum Enum { A, B };

const auto lambda = [](const Enum e) -> void {}

const auto e = Enum::A;
lambda(e); // Triggers A4-5-1

M0-1-1 / M0-1-2

std::uint32_t u32{0};

const auto lambda = [&u32]() -> void {
  ++u32;
}

lambda();

if (u32 == 0) { // Triggers M0-1-2
  return;
}

foo(); // (could be any expression) Triggers M0-1-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressImpact-MediumStandard-AUTOSARfalse positive/false negativeAn issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding Standards

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions