<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Accepts-invalid for requires-clauses on non-templated function"
href="https://bugs.llvm.org/show_bug.cgi?id=48870">48870</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Accepts-invalid for requires-clauses on non-templated function
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davveston@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>As per [dcl.decl]/4 in N4861, a requires-clause shall be present only if the
declarator declares a templated function.
However, clang accepts the follow program:
void f() requires true { }
int main() { f(); }
and we may moreover note that constraint checking is actually enforced, as the
following program is rejected (for the wrong reasons) due to overload
resolution failure
void f() requires false { }
int main() { f(); } // // error: no matching function for call to 'f'
whereas the constraints have not been added to the function's signature (which
is correct, as per [defns.signature]):
void f() requires true { }
void f() requires false { }
// ^ error: definition with same mangled name '...' as another definition
---
(It may be that the implementation was base on [dcl.decl]/4 from the earlier
draft of N4810, which had a weaker requirement: allowing requires-clauses on
declarators that were functions).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>