<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3116: OUTERMOST_ALLOC_TRAITS needs remove_reference_t</title>
<meta property="og:title" content="Issue 3116: OUTERMOST_ALLOC_TRAITS needs remove_reference_t">
<meta property="og:description" content="C++ library issue. Status: C++20">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3116.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#C++20">C++20</a> status.</em></p>
<h3 id="3116"><a href="lwg-defects.html#3116">3116</a>. <code><i>OUTERMOST_ALLOC_TRAITS</i></code> needs <code>remove_reference_t</code></h3>
<p><b>Section:</b> 20.6.4 <a href="https://wg21.link/allocator.adaptor.members">[allocator.adaptor.members]</a> <b>Status:</b> <a href="lwg-active.html#C++20">C++20</a>
 <b>Submitter:</b> Tim Song <b>Opened:</b> 2018-06-04 <b>Last modified:</b> 2021-02-25</p>
<p><b>Priority: </b>0
</p>
<p><b>View all other</b> <a href="lwg-index.html#allocator.adaptor.members">issues</a> in [allocator.adaptor.members].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++20">C++20</a> status.</p>
<p><b>Discussion:</b></p>
<p>
<code><i>OUTERMOST_ALLOC_TRAITS</i>(x)</code> is currently defined in 20.6.4 <a href="https://wg21.link/allocator.adaptor.members">[allocator.adaptor.members]</a>p1 as 
<code>allocator_traits&lt;decltype(<i>OUTERMOST</i>(x))&gt;</code>. However, <code><i>OUTERMOST</i>(x)</code>, as defined and used
in this subclause, is an lvalue for which <code>decltype</code> produces an lvalue reference. That referenceness needs to be 
removed before the type can be used with <code>allocator_traits</code>.
<p/>
While we are here, the current wording for <code><i>OUTERMOST</i></code> uses the imprecise "if <code>x</code> does not have an 
<code>outer_allocator()</code> member function". What we meant to check is the validity of the expression <code>x.outer_allocator()</code>,
not whether <code>x</code> has some (possibly ambiguous and/or inaccessible) member function named <code>outer_allocator</code>.
</p>

<p><i>[2018-06 Rapperswil Thursday issues processing]</i></p>

<p>Status to Ready</p>
<p><i>[2018-11, Adopted in San Diego]</i></p>



<p id="res-3116"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4750">N4750</a>.</p>
<blockquote class="note">
<p>
[<i>Drafting note:</i> The subclause only uses <code><i>OUTERMOST_ALLOC_TRAITS</i>(*this)</code> and only in non-<code>const</code>
member functions, so the result is also non-<code>const</code>. Thus, <code>remove_reference_t</code> is sufficient; there's no need
to further remove cv-qualification. &mdash; <i>end drafting note</i>]
</p>
</blockquote>
<ol>
<li><p>Modify 20.6.4 <a href="https://wg21.link/allocator.adaptor.members">[allocator.adaptor.members]</a>p1 as indicated:</p>
<blockquote>
<p>
-1- In the <code>construct</code> member functions, <code><i>OUTERMOST</i>(x)</code> is <del><code>x</code> if <code>x</code> does not have an 
<code>outer_allocator()</code> member function and </del><code><i>OUTERMOST</i>(x.outer_allocator())</code><ins> if the expression
<code>x.outer_allocator()</code> is valid (13.10.3 <a href="https://wg21.link/temp.deduct">[temp.deduct]</a>) and <code>x</code></ins> otherwise; 
<code><i>OUTERMOST_ALLOC_TRAITS</i>(x)</code> is <code>allocator_traits&lt;<ins>remove_reference_t&lt;</ins>decltype(<i>OUTERMOST</i>(x))<ins>&gt;</ins>&gt;</code>.
[<i>Note:</i> [&hellip;] &mdash; <i>end note</i>]
</p>
</blockquote>
</li>

</ol>





</body>
</html>
