Title
Missing case for deleted move assignment operator
Status
drwp
Section
11.4.6 [class.copy.assign]
Submitter
John Spicer

Created on 2012-04-27.00:00:00 last changed 4 months ago

Messages

Date: 2013-01-15.00:00:00

Additional note (January, 2013):

A similar omission exists in paragraph 11 for copy constructors.

Date: 2023-06-15.00:00:00

[ Resolved by the changes for issue 1353, accepted as a DR at the June, 2023 meeting. ]

Bullet 4 of 11.4.5.3 [class.copy.ctor] paragraph 23 says that a defaulted copy/move assignment operator is defined as deleted if the class has

a non-static data member of class type M (or array thereof) that cannot be copied/moved because overload resolution (12.2 [over.match]), as applied to M's corresponding assignment operator, results in an ambiguity or a function that is deleted or inaccessible from the defaulted assignment operator

The intent of this is that if overload resolution fails to find a corresponding copy/move assignment operator that can validly be called to copy/move a member, the class's assignment operator will be defined as deleted. However, this wording does not cover an example like the following:

  struct A {
    A();
  };

  struct B {
    B();
    const A a;
  };

  typedef B& (B::*pmf)(B&&);

  pmf p =&B::operator=;

Here, the problem is simply that overload resolution failed to find a callable function, which is not one of the cases listed in the current wording. A similar problem exists for base classes in the fifth bullet.

History
Date User Action Args
2024-07-31 09:50:46adminsetstatus: drafting -> drwp
2013-01-14 00:00:00adminsetmessages: + msg4212
2012-11-03 00:00:00adminsetstatus: open -> drafting
2012-04-27 00:00:00admincreate