-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressA 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.An issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding StandardsIssue reported by an end user of CodeQL Coding Standards
Description
Affected rules
A5-16-1
:cpp/autosar/ternary-conditional-operator-used-as-sub-expression
Rule A5-16-1 (required, implementation, automated)
The ternary conditional operator shall not be used as a sub-expression.
Description
When initializing a string inside a ternary expression, A5-16-1
error is triggered.
I tried with std::uint32_t
and with a class
, and the error was not triggered.
Example
std::string const str{cond ? "str1" : "str2"}; // Triggers A5-16-1
Test const test{cond ? Test() : Test()}; // Ok
std::uint32_t const nb{cond ? 0 : 1}; // Ok
Metadata
Metadata
Assignees
Labels
Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressA 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.An issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding StandardsIssue reported by an end user of CodeQL Coding Standards
Type
Projects
Status
Triaged