<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 --- - Move template parameter defaults to forward declarations"
href="http://llvm.org/bugs/show_bug.cgi?id=22605">22605</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Move template parameter defaults to forward declarations
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>eniebler@boost.org
</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>There are lots of places in libc++ where a class template is forward declared
without defaults for template parameters, only to have the defaults specified
later on the definition. An example is in <list> which first has this:
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY list;
to be followed later with this:
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY list
: private __list_imp<_Tp, _Alloc>
This actually makes a difference to clang when std::list is passed as a
template template parameter. See <<a class="bz_bug_link
bz_status_NEW "
title="NEW --- - defaulted class template parameters dropped when rededucing template template parameter"
href="show_bug.cgi?id=22601">http://llvm.org/bugs/show_bug.cgi?id=22601</a>>,
which was discovered when porting real-world code from libstdc++ to libc++.
If the default parameter is moved to the forward declaration, the problem goes
away. In other words, this is preferred:
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY list;
template <class _Tp, class _Alloc /* = allocator<_Tp>*/ >
class _LIBCPP_TYPE_VIS_ONLY list
: private __list_imp<_Tp, _Alloc>
In my own code, I achieve this with one internal header with nothing but
forward declarations. All defaults are specified there. All other headers
include this header first.</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>