<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head>
<title>requires-clause syntax ambiguities: wording to apply custom grammar</title>

<style type="text/css">/*<![CDATA[*/
body { color: #000000; background-color: #FFFFFF; max-width: 40em; }
del, .del { text-decoration: line-through; color: #8B0040; }
ins, .ins { text-decoration: underline; color: #005100; }

p.example { margin-left: 2em; }
pre.example { margin-left: 2em; }
div.example { margin-left: 2em; }

code.extract { background-color: #F5F6A2; }
pre.extract { margin-left: 2em; background-color: #F5F6A2;
  border: 1px solid #E1E28E; }

p.function { }
.attribute { margin-left: 2em; }
.attribute dt { float: left; font-style: italic;
  padding-right: 1ex; }
.attribute dd { margin-left: 0em; }

blockquote.std, ul.std { color: #000000; background-color: #F1F1F1;
  border: 1px solid #D1D1D1;
  padding-left: 0.5em; padding-right: 0.5em; }
blockquote.std del, blockquote.std .del, ul.std del, ul.std .del { text-decoration: line-through;
  color: #000000; background-color: #FFEBFF;
  border: 1px solid #ECD7EC; }
blockquote.std ins, blockquote.std .ins, ul.std ins, ul.std .ins { text-decoration: underline;
  color: #000000; background-color: #C8FFC8; }
blockquote.stddel { text-decoration: line-through;
  color: #000000; background-color: #FFEBFF;
  border: 1px solid #ECD7EC;
  padding-left: 0.5em; padding-right: 0.5em; }
blockquote.stdins { text-decoration: underline;
  color: #000000; background-color: #C8FFC8;
  border: 1px solid #B3EBB3;
  padding-left: 0.5em; padding-right: 0.5em; }

table { border: 1px solid black; border-spacing: 0px;
  margin-left: auto; margin-right: auto; }
th { text-align: left; vertical-align: top;
  padding-left: 0.8em; border: none; }
td { text-align: left; vertical-align: top;
  padding-left: 0.8em; border: none; }

table.table { border-spacing: 2px; border-collapse: separate; }
.table * th, .table * td { border: 1px solid black; }

table.frontmatter { border: 0; border-spacing: 0px; border-collapse: collapse; margin: 0; width: 619px; }
.frontmatter * td, .frontmatter * th { padding: 0px; }
.frontmatter * th { font-weight: inherit; text-align: left; vertical-align: top; }

ul.dash { list-style-type: none; }
ul.dash li:before { content: '\2014'; margin-left: -1em }

span.highlight { background-color: #7FDFFF }

.nowrap { white-space: nowrap; }
/*]]>*/
</style>

<script type="text/javascript" src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
</head>

<body>
<h1><i>requires-clause</i> syntax ambiguities: wording to apply custom grammar</h1>
<table class="frontmatter"><tbody>
    <tr>
        <th>Document number:</th>
        <td>P0730R1</td>
    </tr>
    <tr>
        <th>Date:</th>
        <td>2017-07-12</td>
    </tr>
    <tr>
        <th>Project:</th>
        <td>ISO/IEC JTC 1/SC 22/WG 21/C++</td>
    </tr>
    <tr>
        <th>Working Group:</th>
        <td>Core</td>
    </tr>
    <tr>
        <th>Revises:</th>
        <td>P0730R0</td>
    </tr>
    <tr>
        <th>Reply-to:</th>
        <td><span class="nowrap">Hubert S.K. Tong</span> &lt;<a href="mailto:hubert.reinterpretcast@gmail.com">hubert.reinterpretcast@gmail.com</a>&gt;</td>
    </tr>
</tbody></table>

<h2><a id="WhatsNew">What&#x2019;s New</a></h2>
<p>The previous revision of the paper, P0730R0, was discussed in EWG on Tuesday of the 2017 Toronto meeting of <span class="nowrap">WG 21</span>.
Direction was given to pursue the custom grammar solution with wording to present to Core.
This paper, P0730R1, is the wording paper.</p>

<h2>Background and Context for This Paper</h2>
<p>Prior to the discussion of P0730R0 in EWG, direction was given in response to P0716R0, which removes function concepts.
The wording presented herein is contingent upon adopting wording that implements the removal of function concepts.</p>

<h2>Wording</h2>
<p>The editing instructions within this document use, as its base wording, the result of applying the TS working draft (N4674) to an appropriate base document.</p>

<p>In Clause 17 [temp] paragraph 1, modify:</p>

<blockquote class="std">
<dl><dt><i>template-declaration</i>:</dt>
<dd><code>template</code> <code>&lt;</code> <i>template-parameter-list</i> <code>&gt;</code> <i>requires-clause</i><sub><i>opt</i></sub> <i>declaration</i><br
/><i>template-introduction</i> <i>declaration</i></dd></dl>

<dl class="del"><dt><i>requires-clause</i>:</dt>
<dd><code>requires</code> <i>constraint-expression</i></dd></dl>

<dl><dt><i>template-parameter-list</i>:</dt>
<dd><i>template-parameter</i><br
/><i>template-parameter-list</i> <code>,</code> <i>template-parameter</i></dd></dl>

<dl class="ins"><dt><i>requires-clause</i>:</dt>
<dd
><code>requires</code> <i>constraint-logical-or-expression</i></dd>
</dl>

<dl class="ins"><dt><i>constraint-logical-and-expression</i>:</dt>
<dd
><i>primary-expression</i><br
/><i>constraint-logical-and-expression</i> <code>&amp;&amp;</code> <i>primary-expression</i></dd>
</dl>

<dl class="ins"><dt><i>constraint-logical-or-expression</i>:</dt>
<dd
><i>constraint-logical-and-expression</i><br
/><i>constraint-logical-or-expression</i> <code>||</code> <i>constraint-logical-and-expression</i></dd>
</dl></blockquote>

<p>At the beginning of subclause 8.1.7.4 [expr.prim.req.nested], modify:</p>

<blockquote class="std"><dl><dt><i>nested-requirement</i>:</dt>
<dd><del><i>requires-clause</i></del><ins><code>requires</code> <i>constraint-expression</i></ins> <code>;</code></dd></dl></blockquote>

<p>In subclause 17.10.2 [temp.constr.decl] paragraph 2, modify bullet 2.3.5:</p>
<blockquote class="std"><ul>
<li>the <i>constraint-expression</i> <del>of</del><ins>introduced by</ins> a trailing <i>requires-clause</i> of a function declaration.</li>
</ul></blockquote>

<p>In subclause 17.10.1.2 [temp.constr.pred] paragraph 1, modify the note:</p>
<blockquote class="std"><p><span class="nowrap">[ &#x2026; ]</span> <span class="nowrap">[ <i>Note:</i></span>
A predicate constraint is introduced by <del>the <i>constraint-expression</i>
of </del>a <i>requires-clause</i> (17.10.2), or as the associated constraint of a <i>constrained-parameter</i>
(17.1) or <i>template-introduction</i> (17.2). <span class="nowrap"><i>&#x2014;end note</i> ]</span> <span class="nowrap">[ &#x2026; ]</span></p></blockquote>

<p>In Clause 17 [temp] paragraph 7, modify:</p>
<blockquote class="std"><p>A <i>template-declaration</i> is written in terms of its template parameters.
These parameters are declared explicitly in a <i>template-parameter-list</i> (17.1),
or they are introduced by a <i>template-introduction</i> (17.2).
The optional <i>requires-clause</i> following a <i>template-parameter-list</i> allows the specification of constraints (17.10.2) on template arguments (17.4).
<ins>The <i>requires-clause</i> introduces the <i>constraint-expression</i> that results from interpreting the
<i>constraint-logical-or-expression</i> as a <i>constraint-expression</i>.</ins>
</p>
</blockquote>

<h2><a id="Acknowledgments">Acknowledgements</a></h2>
<p>The author would like to thank Ville Voutilainen and Richard Smith for their input in discussions leading up to the production of P0730R0.
As usual, any mistakes are the responsibility of the author.</p>

</body>
</html>
