This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


2221. Copying volatile objects

Section: 9.5.2  [dcl.fct.def.default]     Status: CD6     Submitter: 2016-01-09     Date: Vinny Romano

Subclause 9.5.2 [dcl.fct.def.default] paragraph 1 specifies:

A function that is explicitly defaulted shall

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