Skip to content

DCL51-CPP: _FUN incorrectly flagged #300

Closed
@lcartey

Description

@lcartey

Affected rules

  • DCL51-CPP

Description

gcc generates a _FUN static member function when handling lambdas that are converted to function pointers:

https://github.com/gcc-mirror/gcc/blob/7b206ae7f17455b69349767ec48b074db260a2a7/gcc/cp/lambda.cc#L1138-L1142

This function is incorrectly flagged as a "user written" function with a compiler reserved prefix.

We should update the query to exclude Functions and Variables which are compiler generated.

Example

void g(int (*l)(int)) {}

void test_lambda(const int y) {
  // Lambda generates a static function called `_FUN` when the lambda is
  // converted to a function pointer
  g([](int x) { return x; }); // COMPLIANT[FALSE_POSITIVE] - compiler generated
}

Metadata

Metadata

Assignees

Labels

false positive/false negativeAn issue related to observed false positives or false negatives.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions