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++/54764] New: In class initialization of non-static lambda member can't be used in class with default template paramer


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

             Bug #: 54764
           Summary: In class initialization of non-static lambda member
                    can't be used in class with default template paramer
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: leonid@volnitsky.com


Clang-3.2 compiles (FWIW), but rejected by GCC 4.7.1 and 4.8:

------------------------------------------------------------------
#include <functional>

template<class T=void>
struct  c{
    std::function<int(int)> f = [](int i){return i+i;};
};

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

Error message:

t.cc:6:31: error: default argument for template parameter for class enclosing
âstruct __lambda0â
  function<int(int)> f = [](int i){return i+i;};
                               ^


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