<html>
<head>
<title>P1353R0: Missing Feature Test Macros</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .new { text-decoration:none; font-weight:bold; background-color:#D0FFD0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }  
  strong { font-weight: inherit; color: #2020ff }
  table, td, th { border: 1px solid black; border-collapse:collapse; padding: 5px }
</style>
</head>

<body>
P1353R0<br/>
John Spicer &lt;jhs@edg.com><br/>
Audience: CWG, LWG<br/>
2017-11-09<br/>

<h1>P1353R0: Missing Feature Test Macros</h1>

<h2>Introduction</h2>

<p>
This paper adds some feature test macros for recent working paper changes
for which feature test macros were not included.
<p>
SG10 believes there are other missing macros and we will be doing a review
of the C++20 papers to check for other cases, but there is interest in
defining these now for implementors and users that need them.
<p>
In some cases a feature requires two macros, one for the language and
one for the library.  For example, the library does not want to define its
three-way comparison operations unless the compiler supports the feature.
<p>
For end-users, it is suggested that they test only the library macro, as that
will only be true if the language macro is also true.  As a result, the
language macros contain "impl" to distinguish them from the more general
version that is expected to be set by the library.
<p>
Note that originally SG10 suggested that the library version of the macro
not include the usual <tt>_lib</tt> part, but LWG was not comfortable with the
inconsistency of having a library macro (which requires a header before
it can be used) that does not contain <tt>_lib</tt>.
<p>
Also note that SG10 originally proposed that the core feature tests include
<tt>_lang</tt>, but LWG wanted something that more clearly implied that
the the macro was for a core feature and not intended to be used by
end-users.  They sugggested that <tt>_impl</tt> be used instead.

<h2>Contracts</h2>

<p>
SG10 discussed whether to provide a feature test macro for contracts.
The recommendation is that <tt>__has_cpp_attribute</tt> should be used
instead.


<h2>Wording changes</h2>

<p>
Modify table 16 in [cpp.predefined] with the macro names and values from
the table below.  The "Paper" and "Notes" columns are only for explanatory
purposes as part of this document.

<p>

<table>
<tr>
  <th>Macro Name</th>
  <th>Value</th>
  <th>Paper</th>
  <th>Notes</th>
</tr>
<tr>
  <td><ins><tt>__cpp_impl_destroying_delete</tt></ins></td>
  <td><ins><tt>201806L</tt></ins></td>
  <td>P0722R3</td>
  <td>
      This macro is intended to be set by the compiler and used by the
      library to determine whether the library feature can be provided.
  </td>
</tr>
<tr>
  <td><ins><tt>__cpp_impl_three_way_comparison</tt></ins></td>
  <td><ins><tt>201711L</tt></ins></td>
  <td>P0515R3</td>
  <td>
      This macro is intended to be set by the compiler and used by the
      library to determine whether the library feature can be provided.
  </td>
</tr>
<tr>
  <td><del><tt>__cpp_explicit_bool</del><ins>__cpp_conditional_explicit</ins></tt></td>
  <td><tt>201806L</tt></td>
  <td>P0892R2</td>
  <td>Rename the previously added macro</td>
</tr>
</table>

<p>
Modify table 35 in [support.limits.general] with the macro names, values,
and header(s) from the table below.  The "Paper" and "Notes" columns are
only for explanatory purposes as part of this document.

<p>

<table>
<tr>
  <th>Macro Name</th>
  <th>Value</th>
  <th>Header(s)</th>
  <th>Paper</th>
  <th>Notes</th>
</tr>
<tr>
  <td><ins><tt>__cpp_lib_destroying_delete</tt><ins></td>
  <td><ins><tt>201806L</tt></ins></td>
  <td><ins><tt>&lt;new></tt></ins></td>
  <td>P0722R3</td>
  <td>This macro is intended to be checked by end-users</td>
</tr>
<tr>
  <td><ins><tt>__cpp_lib_three_way_comparison</tt></ins></td>
  <td><ins><tt>201711L</tt></ins></td>
  <td><ins><tt>&lt;compare></tt></ins></td>
  <td>P0768R1</td>
  <td>This macro is intended to be checked by end-users</td>
</tr>
</table>

</body>
</html>

