[Bug c++/57527] New: [C++11] Nested variadic templates cause internal compiler error
markus.mayr at outlook dot com
gcc-bugzilla@gcc.gnu.org
Tue Jun 4 15:38:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57527
Bug ID: 57527
Summary: [C++11] Nested variadic templates cause internal
compiler error
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: markus.mayr at outlook dot com
I do not know whether the following program is supposed to compile according to
the standard. I only know that it compiles using clang and that it causes an
internal compiler error. I use a variadic template constructor within a
variadic template class and expand both parameter packs simultaneously.
struct Z {};
template <class Arg, unsigned int N>
struct X {};
template <class... Args>
struct Y
{
template <unsigned int... N>
Y( X<Args, N>... xs )
{}
};
int main( int argc, char **argv )
{
X<Z,1> x;
Y<Z> y( x );
return 0;
}
Instantiating the constructor causes an internal compiler error:
t.cpp: In function 'int main(int, char**)':
t.cpp:16:25: internal compiler error: in unify, at cp/pt.c:16369
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
If x is replaced by a temporary, the code compiles, i.e. replacing main() by
int main( int argc, char **argv )
{
Y<Z> y( X<Z,1> x );
return 0;
}
compiles. Turning x into an rvalue reference, however, does not compile.
I added the code as an attachment. My compiler version is g++-4.7.2, but I am
currently compiling a more recent version of g++ (4.8.0) to test this. I tested
the code on Mac OS X and Debian GNU/Linux. As already mentioned, clang++ seems
to accept the code. As a side note, I would also be interested in a workaround
for enumerating arguments in a parameter pack provided that there might be
arguments of the same type in the pack.
I hope that this bug is new to you.
More information about the Gcc-bugs
mailing list