-
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-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
A20-8-5
:cpp/autosar/make-unique-not-used-to-construct-object-owned-by-unique-ptr
Rule A20-8-5 (required, implementation, automated)
std::make_unique shall be used to construct objects owned by
std::unique_ptr.
A20-8-6
:cpp/autosar/make-shared-not-used-to-construct-object-owned-by-shared-ptr
Rule A20-8-6 (required, implementation, automated)
std::make_shared shall be used to construct objects owned by
std::shared_ptr.
Description
A20-8-5
triggers when initializing an unique_ptr
to nullptr
.
A20-8-6
triggers when initializing an shared_ptr
to nullptr
.
Initializing a smart pointer with a nullptr
value can be however necessary in some specific cases.
Example
std::unique_ptr<bool> uniquePtr{nullptr}; // Triggers A20-8-5
std::shared_ptr<bool> sharedPtr{nullptr}; // Triggers A20-8-6
fjatWbyT and jvonhacht
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-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