Bug while testing variadic templates in both c++0x & gnu++0x modes.
The compiler itself says:
"Test.cpp:22: internal compiler error: in finish_member_declaration, at
cp/semantics.c:2311
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions."
==== GCC OUTPUT ====
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared
--enable-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit
--disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu
--disable-libstdcxx-pch --with-tune=generic --disable-werror
--enable-cheching=release --program-suffix=-4.4
--enable-version-specific-runtime-libs
Thread model: posix
gcc version 4.4.0 20080530 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-mtune=generic'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/cc1plus -quiet -v -D_GNU_SOURCE
Test.cpp -quiet -dumpbase Test.cpp -mtune=generic -auxbase Test -std=c++0x
-version -o /tmp/ccAHpJPe.s
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include/c++
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include/c++/x86_64-unknown-linux-gnu
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include/c++/backward
/usr/local/include
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include-fixed
/usr/include
End of search list.
GNU C++ (GCC) version 4.4.0 20080530 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.4.0 20080530 (experimental), GMP version
4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 4ec09757f69fad896c3c6e042e6400dd
Test.cpp: In instantiation of 'Apply<TypeTuple<int>, TypeTuple<SomeTag<char> >
>':
Test.cpp:24: instantiated from 'Apply<TypeTuple<>, TypeTuple<int,
SomeTag<char> > >'
Test.cpp:35: instantiated from here
Test.cpp:22: internal compiler error: in finish_member_declaration, at
cp/semantics.c:2311
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
==== SOURCE ====
// Type tuples
template <typename... An> struct TypeTuple;
// Tag management
template <typename T> struct SomeTag;
template <typename T>
struct RemoveTag {
typedef T Type;
};
template <typename T>
struct RemoveTag<SomeTag<T>> {
typedef T Type;
};
// Remove tags from TupB to TupA
template <typename TupA, typename TupB> struct Apply;
template <typename... An, typename B1, typename... Bn>
struct Apply<TypeTuple<An...>, TypeTuple<B1, Bn...>> {
typedef typename RemoveTag<B1>::Type A1;
typedef Apply<TypeTuple<An..., A1>, TypeTuple<Bn...>> Next;
typedef typename Next::Tuple Tuple;
};
template <typename... An>
struct Apply<TypeTuple<An...>, TypeTuple<>> {
typedef TypeTuple<An...> Tuple;
};
// Bug ?
int main(int argc, const char *argv[])
{
typedef Apply<TypeTuple<>, TypeTuple<int, SomeTag<char>>>::Tuple Tuple;
return 0;
}
--
Summary: Bug with variadic templates (-std=c++0x)
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fred at tigen dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36413