This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36413] Bug with variadic templates (-std=c++0x)
- From: "fred at tigen dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jun 2008 20:43:46 -0000
- Subject: [Bug c++/36413] Bug with variadic templates (-std=c++0x)
- References: <bug-36413-16266@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from fred at tigen dot org 2008-06-01 20:43 -------
This code is sufficient to cause the bug.
It simply builds recursively a TypeTuple formed of all types given as template
parameters (TypeTuple<Types...>):
// Type tuples
template <typename... An> struct TypeTuple;
// Transfer types from TypeTuple TupB to Apply<>::Tuple
template <typename TupA, typename... Types> struct Apply;
template <typename... An, typename B1, typename... Bn>
struct Apply<TypeTuple<An...>, B1, Bn...> {
typedef B1 A1;
typedef Apply<TypeTuple<An..., A1>, Bn...> Next;
typedef typename Next::Tuple Tuple;
};
template <typename... An>
struct Apply<TypeTuple<An...>> {
typedef TypeTuple<An...> Tuple;
};
// Bug ?
int main(int argc, const char *argv[])
{
typedef Apply<TypeTuple<>, int, char>::Tuple Tuple;
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36413