Previously:
We know that only special member functions may be defaulted, but any function can be deleted.
[dcl.fct.def.default]
A function definition of the form:
attribute-specifier-seqopt decl-specifier-seqopt declarator = default ;
is called an explicitly-defaulted definition. A function that is explicitly defaulted shall
— be a special member function,
— have the same declared function type (except for possibly differing ref-qualifiers and except that in the case of a copy constructor or copy assignment operator, the parameter type may be “reference to non-const
T
”, whereT
is the name of the member function’s class) as if it had been implicitly declared, and— not have default arguments.
[dcl.fct.def.delete]
A function definition of the form:
attribute-specifier-seqopt decl-specifier-seqopt declarator = delete ;
is called a deleted definition. A function with a deleted definition is also called a deleted function.
My question is, why is this so? If the standard can allow any function to be deleted, I don't see the harm in allowing any function to be defaulted. n2210's wording seems to imply that defaulted free functions would be allowed. For example,
Under Changes to the Standard, it says:
[...]
Add a new paragraph 7.
A function definition of "=default;", called an explicitly defaulted definition, has exactly the implementation of an implicit default definition (12.1, 12.4, 12.8). [ Note: Member functions with explicitly defaulted definitions outside the class definition must also be declared within the class definition. — end note ] Unlike with an implicit default definition, the explicitly defaulted definition may be non-inline. [...]
3 years later, N3025 already establishes the language that resembles the final draft, and explicitly restricts defaulted functions to be special member functions. Is there a paper in that 3 year gap or some rationale that explains this?