This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52380] New: [C++11] Number of variadic template arguments wrongly interpreted in class template
- From: "ai.azuma at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 25 Feb 2012 11:26:30 +0000
- Subject: [Bug c++/52380] New: [C++11] Number of variadic template arguments wrongly interpreted in class template
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52380
Bug #: 52380
Summary: [C++11] Number of variadic template arguments wrongly
interpreted in class template
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ai.azuma@gmail.com
Created attachment 26752
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26752
Output of -v option and preprocessed file
Here is a reproducer;
///////////////////////////////////////////////
// An enclosing class template is necessary to
// reproduce the bug.
template<typename T>
struct S
{
template<typename U>
struct Unary // Line 5
{};
template<unsigned, typename... Args>
struct Dispatch // Line 9
: public Unary<Args...>
{};
template<typename... Args>
struct Variadic
: public Dispatch<sizeof...(Args), Args...>
{};
};
int main()
{
S<void>::Variadic<void> z;
}
///////////////////////////////////////////////
GCC 4.7.0 20120218 (experimental) with -std=c++11 complains about the above
code;
main.cpp: In instantiation of 'struct S<void>::Dispatch<1u, void>':
main.cpp:14:10: required from 'struct S<void>::Variadic<void>'
main.cpp:21:27: required from here
main.cpp:9:10: error: wrong number of template arguments (2, should be 1)
main.cpp:5:10: error: provided for 'template<class T> template<class U> struct
S<T>::Unary'
Obviously, just one template argument is passed to `Unary'. However, GCC
misinterprets the number of template arguments as two.