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



             Bug #: 55914

           Summary: [C++11] Pack expansion for class member expression

                    fails in lambda expressions

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: daniel.krueg...@googlemail.com





The following code, compiled with 



-Wall -std=c++11 -pedantic



is rejected by gcc 4.7.2 and gcc 4.8.0 20130106 (experimental):



//---------------------

struct S {

  int foo(){ return 0; }

};



template<class... Args>

void evaluate(Args...){}



template <class... Args>

void bar(Args... args) {

  evaluate(args.foo()...); // OK

  auto lmb = [=](){ evaluate(args.foo()...); }; // Error

  lmb();

}



int main() {

  S s{};

  bar(s);

}

//---------------------



"11|error: parameter packs not expanded with '...':|

11|note:         'args'|

In instantiation of 'void bar(Args ...) [with Args = {S}]':|

17|required from here|

11|error: using invalid field 'bar(Args ...)::__lambda0::__args'|

"



The problem also occurs for class member expressions of the form E1->E2 instead

of E1.E2.

Reply via email to