cplusplus / cplusplus/draft

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

Open
#5,452 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [class.copy.ctor] p6 and compare the similar wording in [class.copy.assign] p2. Check whether "declares" is ambiguous for implicitly declared functions, then update the draft wording to distinguish user-declared functions; done means both clauses clearly express the intended rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.