Skip to content

[class.copy.ctor] p6 The implicitly declared function does declare the function #5452

Open
@xmh0511

Description

@xmh0511
Contributor

[class.copy.ctor] p6 says

If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defaulted ([dcl.fct.def]).

I wonder whether the implicitly declared move constructor is considered to declare that function?

struct A{
  /* A(A const&); implicitly declared copy constructor */

  // Cause the copy constructor to be defined as deleted?
  /* A(A&&); implicitly declared move constructor  */   
};

Anyway, "implicitly declare" is a kind of "declare", I think. Maybe, we could clarify the ambiguity with the following suggestion?

If the class definition has a user-declared move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defaulted ([dcl.fct.def]).

[class.copy.assign] p2 has a similar issue.

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

        Participants

        @xmh0511

        Issue actions

          [class.copy.ctor] p6 The implicitly declared function does declare the function · Issue #5452 · cplusplus/draft