summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice19.C
blob: 9fb43cdb8b6873024675e9659489498b01c8ca15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// PR c++/61362
// { dg-do compile { target c++11 } }

struct function {
  template<class F>
  function(F){}

  void operator()(...) {}
};

struct Node {
  unsigned length;
};

template<typename N>
class C {
public:
  unsigned longest = 0;
  function 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);
}