[Bug c++/36413] Bug with variadic templates (-std=c++0x)
fred at tigen dot org
gcc-bugzilla@gcc.gnu.org
Sun Jun 1 20:44:00 GMT 2008
------- 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
More information about the Gcc-bugs
mailing list