`DIR-15-8-1`: move assignment self-assignment false positive
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con cpp/misra/src/rules/DIR-15-8-1/CopyAndMoveAssignmentsShallHandleSelfAssignment.ql ed eseguila sull’esempio main.cpp fornito per riprodurre l’alert sull’operatore di assegnazione per spostamento. Esamina la gestione da parte della regola dell’autoassegnazione tramite move-and-swap, quindi verifica che questo pattern valido non venga più segnalato, mentre le violazioni previste di DIR-15-8-1 continuino a essere rilevate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Affected rules
DIR-15-8-1
Description
Using the "move-and-swap idiom" proposed in the directive's example as a solution to address potential issues with self-assignment leads to an alert.
Example
#include <utility>
class resource_manager {
public:
resource_manager() = default;
~resource_manager() = default;
resource_manager(resource_manager const&) = delete;
resource_manager(resource_manager&&) = default;
resource_manager& operator=(resource_manager const&) = delete;
resource_manager& operator=(resource_manager&& other) & noexcept {
resource_manager temp{std::move(other)};
std::swap(resource_, temp.resource_);
return *this;
}
private:
using resource = int;
resource resource_;
};
int main() {}
I am getting a
"DIR-15-8-1: User-provided copy assignment operators and move assignment operators shall handle self-assignment","User-provided copy assignment operators and move assignment operators shall handle self-assignment.","error","User defined copy or user defined move does not handle self-assignment correctly.","/main.cpp","10","23","10","31"
when analyzing with cpp/misra/src/rules/DIR-15-8-1/CopyAndMoveAssignmentsShallHandleSelfAssignment.ql.
- Lingua principale
- CodeQL
- Stelle
- 227
- Fork
- 82
- Merge medio
- 6g 7h
- PR unite (30g)
- 9
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Apertafalse positive/false negative
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
github/codeql-coding-standards#1175 ·
Tutte le issue di github/codeql-coding-standards
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
duckdb/duckdb-python#627 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
objectionary/hone-maven-plugin#1078 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
nearform/ag-grid-url-sync#160 ·