<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3513: Fix definition of program-defined based on its uses</title>
<meta property="og:title" content="Issue 3513: Fix definition of program-defined based on its uses">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3513.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#New">New</a> status.</em></p>
<h3 id="3513"><a href="lwg-active.html#3513">3513</a>. Fix definition of program-defined based on its uses</h3>
<p><b>Section:</b> 3.43 <a href="https://wg21.link/defns.prog.def.type">[defns.prog.def.type]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Johel Ernesto Guerrero Pe&ntilde;a <b>Opened:</b> 2020-12-29 <b>Last modified:</b> 2021-01-30</p>
<p><b>Priority: </b>3
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Consider the following definitions:
</p>
<blockquote><p>
<b>3.42 [defns.prog.def.spec]</b><br/> 
<b>program-defined specialization</b><br/>
&lt;library&gt; explicit template specialization or partial specialization that is not part 
of the C++ standard library and not defined by the implementation
</p></blockquote>
<p>
and
</p>
<blockquote><p>
<b>3.43 [defns.prog.def.type]</b><br/>
<b>program-defined type</b><br/>
&lt;library&gt; non-closure class type or enumeration type that is not part of the C++ standard library 
and not defined by the implementation, or a closure type of a non-implementation-provided lambda expression, 
or an instantiation of a program-defined specialization
[<i>Note 1 to entry:</i> Types defined by the implementation include extensions (4.1) and internal types 
used by the library. &mdash; <i>end note</i>]
</p></blockquote>
<p>
A program-defined type is either a type or an instantiation. "program-defined type" is used in 
16.4.5.2.1 <a href="https://wg21.link/namespace.std">[namespace.std]</a> p2 to give permission to specialize standard class templates:
</p>
<blockquote><p>
Unless explicitly prohibited, a program may add a template specialization for any standard library class
template to namespace <code>std</code> provided that (a) the added declaration depends on at least one 
program-defined type and (b) the specialization meets the standard library requirements for the original 
template.
</p></blockquote>
<p>
ISO requires that the terms in Clause 3 be substitutable with their definitions. If this were done for 
"program-defined type", we'd end up with "or an instantiation of a program-defined specialization".
It's fine to depend on a type, but not an instantiated type, because all you need is the name of its 
specialization (its type) as a template argument to explicitly or partially specialize a template.
</p>

<p><i>[2021-01-29; reflector prioritization]</i></p>

Set priority to 3 following reflector discussions.
It was pointed out that it might be easier to resolve <a href="lwg-active.html#3512" title="Incorrect exception safety guarantee for unordered containers (Status: New)">3512</a><sup><a href="https://cplusplus.github.io/LWG/issue3512" title="Latest snapshot">(i)</a></sup>
if this issue changes the definition of program-defined type.



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

<ol>
<li><p>Modify 3.43 <a href="https://wg21.link/defns.prog.def.type">[defns.prog.def.type]</a> as indicated:</p>

<blockquote>
<b>3.43 [defns.prog.def.type]</b><br/>
<b>program-defined type</b><br/>
&lt;library&gt; non-closure class type or enumeration type that is not part of the C++ standard library 
and not defined by the implementation, or a closure type of a non-implementation-provided lambda expression, 
or <del>an instantiation</del><ins>a name</ins> of a program-defined specialization <ins>or instantiation 
thereof</ins>
[<i>Note 1 to entry:</i> Types defined by the implementation include extensions (4.1 <a href="https://wg21.link/intro.compliance">[intro.compliance]</a>) 
and internal types used by the library. &mdash; <i>end note</i>]
</blockquote>
</li>
</ol>





</body>
</html>
