Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A0-1-1: initialization of constexpr used as NTTP is detected as useless assignment #728

Open
Assignees
Labels
Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to address Impact-Medium Standard-AUTOSAR false positive/false negativeAn issue related to observed false positives or false negatives. user-reportIssue reported by an end user of CodeQL Coding Standards
@fjatWbyT

Description

Affected rules

  • A0-1-1 (useless assignment)

Description

Constant expression used as non-type template parameter (NTTP) produces useless-assignment false positive. It can be reproduced with integer NTTP.

Example

#include <ratio>
int main() {
 constexpr int one = 1; // True positive, this one is indeed unused (therefore, assignment is useless).
 constexpr int thirteen = 13; // False positive, used in the second argument:
 // it can be verified that main returns 13.
 std::ratio<1, thirteen> ratio;
 return ratio.den;
}

Both definitions of one and thirteen are alerted as unused on query cpp/autosar/src/rules/A0-1-1/UselessAssignment.ql.

Metadata

Metadata

Assignees

Labels

Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to address Impact-Medium Standard-AUTOSAR false 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

In Progress

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /