Skip to content

C.21 Exception for copy-and-swap idiom #2164

Description

@eisenwave

C.21 is missing an exception for the copy-and-swap idiom. It's perfectly safe (and considered idiomatic by many) for resource management to write:

T& operator=(T) noexcept { /* ... */ }

This would violate C.21 since technically, the user has only defined the copy assignment operator, and the move assignment operator is implicitly not declared.

The lack of an exception to this rule also manifests itself in clang-tidy false positives. See:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions