// g++-4 will meet internal compiler error
// g++-5.2 above fix this bug
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61362#c8
#include <functional>

struct Node {
    size_t length;
};

template<typename N>
class C {
public:
  size_t longest = 0;
  std::function<void(const N )> f = [this](N node) {
    if(node->length > this->longest) this->longest = node->length;
  };
};

int main() {

  Node n;
  n.length = 5;
  C<Node*> c;
  c.f(&n);
}
