Title
"More constrained" for eligible special member functions
Status
drwp
Section
11.4.4 [special]
Submitter
Barry Revzin

Created on 2022-06-08.00:00:00 last changed 7 months ago

Messages

Date: 2023-06-20.19:34:52

Proposed resolution (approved by CWG 2023-06-17):

Change in 11.4.4 [special] paragraph 6 as follows:

An eligible special member function is a special member function for which:
  • the function is not deleted,
  • the associated constraints (13.5 [temp.constr]), if any, are satisfied, and
  • no special member function of the same kind whose associated constraints, if any, are satisfied is more constrained (13.5.5 [temp.constr.order]).
Date: 2023-11-15.00:00:00

[Accepted as a DR at the November, 2023 meeting.]

Consider:

  #include <type_traits>

  template<typename T>
  concept Int = std::is_same_v<T, int>;

  template<typename T>
  concept Float = std::is_same_v<T, float>;

  template<typename T>
  struct Foo {
    Foo() requires Int<T> = default; // #1
    Foo() requires Int<T> || Float<T> = default; // #2
  };

Per the wording, #1 is not eligible for Foo<float>, because the constraints are not satisfied. But #2 also is not eligible, because #1 is more constrained than #2. The intent is that #2 is eligible.

History
Date User Action Args
2024-04-05 21:43:46adminsetstatus: dr -> drwp
2023-12-19 10:15:28adminsetstatus: ready -> dr
2023-11-10 14:27:11adminsetstatus: tentatively ready -> ready
2023-06-20 19:34:52adminsetstatus: open -> tentatively ready
2022-06-08 15:45:43adminsetmessages: + msg6848
2022-06-08 00:00:00admincreate