<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Template deduction fails when deduction partially disabled"
href="https://bugs.llvm.org/show_bug.cgi?id=46551">bug 46551</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Template deduction fails when deduction partially disabled"
href="https://bugs.llvm.org/show_bug.cgi?id=46551#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Template deduction fails when deduction partially disabled"
href="https://bugs.llvm.org/show_bug.cgi?id=46551">bug 46551</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>Per [temp.deduct.call]p4 and [temp.deduct.type]p1 in the C++ standard, template
argument deduction is expected to pick template arguments that make the
argument type A be the same as the "deduced A" type formed by substituting in
the deduced template argument types, for each P/A pair that participates in
deduction.
In this case, that doesn't happen. We deduce T = int and N = -1, but then (as
Clang's diagnostic says) we find that the first argument type is Span<int> but
the deduced parameter type is Span<const int>, which doesn't match. So
deduction fails.
This is a bit of an unusual case: if the first parameter were instead
"std::type_identity_t<Span<const T>>" (and the N parameter were removed), then
deduction would succeed, because the first parameter would not participate in
deduction. This special check only really matters in cases where a parameter
*partially* participates in deduction.
The fact that GCC accepts this appears to be a divergence from the standard's
rules (though I don't know if it's intentional or an oversight on their part);
they presumably don't implement the post-deduction check in question.</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>