<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:ldionne.2@gmail.com" title="Louis Dionne <ldionne.2@gmail.com>"> <span class="fn">Louis Dionne</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED " title="REOPENED --- - Error in std::pair default constructor when elements are not default-constructible" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D21917&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=UUaRD_GJPvB_wAXY1JGjdUHduBXdWV93AGFBcTsfqcA&s=qIf5iF012Gzpq1yHCdboAzdRFhIA7HG3D7FBCXk4Tvc&e=">bug 21917</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>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>ldionne.2@gmail.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>WORKSFORME
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED " title="REOPENED --- - Error in std::pair default constructor when elements are not default-constructible" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D21917-23c2&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=UUaRD_GJPvB_wAXY1JGjdUHduBXdWV93AGFBcTsfqcA&s=3B0fQizxBLAV-8NjDeWXdigdXW_Iwnhp5i-CLkbI8Ac&e=">Comment # 2</a>
on <a class="bz_bug_link
bz_status_REOPENED " title="REOPENED --- - Error in std::pair default constructor when elements are not default-constructible" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D21917&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=UUaRD_GJPvB_wAXY1JGjdUHduBXdWV93AGFBcTsfqcA&s=qIf5iF012Gzpq1yHCdboAzdRFhIA7HG3D7FBCXk4Tvc&e=">bug 21917</a>
from <span class="vcard"><a class="email" href="mailto:ldionne.2@gmail.com" title="Louis Dionne <ldionne.2@gmail.com>"> <span class="fn">Louis Dionne</span></a>
</span></b>
<pre>The following code triggers a hard error:
-----------------------------------------------------
#include <utility>
struct NoDefault { NoDefault() = delete; };
template <typename T, typename = decltype(std::pair<T, T>{})>
void f(int) { }
template <typename T>
void f(long) { }
int main() {
f<NoDefault>(1);
}
-----------------------------------------------------
Instead, one would expect that the first `f` SFINAEs out because
`std::pair<NoDefault, NoDefault>` is not default constructible.
Instead, `std::pair` always provide a default-constructor, but it
is ill-formed when `T` is not default constructible.
This causes code like
std::is_default_constructible<std::pair<NoDefault, NoDefault>>::value
to trigger a hard error instead of returning `false`.
Live example: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__melpon.org_wandbox_permlink_A0d3lFEeEXEs0BzT&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=UUaRD_GJPvB_wAXY1JGjdUHduBXdWV93AGFBcTsfqcA&s=lzECLgkhWvTsBW-Oa2PACA1SrXSZY57fX7kOgA7D7_M&e=">http://melpon.org/wandbox/permlink/A0d3lFEeEXEs0BzT</a></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>