gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice19.C
raw| 1 | // PR c++/61362 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct function { |
| 5 | template<class F> |
| 6 | function(F){} |
| 7 | |
| 8 | void operator()(...) {} |
| 9 | }; |
| 10 | |
| 11 | struct Node { |
| 12 | unsigned length; |
| 13 | }; |
| 14 | |
| 15 | template<typename N> |
| 16 | class C { |
| 17 | public: |
| 18 | unsigned longest = 0; |
| 19 | function f = [this](N node) { |
| 20 | if(node->length > this->longest) this->longest = node->length; |
| 21 | }; |
| 22 | }; |
| 23 | |
| 24 | int main() { |
| 25 | Node n; |
| 26 | n.length = 5; |
| 27 | C<Node*> c; |
| 28 | c.f(&n); |
| 29 | } |