[llvm-bugs] [Bug 35264] New: Compilation error when pass variadic type arguments to non-variadic template type alias
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 9 07:04:08 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35264
Bug ID: 35264
Summary: Compilation error when pass variadic type arguments to
non-variadic template type alias
Product: clang
Version: 5.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: gordon.dmitry at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
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,"");
^
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171109/3d0e1021/attachment.html>
More information about the llvm-bugs
mailing list