<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Clang fails to instantiate parent class with parameter pack"
href="https://bugs.llvm.org/show_bug.cgi?id=44890">44890</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang fails to instantiate parent class with parameter pack
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>smeenai@fb.com
</td>
</tr>
<tr>
<th>CC</th>
<td>hans@chromium.org, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>Blocks</th>
<td>44555
</td>
</tr></table>
<p>
<div>
<pre>$ cat reduced.cpp
template <class... Ts>
struct tuple {};
template <unsigned I, class... Ts>
int get0(const tuple<Ts...>& t) {
return 0;
}
template <class... Ts>
struct tuple_wrapper : public tuple<Ts...> {
template <unsigned I>
int get() {
return get0<0, Ts...>(*this);
}
};
int f() {
tuple_wrapper<int> w;
return w.get<0>();
}
$ clang -cc1 -fsyntax-only reduced.cpp
reduced.cpp:13:12: error: no matching function for call to 'get0'
return get0<0, Ts...>(*this);
^~~~~~~~~~~~~~
reduced.cpp:19:12: note: in instantiation of function template specialization
'tuple_wrapper<int>::get<0>' requested here
return w.get<0>();
^
reduced.cpp:5:5: note: candidate template ignored: deduced type 'const tuple<>'
of 1st parameter does not match adjusted type 'tuple_wrapper<int>' of argument
[with I = 0, Ts = <>]
int get0(const tuple<Ts...>& t) {
^
1 error generated.
I bisected this to
<a href="https://github.com/llvm/llvm-project/commit/907cefe721437fa8950c1b6c1c028038b175f921">https://github.com/llvm/llvm-project/commit/907cefe721437fa8950c1b6c1c028038b175f921</a>,
so it's a regression in 10.0. gcc, MSVC and Clang 9 all accept this code:
<a href="https://godbolt.org/z/TfZBf2">https://godbolt.org/z/TfZBf2</a>
Clang trunk does compile this if I explicitly instantiate the parent class, but
I don't believe that should be necessary, i.e. if I change the body of
tuple_wrapper::get to
return get0<0, Ts...>(tuple<Ts...>(*this));</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_CONFIRMED "
title="CONFIRMED - [meta] 10.0.0 Release Blockers"
href="https://bugs.llvm.org/show_bug.cgi?id=44555">Bug 44555</a>] [meta] 10.0.0 Release Blockers
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>