Title
Kind of explicit object copy/move assignment function
Status
open
Section
11.4.4 [special]
Submitter
Corentin Jabot

Created on 2023-08-08.00:00:00 last changed 16 months ago

Messages

Date: 2023-08-08.00:00:00

Consider:

  struct S {
    auto & operator=(this S &, S&&);
    auto & operator=(this S &, const S&);
  };

The rule in 11.4.4 [special] paragraph 5 does not treat explicit-object member functions correctly:

Two special member functions are of the same kind if:
  • they are both default constructors,
  • they are both copy or move constructors with the same first parameter type, or
  • they are both copy or move assignment operators with the same first parameter type and the same cv-qualifiers and ref-qualifier, if any.

Possible resolution:

Change in 11.4.4 [special] paragraph 5 as follows:

Two special member functions are of the same kind if:
  • they are both default constructors,
  • they are both copy or move constructors with the same first parameter type, or
  • they are both copy or move assignment operators with the same first non-object parameter type and, the same cv-qualifiers object parameter type, and either both are implicit object member functions with no ref-qualifier, if any or neither of them is.
History
Date User Action Args
2023-08-08 00:00:00admincreate