http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53108
Bug #: 53108
Summary: Nested template classes and variadic templates
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
//Begin Code----------------------------------------------------
#include <cstring>
namespace my_types
{
struct nil {};
template <typename T, typename U>
struct chain
{
typedef T first_type;
typedef U second_type;
};
}
template <template <typename, typename> class Chain, typename Nil>
struct chain_generator
{
template <typename T, typename... Args>
struct gen
{
private:
template <size_t S = sizeof...(Args), typename Dummy = void>
struct inner
{
typedef Chain<T, typename gen<Args...>::type > type;
};
template <typename Dummy>
struct inner<0, Dummy>
{
typedef Chain<T, Nil> type;
};
public:
typedef typename inner<sizeof...(Args)>::type type;
};
};
int main( /* int argc, char* argv[] */ )
{
using my_types::chain;
using my_types::nil;
typedef chain<int, chain<float, chain<char, nil>>> t0;
typedef chain_generator<chain, nil> my_gen;
typedef my_gen::gen<int, float, char>::type t1;
return 0;
}
//End Code ----------------------------------------------------
See the attached file:
Compiler error:
test.cpp: In instantiation of 'struct chain_generator<my_types::chain,
my_types::nil>::gen<int, float, char>::inner<2u, void>':
test.cpp:44:49: required from 'struct chain_generator<my_types::chain,
my_types::nil>::gen<int, float, char>'
test.cpp:58:39: required from here
test.cpp:35:51: error: type/value mismatch at argument 1 in template parameter
list for 'template<template<class, class> class Chain, class Nil>
template<class T, class ... Args> struct chain_generator<Chain, Nil>::gen'
test.cpp:35:51: error: expected a type, got '#'tree_vec' not supported by
dump_expr#<expression error>'
test.cpp:35:51: error: type/value mismatch at argument 2 in template parameter
list for 'template<template<class, class> class Chain, class Nil>
template<class T, class ... Args> struct chain_generator<Chain, Nil>::gen'
test.cpp:35:51: error: expected a type, got '#'tree_vec' not supported by
dump_expr#<expression error>'