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


             Bug #: 55853

           Summary: [C++11] ICE calling member function of templated class

                    in lambda

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

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

        ReportedBy: kyle.t.kon...@gmail.com





Created attachment 29075

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29075

preprocessed source



This appears to be similar but not identical to

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



Repro case:



#include <map>

#include <functional>



using namespace std;



struct tData {

  double a;

};



template<class DataType>

class MapWrap {

public:



  void Insert(const int& p, const DataType& data) {

    m_[p] = data;

  }



  function<void(const DataType&)> CreateInserter(function<int(const DataType&)>

data_to_int) {

    return [this, data_to_int](const DataType& data) {

Insert(data_to_int(data), data); };

  }



private:

  map<int, DataType> m_;

};



int main(int argc, char **argv) {

  MapWrap<tData> m;

  auto fn = m.CreateInserter([](const tData& d) { return static_cast<int>(d.a);

});

  fn({12});

}

Reply via email to