<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3016: optional and over-aligned types</title>
<meta property="og:title" content="Issue 3016: optional and over-aligned types">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3016.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#NAD">NAD</a> status.</em></p>
<h3 id="3016"><a href="lwg-closed.html#3016">3016</a>. <code>optional</code> and over-aligned types</h3>
<p><b>Section:</b> 22.5.3 <a href="https://wg21.link/optional.optional">[optional.optional]</a> <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> Tim Song <b>Opened:</b> 2017-09-04 <b>Last modified:</b> 2020-09-06</p>
<p><b>Priority: </b>3
</p>
<p><b>View all other</b> <a href="lwg-index.html#optional.optional">issues</a> in [optional.optional].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p>
LWG issue <a href="lwg-defects.html#2555" title="[fund.ts.v2] No handling for over-aligned types in optional (Status: TS)">2555</a><sup><a href="https://cplusplus.github.io/LWG/issue2555" title="Latest snapshot">(i)</a></sup> added "It is implementation-defined whether over-aligned types are supported (C++14 &sect;3.11)."
to the specification of <code>std::experimental::optional</code> in LFTS, however that issue wasn't moved until <code>optional</code> had 
already been merged to the IS working paper, so it isn't present in the specification of <code>std::optional</code>. Should the 
same rule be added for <code>std::optional</code> as well?
</p>

<p><i>[2017-11 Albuquerque Wednesday night issues processing]</i></p>

<p>Priority set to 3; Casey to provide rationale for closing as NAD.</p>

<p>2018-11 Closed as NAD with the adoption of <a href="https://wg21.link/P0899R1">P0899R1</a></p>


<p id="res-3016"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4687">N4687</a>.</p>

<ol>
<li><p>Edit 22.5.3 <a href="https://wg21.link/optional.optional">[optional.optional]</a> p1 as indicated:</p>
<blockquote>
<p>
[&hellip;] The contained value shall be allocated in a region of the <code>optional&lt;T&gt;</code> storage suitably aligned 
for the type <code>T</code>. <ins>It is implementation-defined whether over-aligned types are supported 
(6.8.3 <a href="https://wg21.link/basic.align">[basic.align]</a>).</ins> When an object of type <code>optional&lt;T&gt;</code> is contextually converted to 
<code>bool</code>, the conversion returns <code>true</code> if the object contains a value; otherwise the conversion returns 
<code>false</code>.
</p>
</blockquote>
</li>
</ol>





</body>
</html>
