Created on 2025-05-14.00:00:00 last changed 1 month ago
Proposed resolution:
This wording is relative to N5008.
Modify [func.wrap.ref.ctor] as indicated:
template<auto f> constexpr function_ref(nontype_t<f>) noexcept;-8- Let F be decltype(f).
-9- Constraints: is-invocable-using<const F&> is true.
[…]template<auto f, class U> constexpr function_ref(nontype_t<f>, U&& obj) noexcept;-12- Let T be remove_reference_t<U> and F be decltype(f).
-13- Constraints::
[…]
(13.1) — is_rvalue_reference_v<U&&> is false, and
(13.2) — is-invocable-using<const F&, T cv&> is true.
template<auto f, class T> constexpr function_ref(nontype_t<f>, T cv* obj) noexcept;-17- Let F be decltype(f).
-16- Constraints: is-invocable-using<const F&, T cv*> is true.
[…]
[ Kona 2025-11-08; Status changed: Voting → WP. ]
[ 2025-10-21; Reflector poll. ]
Set status to Tentatively Ready after six votes in favour during reflector poll.
For the following class:
struct M
{
void operator()();
};
The constructor of function_ref<void()> from nontype_t
is considered to be valid candidate
(is_constructible_v<function_ref<void()>, nontype_t<M{}>>
is true), despite the fact that the corresponding invocation of template
argument object, that is const lvalue, is ill-formed. As consequence we produce a hard
error from inside of this constructor.
This is caused by the fact that for constructors with non-type auto f parameter,
we are checking if is-invocable-using<F> is true,
where F is decltype(f) i.e. M for the example.
We should use const F& or decltype((f)).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-11 10:48:16 | admin | set | messages: + msg15619 |
| 2025-11-11 10:48:16 | admin | set | status: voting -> wp |
| 2025-10-30 17:45:31 | admin | set | status: ready -> voting |
| 2025-10-21 16:45:52 | admin | set | messages: + msg15335 |
| 2025-10-21 16:45:52 | admin | set | status: new -> ready |
| 2025-05-14 10:07:01 | admin | set | messages: + msg14750 |
| 2025-05-14 00:00:00 | admin | create | |