aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-mutable2.C
blob: c54ff5c841cdc96dd78864f9351d219276f0f306 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/55532
// { dg-do compile { target c++11 } }

struct Foo {
    void doit() {
    }
};

template<typename T>
void oops(Foo &foo, const T &) {
    auto fun = [&] () mutable {
        foo.doit();
    };
    auto fun2 = [=]() {
        fun();			// { dg-error "" }
    };
    fun2();
}

int main() {
    Foo foo;
    oops(foo, 1);
}