<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 - Compilation error when pass variadic type arguments to non-variadic template type alias"
href="https://bugs.llvm.org/show_bug.cgi?id=35264">35264</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Compilation error when pass variadic type arguments to non-variadic template type alias
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.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>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gordon.dmitry@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following code fails to compile:
template <template <typename...> class Template>
struct TemplateCheckerOuter
{
template <typename T>
struct TemplateCheckerInner
{
static constexpr auto Result = false;
};
template <typename...Args>
struct TemplateCheckerInner<Template<Args...>>
{
static constexpr auto Result = true;
};
};
template <typename Val>
class TemplateClass {};
// If change to the following code compiles well:
// template <typename ...Val>
// using TemplateClassAlias = TemplateClass<Val...>;
template <typename Val>
using TemplateClassAlias = TemplateClass<Val>;
// This line succedes to compile
static_assert(TemplateCheckerOuter<TemplateClass>::TemplateCheckerInner<TemplateClassAlias<int>>::Result,"");
// This line fails to compile
static_assert(TemplateCheckerOuter<TemplateClassAlias>::TemplateCheckerInner<TemplateClassAlias<double>>::Result,"");
The error is:
11 : <source>:11:42: error: pack expansion used as argument for non-pack
parameter of alias template
struct TemplateCheckerInner<Template<Args...>>
^~~~~~~
29 : <source>:29:15: note: in instantiation of template class
'TemplateCheckerOuter<TemplateClassAlias>' requested here
static_assert(TemplateCheckerOuter<TemplateClassAlias>::TemplateCheckerInner<TemplateClassAlias<double>>::Result,"");
^
23 : <source>:23:20: note: template parameter is declared here
template <typename Val>
^
29 : <source>:29:1: error: static_assert failed ""
static_assert(TemplateCheckerOuter<TemplateClassAlias>::TemplateCheckerInner<TemplateClassAlias<double>>::Result,"");
^</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>