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

Created on 2022-06-08.00:00:00 last changed 2 weeks ago

Messages

Date: 2022-06-08.15:45:43

Suggested resolution:

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: 2022-06-08.00:00:00

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
2022-06-08 15:45:43adminsetmessages: + msg6848
2022-06-08 00:00:00admincreate