Title: `DIR-15-8-1`: move assignment self-assignment false positive · Issue #889 · github/codeql-coding-standards · GitHub
Open Graph Title: `DIR-15-8-1`: move assignment self-assignment false positive · Issue #889 · github/codeql-coding-standards
X Title: `DIR-15-8-1`: move assignment self-assignment false positive · Issue #889 · github/codeql-coding-standards
Description: 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
Open Graph Description: 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 #...
X Description: 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 al...
Opengraph URL: https://github.com/github/codeql-coding-standards/issues/889
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`DIR-15-8-1`: move assignment self-assignment false positive","articleBody":"### Affected rules\n - `DIR-15-8-1`\n\n### Description\n\nUsing 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.\n\n### Example\n```cpp\n#include \u003cutility\u003e\n\nclass resource_manager {\n public:\n resource_manager() = default;\n ~resource_manager() = default;\n resource_manager(resource_manager const\u0026) = delete;\n resource_manager(resource_manager\u0026\u0026) = default;\n resource_manager\u0026 operator=(resource_manager const\u0026) = delete;\n resource_manager\u0026 operator=(resource_manager\u0026\u0026 other) \u0026 noexcept {\n resource_manager temp{std::move(other)};\n std::swap(resource_, temp.resource_);\n return *this;\n }\n private:\n using resource = int;\n resource resource_;\n};\n\nint main() {}\n```\nI am getting a\n```\n\"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\"\n```\nwhen analyzing with `cpp/misra/src/rules/DIR-15-8-1/CopyAndMoveAssignmentsShallHandleSelfAssignment.ql`.","author":{"url":"https://github.com/fjatWbyT","@type":"Person","name":"fjatWbyT"},"datePublished":"2025-04-24T11:04:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/889/codeql-coding-standards/issues/889"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:833fa070-c461-ebe1-4e50-02252037e0e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8300:29F431:148976B:1B82A90:6964A4F6 |
| html-safe-nonce | ff60a9452b05f636aa9a42c154ad6d1d234d536a77faa3aa77a67e0ac85997cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzAwOjI5RjQzMToxNDg5NzZCOjFCODJBOTA6Njk2NEE0RjYiLCJ2aXNpdG9yX2lkIjoiODM3Mjc5ODcyNTM2NzgzMzg0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e41954a34baf35dd4e97adbb959c7b1657268ceb275cc1f20297909cf05caa80 |
| hovercard-subject-tag | issue:3016881059 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/codeql-coding-standards/889/issue_layout |
| twitter:image | https://opengraph.githubassets.com/35f23efa7f82da4d2b92f843c1d98de84475caa61e2a9d2380a73dd905b567e7/github/codeql-coding-standards/issues/889 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/35f23efa7f82da4d2b92f843c1d98de84475caa61e2a9d2380a73dd905b567e7/github/codeql-coding-standards/issues/889 |
| og:image:alt | 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 #... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fjatWbyT |
| hostname | github.com |
| expected-hostname | github.com |
| None | baa7d9900fdf7b27d604f36887af878d569cfbdcf97126832a5f4f0caf0c6ba5 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/codeql-coding-standards git https://github.com/github/codeql-coding-standards.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 513154248 |
| octolytics-dimension-repository_nwo | github/codeql-coding-standards |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 513154248 |
| octolytics-dimension-repository_network_root_nwo | github/codeql-coding-standards |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 842eff1d11f899d02b6b3b98fa3ea4860e64b34e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width