diff --git a/xml/issue3979.xml b/xml/issue3979.xml new file mode 100644 index 0000000000..37fb6cc731 --- /dev/null +++ b/xml/issue3979.xml @@ -0,0 +1,81 @@ + + + + +Should we reject <tt>std::bind_front<42>()</tt> and its friends? +
+Jiang An +22 Aug 2023 +99 + + +

+std::bind_front<42>() seems to be currently well-formed, but the result isn't invocable with any arguments. +Given we are already detecting types and values of the NTTP for new overloads of std::bind_front, +std::bind_back, and std::not_fn, it might be better to diagnose such cases when NTTP is of a scalar type. +

+Note that we might need to separately handle NTTP of scalar and class types for these functions when +CWG2459 is not resolved, because it might be necessary to avoid copying a +template parameter object. +

+
+ + +

+This wording is relative to . +

+ +
    + +
  1. Modify the as indicated:

    + +
    +
    +template<auto f> constexpr unspecified not_fn() noexcept;
    +
    +
    +

    +-6- […] +

    +-7- Mandates: If is_pointer_v<F> || is_member_pointer_v<F> is true, then +f != nullptr is trueis_scalar_v<F> is true, then either +is_pointer_v<F> && is_function_v<remove_pointer_t<F>> is true or +is_member_pointer_v<F> is true, and f != nullptr is true in either case. +

    +
    +
    + +
  2. + +
  3. Modify the as indicated:

    + +
    +
    +template<auto f, class... Args>
    +  constexpr unspecified bind_front(Args&&... args);
    +template<auto f, class... Args>
    +  constexpr unspecified bind_back(Args&&... args);
    +
    +
    +

    +-6- […] +

    +-7- Mandates: +

    +
      +
    1. (7.1) — […]

    2. +
    3. (7.2) — […]

    4. +
    5. (7.3) — if is_pointer_v<F> || is_member_pointer_v<F> is true, then +f != nullptr is trueis_scalar_v<F> is true, then either +is_pointer_v<F> && is_function_v<remove_pointer_t<F>> is true or +is_member_pointer_v<F> is true, and f != nullptr is true in either case.

    6. +
    +
    +
    + +
  4. + +
+
+ +