<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 1114: Type traits underspecified</title>
<meta property="og:title" content="Issue 1114: Type traits underspecified">
<meta property="og:description" content="C++ library issue. Status: C++11">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue1114.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++11">C++11</a> status.</em></p>
<h3 id="1114"><a href="lwg-defects.html#1114">1114</a>. Type traits underspecified</h3>
<p><b>Section:</b> 21 <a href="https://wg21.link/meta">[meta]</a> <b>Status:</b> <a href="lwg-active.html#C++11">C++11</a>
 <b>Submitter:</b> Daniel Kr&uuml;gler <b>Opened:</b> 2009-05-12 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View other</b> <a href="lwg-index-open.html#meta">active issues</a> in [meta].</p>
<p><b>View all other</b> <a href="lwg-index.html#meta">issues</a> in [meta].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++11">C++11</a> status.</p>
<p><b>Discussion:</b></p>

<p>
Related to <a href="lwg-defects.html#975" title="is_convertible cannot be instantiated for non-convertible types (Status: C++11)">975</a><sup><a href="https://cplusplus.github.io/LWG/issue975" title="Latest snapshot">(i)</a></sup> and <a href="lwg-closed.html#1023" title="Unclear inheritance relation for std::function (Status: NAD Editorial)">1023</a><sup><a href="https://cplusplus.github.io/LWG/issue1023" title="Latest snapshot">(i)</a></sup>.
</p>

<p>
The current wording in 21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a> is still unclear concerning
it's requirements on the type traits classes regarding ambiguities.
Specifically it's unclear
</p>

<ul>
<li>
if a predicate trait (21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a>, 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a>) could derive from both
<code>true_type</code>&#47;<code>false_type</code>.
</li>
<li>
if any of the type traits (21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a>, 21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a>, 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a>) could ambiguously derive
from the same specified result type.
</li>
<li>
if any of the type traits (21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a>, 21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a>, 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a>) could derive from other
<code>integral_constant</code> types making the contained names ambiguous
</li>
<li>
if any of the type traits (21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a>, 21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a>, 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a>) could have other base
classes that contain members hiding the name of the result type members
or make the contained member names ambiguous.
</li>
</ul>

<p><i>[
Batavia (2009-05):
]</i></p>

<blockquote>
<p>
Alisdair would prefer to factor some of the repeated text,
but modulo a corner case or two,
he believes the proposed wording is otherwise substantially correct.
</p>
<p>
Move to Open.
</p>
</blockquote>

<p><i>[
2009-10 post-Santa Cruz:
]</i></p>


<blockquote><p>
Move to Tentatively Ready.
</p></blockquote>



<p id="res-1114"><b>Proposed resolution:</b></p>
<p><i>[
The usage of the notion of a <i>BaseCharacteristic</i> below might be
useful in other places - e.g. to define the base class relation in 22.10.6 <a href="https://wg21.link/refwrap">[refwrap]</a>, 22.10.16 <a href="https://wg21.link/func.memfn">[func.memfn]</a>, or 22.10.17.3 <a href="https://wg21.link/func.wrap.func">[func.wrap.func]</a>. In this case it's definition should probably
be moved to Clause 17
]</i></p>


<ol>
<li>
<p>
Change 21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a> p.1 as indicated:
</p>
<blockquote><p>
[..] It shall be <code>DefaultConstructible</code>, <code>CopyConstructible</code>, and publicly
<ins>and unambiguously</ins> derived, directly or indirectly, from
<ins>its <i>BaseCharacteristic</i>, which is</ins> a specialization of the
template <code>integral_constant</code> (20.6.3), with the arguments to the template
<code>integral_constant</code> determined by the requirements for the particular
property being described. <ins>The member names of the
<i>BaseCharacteristic</i> shall be unhidden and unambiguously
available in the <i>UnaryTypeTrait</i>.</ins>
</p></blockquote>
</li>
<li>
<p>
Change 21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a> p.2 as indicated:
</p>
<blockquote><p>
[..] It shall be <code>DefaultConstructible</code>, <code>CopyConstructible</code>, and publicly
<ins>and unambiguously</ins> derived, directly or indirectly, from
<del>an instance</del> <ins>its <i>BaseCharacteristic</i>, which is a
specialization</ins> of the template <code>integral_constant</code> (20.6.3), with
the arguments to the template <code>integral_constant</code> determined by the
requirements for the particular relationship being described. <ins>The
member names of the <i>BaseCharacteristic</i> shall be unhidden
and unambiguously available in the <i>BinaryTypeTrait</i>.</ins>
</p></blockquote>
</li>
<li>
<p>
Change 21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a> p.2 as indicated:
</p>
<blockquote><p>
Each of these templates shall be a <i>UnaryTypeTrait</i> (20.6.1),
<del>publicly derived directly or indirectly from <code>true_type</code> if the
corresponding condition is true, otherwise from <code>false_type</code></del>
<ins>where its <i>BaseCharacteristic</i> shall be <code>true_type</code> if the
corresponding condition is true, otherwise <code>false_type</code></ins>.
</p></blockquote>
</li>
<li>
<p>
Change 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a> p.2 as indicated:
</p>

<blockquote><p>
Each of these templates shall be a <i>BinaryTypeTrait</i> (20.6.1),
<del>publicly derived directly or indirectly from <code>true_type</code> if the
corresponding condition is true, otherwise from <code>false_type</code></del>
<ins>where its <i>BaseCharacteristic</i> shall be <code>true_type</code> if the
corresponding condition is true, otherwise <code>false_type</code></ins>.
</p></blockquote>
</li>
</ol>






</body>
</html>
