|
| 1 | +<?xml version='1.0' encoding='utf-8' standalone='no'?> |
| 2 | +<!DOCTYPE issue SYSTEM "lwg-issue.dtd"> |
| 3 | + |
| 4 | +<issue num="4425" status="New"> |
| 5 | +<title>CTAD <tt>function_ref</tt> of data member pointer should produce <tt>noexcept</tt> signature</title> |
| 6 | +<section><sref ref="[func.wrap.ref.deduct]"/></section> |
| 7 | +<submitter>Tomasz Kamiński</submitter> |
| 8 | +<date>20 Oct 2025</date> |
| 9 | +<priority>99</priority> |
| 10 | + |
| 11 | +<discussion> |
| 12 | +<b>Addresses PL-005.</b> |
| 13 | + |
| 14 | +<p> |
| 15 | +For data member pointer <tt>M C::* dmp</tt>, template argument deduction in form |
| 16 | +<tt>std::function_ref fr(std::nontype<dmp>, x)</tt> results in |
| 17 | +<tt>std::function_ref<M&()></tt>, that returns a reference to designated |
| 18 | +member. As accessing a data member can never throw exception and <tt>function_ref</tt> |
| 19 | +support <tt>noexcept</tt> qualifed function types, the deduction guide should be |
| 20 | +updated to produce <tt>noexcept</tt>-qualified signature.</p> |
| 21 | + |
| 22 | +</discussion> |
| 23 | + |
| 24 | +<resolution> |
| 25 | +<p> |
| 26 | +This wording is relative to <paper num="N5014"/>. |
| 27 | +</p> |
| 28 | +<ol> |
| 29 | + |
| 30 | +<li><p>Modify <sref ref="[func.wrap.ref.deduct]"/> as indicated:</p> |
| 31 | + |
| 32 | +<blockquote> |
| 33 | +<pre> |
| 34 | +template<class F> |
| 35 | +function_ref(nontype_t<f>, T&&) -> function_ref<<i>see below</i>>; |
| 36 | +</pre> |
| 37 | +<blockquote> |
| 38 | +<p>Let <tt>F</tt> be <tt>decltype(f)</tt>.</p> |
| 39 | + |
| 40 | +<p> |
| 41 | +-6- <i>Constraint</i>: |
| 42 | +<ol style="list-style-type:none"> |
| 43 | +<li>(6.1) — <tt>F</tt> is of the form |
| 44 | + <tt>R(G::*)(A...) <it>cv</it> &<sub>opt</sub> noexcept(E)</tt> for type <tt>G</tt>, or</li> |
| 45 | +<li>(6.2) — <tt>F</tt> is of the form <tt>M G::*</tt> for type <tt>G</tt> and |
| 46 | + object type <tt>M</tt>, in which case let <tt>R</tt> be <tt>invoke_result_t<F, T&></tt>, |
| 47 | + <tt>A...</tt> be an empty pack, and <tt>E</tt> be <del><tt>false</tt></del> |
| 48 | + <ins><tt>true</tt></ins>, or</li> |
| 49 | +<li>(6.3) — <tt>F</tt> is of the form |
| 50 | + <tt>R(*)(G, A...) noexcept(E)</tt> for type <tt>G</tt>.</li> |
| 51 | +</ol> |
| 52 | +</p> |
| 53 | + |
| 54 | +<p> |
| 55 | +-7- <i>Remarks</i>: The deduced type is <tt>function_ref<R(A...) noexcept(E)></tt>. |
| 56 | +</p> |
| 57 | + |
| 58 | +</blockquote> |
| 59 | +</blockquote> |
| 60 | + |
| 61 | +</li> |
| 62 | +</ol> |
| 63 | + |
| 64 | + |
| 65 | +</resolution> |
| 66 | + |
| 67 | +</issue> |
0 commit comments