This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
Subclause 9.5.2 [dcl.fct.def.default] paragraph 1 specifies:
A function that is explicitly defaulted shall
- ...
- 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”, where T is the name of the member function's class) as if it had been implicitly declared,
- ...
Therefore, the following code is ill-formed:
struct S
{
int i;
S(const S&) = default;
S(const volatile S&) = default; // ill-formed
};
volatile S s1;
S s2(s1);
However, C.7.7 [diff.class] paragraph 2 mentions the ability to default such a constructor:
If volatile semantics are required for the copy, a user-declared constructor or assignment must be provided. [ Note: This user-declared constructor may be explicitly defaulted. —end note]
Notes from the November, 2016 meeting:
This issue is to be resolved editorially and is placed in "review' status until the corresponding change appers in a working draft.
Additional note (February, 2022):
The change has been applied editorially with commit 219538.