<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - Cannot derive from std::function"
href="http://llvm.org/bugs/show_bug.cgi?id=20002">20002</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Cannot derive from std::function
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david_work@me.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>#include <functional>
struct s : std::function< void() > {
using function::function;
};
s q( std::function< void() >( []{} ) );
Nothing says std::function can't or shouldn't be used as a base class. However,
this simple test yields an error,
c++/v1/functional:1454:41: error: no type named 'type' in
'std::__1::enable_if<false, void>'; 'enable_if' cannot be used to disable this
declaration
I'm not sure why SFINAE isn't allowed in that context, but it might be because
of the phrasing of 12.9/1.2:
— for each non-template constructor of X that has at least one parameter with a
default argument, the set of constructors that results from omitting any
ellipsis parameter specification and successively omitting parameters with a
default argument from the end of the parameter-type-list
Omitting the default argument strips SFINAE from the constructor. The fix is to
move the SFINAE condition to the exception specification.</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>