<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3167: [fund.ts.v3] Does observer_ptr support function types?</title>
<meta property="og:title" content="Issue 3167: [fund.ts.v3] Does observer_ptr support function types?">
<meta property="og:description" content="C++ library issue. Status: Open">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3167.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#Open">Open</a> status.</em></p>
<h3 id="3167"><a href="lwg-active.html#3167">3167</a>. [fund.ts.v3] Does <code>observer_ptr</code> support function types?</h3>
<p><b>Section:</b> 8.2 <a href="https://cplusplus.github.io/fundamentals-ts/v3.html#memory.observer.ptr">[fund.ts.v3::memory.observer.ptr]</a> <b>Status:</b> <a href="lwg-active.html#Open">Open</a>
 <b>Submitter:</b> Alisdair Meredith <b>Opened:</b> 2018-11-14 <b>Last modified:</b> 2022-10-12</p>
<p><b>Priority: </b>3
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Open">Open</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: fund.ts.v3</b></p>
<p>
From the wording, function pointers are never clearly considered. P1 infers
support for only objects, but it is not clear that wording is intended to be a
deliberate restriction, or is casual wording.
<p/>
Paragraph 2 mandates that we cannot instantiate for reference types, and do
support incomplete types, but still does not consider function types. Calling
out references specifically, as they are not object types, suggests the inferred
support for only objects in p1 is more a case of casual phrasing, than deliberate
intent.
<p/>
However, if we did intend to support function pointers, we may want to consider
adding a function-call operator, constrained to supporting pointer-to function types.
One other possibility is that the explicit conversion to <code>pointer</code> already serves that
purpose, although I need to double-check the core language that contextual
conversions to function pointer are considered when invoking the function call
operator.  If this <em>is</em> the case, then I suggest a note to that effect in
[memory.observer.ptr.conv] instead.
</p>

<p><i>[2018-11 Reflector prioritization]</i></p>

<p>Set Priority to 3</p>

<p><i>[2022-10-12 LWG telecon]</i></p>

<p>
Discussed on reflector in July 2022, no consensus on how <code>observer_ptr</code>
is even meant to be used.
</p>

<p>
<code>shared_ptr</code> supports function types, no good reason to disallow them here.
</p>

<p>
No desire to make any change for LFTSv3, but keep the issue open until/unless
the TS is withdrawn. That way we will be less likely to forget about this if
<code>observer_ptr</code> is propsed for the IS.
</p>



<p id="res-3167"><b>Proposed resolution:</b></p>





</body>
</html>
