http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52454

             Bug #: 52454
           Summary: [C++0x] Variadic template expansion as template
                    parameters does not work in typedef
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: fat.loby...@gmail.com


Hello, I am trying to do the following:

-------------------------------------------------------------------------------
template <typename T1, typename T2, typename... Tail>
struct A {
    static_assert(sizeof...(Tail)%2 == 0, "Number of arguments must be even!");
};

template <typename... Pack>
struct B {
    typedef A<Pack...> a;
};

int main() {}
-------------------------------------------------------------------------------


I want to access the type A<...> via a Proxy Type B<...>, using a typedef.
However, the expansion does not work: the Pack... is still treated as one
Parameter:

$ g++-4.7 -std=c++0x -Wall -g     double-head-pop.cpp   -o double-head-pop
double-head-pop.cpp:8:22: error: wrong number of template arguments (1, should
be 2 or more)
double-head-pop.cpp:2:8: error: provided for 'template<class T1, class T2,
class ... Tail> struct A'


I'm not quite sure if my code is valid C++, but I don't see a mistake. Also,
Clang from trunk can compile the code.
This looks a little bit like http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39653,
but is clearly not fixed.

My configuration:
$ g++-4.7 -v
Using built-in specs.
COLLECT_GCC=g++-4.7
COLLECT_LTO_WRAPPER=/home/alexander/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/home/alexander/usr/local/
--program-suffix=-4.7 --enable-threads --disable-nls --enable-languages=c,c++
--disable-checking
Thread model: posix
gcc version 4.7.0 20120229 (experimental) (GCC)

Reply via email to