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++/48424] New: C++0x parameter packs expansion problem


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

           Summary: C++0x parameter packs expansion problem
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: aiedail92@gmail.com


The following testcase, which should be valid (at least I think so), fails to
compile:


#include <tuple>
#include <functional>

template<typename... T>
struct test
{
    std::tuple<int, T..., long> t;          // OK
    void(*fptr)(int, T..., long);           // Error (1)
    std::function<void(int, T..., long)> f; // Error (2)
};


Since in (1) and (2) T... is not a parameter pack declaration, but a parameter
pack expansion, shouldn't the code be valid? And if it's really not valid, is
there a good explanation for this?


luca@laptop-luca:~$ g++ --version
g++ (GCC) 4.7.0 20110330 (experimental)

luca@laptop-luca:~$ g++ -std=c++0x testcase.cc 
testcase.cc:8:32: error: parameter packs must be at the end of the parameter
list
testcase.cc:9:39: error: parameter packs must be at the end of the parameter
list


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