<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 - "too many template arguments for class template" disallows sensible empty-parameter-pack instantiation"
href="https://bugs.llvm.org/show_bug.cgi?id=38431">38431</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"too many template arguments for class template" disallows sensible empty-parameter-pack instantiation
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tonyelewis@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>If I compile this:
template <typename> struct X {};
template <typename... Ts> void f ( X<int, Ts...> ) {}
template <typename... Ts> struct A { X<int, Ts...> x; };
int main() {
f<> ( X<int>{} );
A<> a{ X<int>{} };
}
...(with no additional command line flags) I get:
a.cpp:2:38: error: too many template arguments for class template 'X'
template <typename... Ts> void f ( X<int, Ts...> ) {}
^ ~~~~~~
a.cpp:1:28: note: template is declared here
template <typename> struct X {};
~~~~~~~~~~~~~~~~~~~ ^
a.cpp:3:38: error: too many template arguments for class template 'X'
template <typename... Ts> struct A { X<int, Ts...> x; };
^ ~~~~~~
a.cpp:1:28: note: template is declared here
template <typename> struct X {};
~~~~~~~~~~~~~~~~~~~ ^
a.cpp:6:5: error: no matching function for call to 'f'
f<> ( X<int>{} );
^~~
3 errors generated.
...but I'm guessing (and GCC 8.2 and GCC trunk apparently agree) that this code
is valid because f() and A can be reasonably instantiated with an empty
parameter pack, as illustrated in main(). I think the error should only come at
the point of any instantiation that actually instantiates X with too many
template arguments.
Godbolt indicates that this happens on 6.0.0 and trunk (338661).</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>