This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36413] Bug with variadic templates (-std=c++0x)



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]