@@ -17,13 +17,31 @@ struct A {
1717 auto h = [* this ] () mutable { a ++ ; };// { dg-error "'*this' capture only available with" "" { target c++14_down } }
1818 auto i = [= ] { return a ; };
1919 auto j = [& ] { return a ; };
20- auto k = [= , this ] { return a ; };// { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" }
20+ // P0409R2 - C++2A lambda capture [=, this]
21+ auto k = [= , this ] { return a ; };// { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } }
2122 auto l = [& , this ] { return a ; };
2223 auto m = [= , * this ] { return a ; };// { dg-error "'*this' capture only available with" "" { target c++14_down } }
2324 auto n = [& , * this ] { return a ; };// { dg-error "'*this' capture only available with" "" { target c++14_down } }
2425 auto o = [* this , & v ] { return a + v ; };// { dg-error "'*this' capture only available with" "" { target c++14_down } }
2526 auto p = [* this ] { this = 0 ; }; // { dg-error "lvalue required as left operand of assignment" }
2627 // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
28+ auto q = [= , this , * this ] { return a ; };// { dg-error "already captured 'this'" }
29+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
30+ // { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } .-2 }
31+ auto r = [= , this , this ] { return a ; };// { dg-error "already captured 'this'" }
32+ // { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } .-1 }
33+ auto s = [= , * this , this ] { return a ; };// { dg-error "already captured 'this'" }
34+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
35+ // { dg-error "explicit by-copy capture of 'this' redundant with by-copy capture default" "" { target c++17_down } .-2 }
36+ auto t = [= , * this , * this ] { return a ; };// { dg-error "already captured 'this'" }
37+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
38+ auto u = [& , this , * this ] { return a ; };// { dg-error "already captured 'this'" }
39+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
40+ auto w = [& , this , this ] { return a ; };// { dg-error "already captured 'this'" }
41+ auto x = [& , * this , this ] { return a ; };// { dg-error "already captured 'this'" }
42+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
43+ auto y = [& , * this , * this ] { return a ; };// { dg-error "already captured 'this'" }
44+ // { dg-error "'*this' capture only available with" "" { target c++14_down } .-1 }
2745 }
2846};
2947struct B {
0 commit comments