<html>
<head>
<base href="https://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 --- - Suspicious warning on non-deducible parameter pack" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24058&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=niV5OCTpUaEHvwXa7unX7k1whcU_oGJjnVsz6XL5DFI&s=szg6BUTQ-dhqPkGUiENHyMpjJ38Dditvy6bPLVTFofs&e=">24058</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Suspicious warning on non-deducible parameter pack
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kaballo86@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following snippet generates a suspicious looking warning:
#include <cstddef>
#include <tuple>
#include <utility>
template <typename ...Ts>
struct pack {};
template <typename LowIs, typename ...Ts>
struct _split;
template <std::size_t ...LowIs, typename ...Ts>
struct _split<std::index_sequence<LowIs...>, Ts...> {
using left = pack<
typename std::tuple_element<LowIs, std::tuple<Ts...>>::type...>;
template <typename Is>
struct _right;
template <std::size_t ...HighIs>
struct _right<std::index_sequence<LowIs..., HighIs...>> {
using type = pack<
typename std::tuple_element<HighIs,
std::tuple<Ts...>>::type...>;
};
using right = typename
_right<std::make_index_sequence<sizeof...(Ts)>>::type;
};
template <typename ...Ts>
struct split
: _split<std::make_index_sequence<sizeof...(Ts)/2>, Ts...>
{};
int main() {
split<int, float, double, bool>::left l = pack<int, float>{};
split<int, float, double, bool>::right r = pack<double, bool>{};
(void)l; (void)r;
}
The warning is:
prog.cc:20:12: warning: class template partial specialization contains a
template parameter that cannot be deduced; this partial specialization will
never be used
struct _right<std::index_sequence<LowIs..., HighIs...>> {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:19:30: note: non-deducible template parameter 'HighIs'
template <std::size_t ...HighIs>
Regardless of it compilation succeeds, so the parameter is in fact being
deduced and the specialization used. From a cursory looking at the standard,
[temp.deduct.type]/9 seems to suggest the warning is correct and the snippet
should fail to compile.</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>