-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
Difficulty-HighA false positive or false negative report which is expected to take 1+ week effort to addressA false positive or false negative report which is expected to take 1+ week effort to addressImpact-LowStandard-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
A7-1-2
Description
We should only report a variable in a template as a candidate for adding constexpr
if all visible instantiations could use constexpr
.
Example
int x;
constexpr int* init_t(int i) {
return &x;
}
float* init_t(float f) {
return new float();
}
template <typename T> void constexpr_variable_template() {
constexpr T t1{};
T* t = init_t(t1); // COMPLIANT[FALSE_POSITIVE] for int, this could be constexpr, but not for float
}
void test() {
constexpr_variable_template<int>();
constexpr_variable_template<float>();
}
Metadata
Metadata
Assignees
Labels
Difficulty-HighA false positive or false negative report which is expected to take 1+ week effort to addressA false positive or false negative report which is expected to take 1+ week effort to addressImpact-LowStandard-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